|
@ -72,8 +72,8 @@ class TheTVDb(ShowProvider): |
|
|
if raw: |
|
|
if raw: |
|
|
try: |
|
|
try: |
|
|
nr = 0 |
|
|
nr = 0 |
|
|
for show in raw: |
|
|
for show_info in raw: |
|
|
show = self.tvdb[int(show['id'])] |
|
|
show = self.tvdb[int(show_info['id'])] |
|
|
results.append(self.parseShow(show)) |
|
|
results.append(self.parseShow(show)) |
|
|
nr += 1 |
|
|
nr += 1 |
|
|
if nr == limit: |
|
|
if nr == limit: |
|
@ -97,6 +97,23 @@ class TheTVDb(ShowProvider): |
|
|
|
|
|
|
|
|
return show |
|
|
return show |
|
|
|
|
|
|
|
|
|
|
|
def getShowInfo(self, identifier = None): |
|
|
|
|
|
if not identifier: |
|
|
|
|
|
return None |
|
|
|
|
|
|
|
|
|
|
|
cache_key = 'thetvdb.cache.%s' % identifier |
|
|
|
|
|
log.debug('Getting showInfo: %s', cache_key) |
|
|
|
|
|
result = self.getCache(cache_key) or {} |
|
|
|
|
|
if result: |
|
|
|
|
|
return result |
|
|
|
|
|
|
|
|
|
|
|
show = self.getShow(identifier=identifier) |
|
|
|
|
|
if show: |
|
|
|
|
|
result = self.parseShow(show) |
|
|
|
|
|
self.setCache(cache_key, result) |
|
|
|
|
|
|
|
|
|
|
|
return result |
|
|
|
|
|
|
|
|
def getSeasonInfo(self, identifier=None, season_identifier=None): |
|
|
def getSeasonInfo(self, identifier=None, season_identifier=None): |
|
|
"""Either return a list of all seasons or a single season by number. |
|
|
"""Either return a list of all seasons or a single season by number. |
|
|
identifier is the show 'id' |
|
|
identifier is the show 'id' |
|
@ -177,23 +194,6 @@ class TheTVDb(ShowProvider): |
|
|
self.setCache(cache_key, result) |
|
|
self.setCache(cache_key, result) |
|
|
return result |
|
|
return result |
|
|
|
|
|
|
|
|
def getShowInfo(self, identifier = None): |
|
|
|
|
|
if not identifier: |
|
|
|
|
|
return None |
|
|
|
|
|
|
|
|
|
|
|
cache_key = 'thetvdb.cache.%s' % identifier |
|
|
|
|
|
log.debug('Getting showInfo: %s', cache_key) |
|
|
|
|
|
result = self.getCache(cache_key) or {} |
|
|
|
|
|
if result: |
|
|
|
|
|
return result |
|
|
|
|
|
|
|
|
|
|
|
show = self.getShow(identifier=identifier) |
|
|
|
|
|
if show: |
|
|
|
|
|
result = self.parseShow(show) |
|
|
|
|
|
self.setCache(cache_key, result) |
|
|
|
|
|
|
|
|
|
|
|
return result |
|
|
|
|
|
|
|
|
|
|
|
def parseShow(self, show): |
|
|
def parseShow(self, show): |
|
|
""" |
|
|
""" |
|
|
show[74713] = { |
|
|
show[74713] = { |
|
@ -229,10 +229,10 @@ class TheTVDb(ShowProvider): |
|
|
# return None |
|
|
# return None |
|
|
|
|
|
|
|
|
## Images |
|
|
## Images |
|
|
poster = self.getImage(show, type = 'poster', size = 'cover') |
|
|
poster = show['poster'] |
|
|
backdrop = self.getImage(show, type = 'fanart', size = 'w1280') |
|
|
backdrop = show['fanart'] |
|
|
#poster_original = self.getImage(show, type = 'poster', size = 'original') |
|
|
#poster = self.getImage(show, type = 'poster', size = 'cover') |
|
|
#backdrop_original = self.getImage(show, type = 'backdrop', size = 'original') |
|
|
#backdrop = self.getImage(show, type = 'fanart', size = 'w1280') |
|
|
|
|
|
|
|
|
genres = [] if show['genre'] is None else show['genre'].strip('|').split('|') |
|
|
genres = [] if show['genre'] is None else show['genre'].strip('|').split('|') |
|
|
if show['firstaired'] is not None: |
|
|
if show['firstaired'] is not None: |
|
@ -276,15 +276,20 @@ class TheTVDb(ShowProvider): |
|
|
|
|
|
|
|
|
show_data = dict((k, v) for k, v in show_data.iteritems() if v) |
|
|
show_data = dict((k, v) for k, v in show_data.iteritems() if v) |
|
|
|
|
|
|
|
|
## Add alternative names |
|
|
# Add alternative titles |
|
|
#for alt in ['original_name', 'alternative_name']: |
|
|
try: |
|
|
#alt_name = toUnicode(show['alt)) |
|
|
raw = self.tvdb.search(show['seriesname']) |
|
|
#if alt_name and not alt_name in show_data['titles'] and alt_name.lower() != 'none' and alt_name != None: |
|
|
if raw: |
|
|
#show_data['titles'].append(alt_name) |
|
|
for show_info in raw: |
|
|
|
|
|
if show_info['id'] == show_data['id'] and show_info.get('aliasnames', None): |
|
|
|
|
|
for alt_name in show_info['aliasnames'].split('|'): |
|
|
|
|
|
show_data['titles'].append(toUnicode(alt_name)) |
|
|
|
|
|
except (tvdb_exceptions.tvdb_error, IOError), e: |
|
|
|
|
|
log.error('Failed searching TheTVDB for "%s": %s', (search_string, traceback.format_exc())) |
|
|
|
|
|
|
|
|
return show_data |
|
|
return show_data |
|
|
|
|
|
|
|
|
def parseSeason(self, show, season_tuple): |
|
|
def parseSeason(self, show, season_tuple): |
|
|
""" |
|
|
""" |
|
|
contains no data |
|
|
contains no data |
|
|
""" |
|
|
""" |
|
@ -316,7 +321,7 @@ class TheTVDb(ShowProvider): |
|
|
season_data = dict((k, v) for k, v in season_data.iteritems() if v) |
|
|
season_data = dict((k, v) for k, v in season_data.iteritems() if v) |
|
|
return season_data |
|
|
return season_data |
|
|
|
|
|
|
|
|
def parseEpisode(self, show, episode): |
|
|
def parseEpisode(self, show, episode): |
|
|
""" |
|
|
""" |
|
|
('episodenumber', u'1'), |
|
|
('episodenumber', u'1'), |
|
|
('thumb_added', None), |
|
|
('thumb_added', None), |
|
|