From 4af994ed7485403b8ace60986a08d5c1608b6019 Mon Sep 17 00:00:00 2001 From: angelblue05 Date: Sat, 12 Mar 2016 15:14:07 -0600 Subject: [PATCH] enumerate over backdrops --- resources/lib/artwork.py | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-) diff --git a/resources/lib/artwork.py b/resources/lib/artwork.py index 6cec643c..2740f09c 100644 --- a/resources/lib/artwork.py +++ b/resources/lib/artwork.py @@ -511,7 +511,7 @@ class Artwork(): server = self.server - id = item['Id'] + itemid = item['Id'] artworks = item['ImageTags'] backdrops = item.get('BackdropImageTags',[]) @@ -537,15 +537,12 @@ class Artwork(): } # Process backdrops - backdropIndex = 0 - for backdroptag in backdrops: + for index, tag in enumerate(backdrops): artwork = ( "%s/emby/Items/%s/Images/Backdrop/%s?" "MaxWidth=%s&MaxHeight=%s&Format=original&Tag=%s%s" - % (server, id, backdropIndex, - maxWidth, maxHeight, backdroptag, customquery)) + % (server, itemid, index, maxWidth, maxHeight, tag, customquery)) allartworks['Backdrop'].append(artwork) - backdropIndex += 1 # Process the rest of the artwork for art in artworks: @@ -555,7 +552,7 @@ class Artwork(): artwork = ( "%s/emby/Items/%s/Images/%s/0?" "MaxWidth=%s&MaxHeight=%s&Format=original&Tag=%s%s" - % (server, id, art, maxWidth, maxHeight, tag, customquery)) + % (server, itemid, art, maxWidth, maxHeight, tag, customquery)) allartworks[art] = artwork # Process parent items if the main item is missing artwork @@ -569,15 +566,12 @@ class Artwork(): # If there is a parentId, go through the parent backdrop list parentbackdrops = item['ParentBackdropImageTags'] - backdropIndex = 0 - for parentbackdroptag in parentbackdrops: + for index, tag in enumerate(parentbackdrops): artwork = ( "%s/emby/Items/%s/Images/Backdrop/%s?" "MaxWidth=%s&MaxHeight=%s&Format=original&Tag=%s%s" - % (server, parentId, backdropIndex, - maxWidth, maxHeight, parentbackdroptag, customquery)) + % (server, parentId, index, maxWidth, maxHeight, tag, customquery)) allartworks['Backdrop'].append(artwork) - backdropIndex += 1 # Process the rest of the artwork parentartwork = ['Logo', 'Art', 'Thumb']