mirror of
https://github.com/jellyfin/jellyfin-kodi.git
synced 2024-12-25 02:06:09 +00:00
Filter artwork
For artist/album/song poster type.
This commit is contained in:
parent
55c467afa0
commit
d6d1265b7c
1 changed files with 58 additions and 47 deletions
|
@ -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)
|
||||
|
||||
|
|
Loading…
Reference in a new issue