本文整理匯總了Python中lollypop.cache.InfoCache.exists方法的典型用法代碼示例。如果您正苦於以下問題:Python InfoCache.exists方法的具體用法?Python InfoCache.exists怎麽用?Python InfoCache.exists使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類lollypop.cache.InfoCache
的用法示例。
在下文中一共展示了InfoCache.exists方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: __cache_artists_info
# 需要導入模塊: from lollypop.cache import InfoCache [as 別名]
# 或者: from lollypop.cache.InfoCache import exists [as 別名]
def __cache_artists_info(self):
"""
Cache info for all artists
"""
# We create cache if needed
InfoCache.init()
# Then cache for lastfm/wikipedia/spotify/deezer/...
for (artist_id, artist, sort) in Lp().artists.get([]):
if not get_network_available() or\
InfoCache.exists(artist):
continue
artwork_set = False
for (api, helper, unused) in InfoCache.WEBSERVICES:
debug("Downloader::__cache_artists_info(): %[email protected]%s" % (artist,
api))
if helper is None:
continue
try:
method = getattr(self, helper)
(url, content) = method(artist)
if url is not None:
s = Lio.File.new_for_uri(url)
(status, data, tag) = s.load_contents()
if status:
artwork_set = True
InfoCache.add(artist, content, data, api)
debug("Downloader::__cache_artists_info(): %s"
% url)
else:
InfoCache.add(artist, None, None, api)
except Exception as e:
print("Downloader::__cache_artists_info():", e, artist)
InfoCache.add(artist, None, None, api)
if artwork_set:
GLib.idle_add(Lp().art.emit, 'artist-artwork-changed', artist)
self.__cache_artists_running = False