Python song.Song类代码示例

本文整理汇总了Python中song.Song的典型用法代码示例。如果您正苦于以下问题:Python Song类的具体用法?Python Song怎么用?Python Song使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


Python song.Song类代码示例

在下文中一共展示了Song类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: search

def search(query):

    result = api.search_all_access('lil dicky')['song_hits'][0]['track']
    s = Song(result['title'], result['artist'], result['album'])
    s.add_gmusic_id(result['nid'])
    s.add_gmusic_video_id(result['primaryVideo']['id'])
    return s
开发者ID:nrubin,项目名称:SongBabel,代码行数:7,代码来源:gmusic_api.py

示例2: get_song_by_track

 def get_song_by_track(self, track_num):
     tracks = self._get_track_list()
     song_num = tracks[track_num]
     song_id = 'song_{:02x}'.format(song_num)
     song = Song(song_id)
     song.set_controller(self._controller)
     return song
开发者ID:cyberixae,项目名称:kunquat,代码行数:7,代码来源:album.py

示例3: SongTests

class SongTests(unittest.TestCase):
    def setUp(self):
        self.test_song = Song(
            "Hells Bells",
            "ACDC",
            "Back in Black",
            5,
            312,
            320
            )

    def test_song_init(self):
        self.assertEqual(self.test_song.title, "Hells Bells")
        self.assertEqual(self.test_song.artist, "ACDC")
        self.assertEqual(self.test_song.album, "Back in Black")
        self.assertEqual(self.test_song.rating, 5)
        self.assertEqual(self.test_song.length, 312)
        self.assertEqual(self.test_song.bitrate, 320)

    def test_song_rate(self):
        self.test_song.rate(3)
        self.assertEqual(self.test_song.rating, 3)

    def test_song_rate_out_of_range(self):
        with self.assertRaises(ValueError):
            self.test_song.rate(8)
开发者ID:Legena,项目名称:HackBulgaria,代码行数:26,代码来源:song_tests.py

示例4: __init__

 def __init__(self, *args, **kwargs):
     # set addon object
     self.m_addon = kwargs["addon"]
     # passing "<windowId>" from RunScript() means run in background
     self.use_gui = kwargs["gui"]
     # initialize our super classes
     XBMCPlayer.__init__(self)
     Properties.__init__(self)
     # initialize timers
     self._lyric_timer = None
     self._fetch_timer = None
     # log started action
     self._log_addon_action("started")
     # initialize our Song class
     self.song = Song(addon=self.m_addon)
     # initialize our prefetched Song class
     # TODO: remove the self.isPlayingAudio() check when/if XBMC supports offset for player
     self.prefetched_song = None
     if (self.m_addon.getSetting("prefetch_lyrics") and self.isPlayingAudio()):
         self.prefetched_song = Song(addon=self.m_addon, prefetch=True)
     # start
     if (self.use_gui):
         self._start_gui()
     else:
         self._start_background()
开发者ID:nuka1195,项目名称:lyrics.xbmc_lyrics,代码行数:25,代码来源:player.py

示例5: SongTests

class SongTests(unittest.TestCase):

    def setUp(self):
        self.song = Song("The Jack", "ACDC", "T.N.T.", 4, 240, 320)

    def test_init(self):
        song = Song("The Jack", "ACDC", "T.N.T.", 4, 240, 320)
        self.assertEqual(song.title, "The Jack")
        self.assertEqual(song.artist, "ACDC")
        self.assertEqual(song.album, "T.N.T.")
        self.assertEqual(song.rating, 4)
        self.assertEqual(song.length, 240)
        self.assertEqual(song.bitrate, 320)

    def test_rate_value_error(self):
        with self.assertRaises(ValueError):
            self.song.rate(6)

    def test_rate_success(self):
        self.song.rate(3)
        self.assertEqual(self.song.rating, 3)

    def test_str(self):
        expected = "ACDC The Jack - 0:04:00"
        self.assertEqual(str(self.song), expected)
开发者ID:antonpetkoff,项目名称:Programming101,代码行数:25,代码来源:song_test.py

示例6: TestSong

class TestSong(unittest.TestCase):

    def setUp(self):
        self.song = Song(
            "Whole Lotta Love",
            "Led Zeppelin",
            "Led Zeppelin II",
            5,
            334,
            320000
        )

    def test_song_init(self):
        self.assertEqual(self.song.title, "Whole Lotta Love")
        self.assertEqual(self.song.artist, "Led Zeppelin")
        self.assertEqual(self.song.album, "Led Zeppelin II")
        self.assertEqual(self.song.rating, 5)
        self.assertEqual(self.song.length, 334)
        self.assertEqual(self.song.bitrate, 320000)

    def test_rate(self):
        self.song.rate(4)
        self.assertEqual(self.song.rating, 4)

    def test_rate_error(self):
        with self.assertRaises(ValueError):
            self.song.rate(200000)
