本文整理汇总了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