Filter artwork

For artist/album/song poster type.
This commit is contained in:
angelblue05 2018-06-09 01:20:39 -05:00
parent 55c467afa0
commit d6d1265b7c

View file

@ -361,8 +361,21 @@ class Artwork(object):
cursor=cursor)
def add_update_art(self, image_url, kodi_id, media_type, image_type, cursor):
# Possible that the imageurl is an empty string
if image_url:
''' Add or update the artwork (if it changed) to the Kodi database. Update the cache if
backdrop or poster image_type.
Possible to an empty imageurl since the process is automated.
'''
if image_type == 'poster' and media_type in ('song', 'artist', 'album'):
log.info("skipping poster for songs, artists, albums.")
return
if not image_url:
log.warn("empty url for: %s/%s", kodi_id, media_type)
return
cache_image = False
@ -375,10 +388,10 @@ class Artwork(object):
"AND type = ?"
))
cursor.execute(query, (kodi_id, media_type, image_type,))
try: # Update the artwork
try:
url = cursor.fetchone()[0]
except TypeError: # Add the artwork
except TypeError:
cache_image = True
log.debug("Adding Art Link for kodiId: %s (%s)", kodi_id, image_url)
@ -391,12 +404,11 @@ class Artwork(object):
)
cursor.execute(query, (kodi_id, media_type, image_type, image_url))
else: # Only cache artwork if it changed
else:
if url != image_url:
cache_image = True
# Only for the main backdrop, poster
if (window('emby_initialScan') != "true" and
image_type in ("fanart", "poster")):
# Delete current entry before updating with the new one
@ -415,7 +427,6 @@ class Artwork(object):
))
cursor.execute(query, (image_url, kodi_id, media_type, image_type))
# Cache fanart and poster in Kodi texture cache
if cache_image and image_type in ("fanart", "poster"):
self.cache_texture(image_url)