本文整理汇总了Python中lib.util.Util.is_compilation方法的典型用法代码示例。如果您正苦于以下问题:Python Util.is_compilation方法的具体用法?Python Util.is_compilation怎么用?Python Util.is_compilation使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类lib.util.Util
的用法示例。
在下文中一共展示了Util.is_compilation方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: RipperThread
# 需要导入模块: from lib.util import Util [as 别名]
# 或者: from lib.util.Util import is_compilation [as 别名]
class RipperThread(Thread):
_end_of_track = None
_queue = None
_ripper = None
_util = None
def get_end_of_track(self):
return self._end_of_track
def __init__(self, ripper, queue):
Thread.__init__(self)
self._end_of_track = Event()
self._queue = queue
self._ripper = ripper
self._util = Util(self._queue)
def run(self):
# wait for container
container_loaded.wait()
container_loaded.clear()
while True:
link_string = self._queue.next_link()
if link_string == '':
break
link = Link.from_string(link_string)
if link.type() == Link.LINK_TRACK:
track = link.as_track()
itrack = iter([track])
elif link.type() == Link.LINK_PLAYLIST \
or link_string == 'spotify:user:'+config_get('username')+':starred':
print 'Loading playlist %s ...' % link_string
playlist = link.as_playlist()
while not playlist.is_loaded():
time.sleep(0.1)
itrack = iter(playlist)
elif link.type() == Link.LINK_ALBUM:
print 'Processing album %s' % str(link)
itrack = [ ]
album = link.as_album()
album_browser = AlbumBrowser(album)
while not album_browser.is_loaded():
time.sleep(0.1)
if self._util.is_compilation(album):
continue
if album.is_available():
print 'Getting tracks for %s' % album.name()
for track in album_browser:
itrack.append(track)
elif link.type() == Link.LINK_ARTIST:
print "Processing artist %s ..." % str(link)
artist = link.as_artist()
artist_browser = ArtistBrowser(artist, 'no_tracks')
while not artist_browser.is_loaded():
time.sleep(0.1)
print "Artist loaded"
print(artist.name())
similar_artists = artist_browser.similar_artists()
for similar_artist in similar_artists:
self._queue.add_artist_link(similar_artist, 'similar')
albums = artist_browser.albums()
processed_albums = [ ]
itrack = [ ]
for album in albums:
if self._util.is_compilation(album):
continue
if album.is_available() and Link.from_album(album) \
not in processed_albums:
processed_albums.append(Link.from_album(album))
print 'Getting tracks for %s' % album.name()
album_browser = AlbumBrowser(album)
while not album_browser.is_loaded():
time.sleep(0.1)
for track in album_browser:
itrack.append(track)
else:
#.........这里部分代码省略.........