开发者ID:stoilov,项目名称:Programming101,代码行数:27,代码来源:song_test.py

示例7: main

def main():
    """
    Main function
    """
    nbt = Song()
    for fpath in nbt.userpl():
        sys.stdout.write("%s\n" % (fpath))
开发者ID:rodo,项目名称:calorine,代码行数:7,代码来源:userpl.py

示例8: TestSong

class TestSong(unittest.TestCase):

    def setUp(self):
        self.test_song = Song(
            'Hells Bells',
            'AC/DC',
            'rough and though',
            5,
            520,
            256)

    def test_song_init(self):
        self.assertEqual(self.test_song.title, 'Hells Bells')
        self.assertEqual(self.test_song.artist, 'AC/DC')
        self.assertEqual(self.test_song.album, 'rough and though')
        self.assertEqual(self.test_song.rating, 5)
        self.assertEqual(self.test_song.lenght, 520)
        self.assertEqual(self.test_song.bitrate, 256)

    def test_rating(self):
        self.test_song.set_rating(4)
        self.assertEqual(self.test_song.rating, 4)

    def test_rating_out_of_range(self):
        with self.assertRaises(ValueError):
            self.test_song.set_rating(8)
开发者ID:IvanAlexandrov,项目名称:HackBulgaria-Tasks,代码行数:26,代码来源:test_song.py

示例9: main

def main():
    """
    Main function
    """
    nbt = Song()
    fname = nbt.next()
    #trigger(fname, "/tmp/calorine.socket")
    return fname
开发者ID:rodo,项目名称:calorine,代码行数:8,代码来源:playlist.py

示例10: choose_file_and_convert

 def choose_file_and_convert(self):
     filename = WinFile(False).run()
     if filename and common.file_is_supported(filename):
         tags = {"uri" : utils.get_uri_from_path(filename)}
         s = Song()
         s.init_from_dict(tags)
         s.read_from_file()
         AttributesUI([s]).show_window()
开发者ID:WilliamRen,项目名称:deepin-music-player,代码行数:8,代码来源:instance.py

示例11: test_tune_notation

 def test_tune_notation(self):
        song = Song(lyrics="hi")

        notation = song.tune_notation()

        self.assertRegexpMatches(notation, "[[inpt TUNE]]")
        self.assertRegexpMatches(notation, "1AY {D 435; P")
        self.assertRegexpMatches(notation, "hh {D 65; P")
        self.assertRegexpMatches(notation, "[[inpt TEXT]]")
开发者ID:dannysullivan,项目名称:songer,代码行数:9,代码来源:test_song.py

示例12: load

 def load(self, root):
     for dirpath, dirnames, filenames in os.walk(root, followlinks=True):
         for name in filenames:
             if not name.endswith(".txt"):
                 continue
             path = os.path.join(dirpath, name)
             print path
             song = Song(path)
             song.id = len(self.songs)
             self.songs.append(song)
开发者ID:UIKit0,项目名称:blitzloop,代码行数:10,代码来源:songlist.py

示例13: test_add_search_results

def test_add_search_results(self):
		print "testing if chosen search result is added correctly"
		text = "wonderwall"
		results = spotify.search(text, limit = 10, type = 'track')
		title = results['tracks']['items'][0]['name']
		artist = results['tracks']['items'][0]['artists'][0]['name']
		uri = results['tracks']['items'][0]['uri']
		song1 = Song(1, title, artist, uri)
		assert 'Wonderwall' in song1.getTitle()
		assert 'Oasis' in song1.getArtist()
开发者ID:EvanJRichter,项目名称:PartyFy,代码行数:10,代码来源:hello_tests.py

示例14: load

 def load(self):    
     objs = utils.load_db(self.db_file)
     songs = []
     if objs:
         for obj in objs:
             s = Song()
             s.init_from_dict(obj, cmp_key="sid")
             songs.append(s)
     if songs:        
         self.add_songs(songs)
开发者ID:binyuj,项目名称:dmusic-plugin-baidumusic,代码行数:10,代码来源:music_view.py

示例15: TestSong

class TestSong(unittest.TestCase):

    def setUp(self):
        self.song = Song("Sweet Child O'mine", "Guns N' Roses", "Appetite for Destruction", 5, 356, 320 )

    def test_rate_0(self):
        self.song.rate(5)
        self.assertEqual(5,self.song.rating)
    def test_rate_error(self):
        self.assertRaises(ValueError, lambda:self.song.rate(6))
开发者ID:dsspasov,项目名称:HackBulgaria,代码行数:10,代码来源:song_test.py

本文标签属性:

示例:示例英语

代码:代码转换器

Python:python基础教程

上一篇:Java PdfReader类代码示例
下一篇:C++ ACPI_PTR函数代码示例

为您推荐