Permalink
Browse files

Use ID as filename for images from TMDB instead of deriving from url

  • Loading branch information...
1 parent 44e54e6 commit 6e1b036408214fc8633e7e40f3480372db571520 Machine-Sanctum committed Nov 2, 2011
Showing with 7 additions and 6 deletions.
  1. +4 −1 default.py
  2. +3 −5 resources/lib/provider/tmdb.py
View
@@ -362,7 +362,10 @@ def download_fanart(self, media_list, providers):
break
if not self.failcount < self.failthreshold:
break
- fanartfile = provider.get_filename(fanarturl)
+ if self.mediatype == 'movie':
+ fanartfile = provider.get_filename(fanart['id'])
+ else:
+ fanartfile = provider.get_filename(fanarturl)
self.current_fanart = self.current_fanart + 1
### Check for set limits
if self.limit_extrafanart and self.downloaded_fanart >= self.limit_extrafanart_max:
@@ -16,11 +16,8 @@ def __init__(self):
self.url = "http://api.themoviedb.org/2.1/Movie.imdbLookup/" + language.get_abbrev() + "/xml/%s/%s"
- def get_filename(self, url):
- try:
- filename = url.split('backdrops', 1)[1].replace('/', '-').lstrip('-')
- except:
- filename = url.rsplit('/', 1)[1]
+ def get_filename(self, imageid):
+ filename = imageid + '.jpg'
return filename
def get_image_list(self, media_id):
@@ -40,6 +37,7 @@ def get_image_list(self, media_id):
info = {}
if image.get('type') == 'backdrop' and image.get('url'):
info['size'] = image.get('size')
+ info['id'] = image.get('id')
info['url'] = image.get('url')
info['height'] = int(image.get('height'))
info['width'] = int(image.get('width'))

0 comments on commit 6e1b036

Please sign in to comment.