Skip to content

Commit

Permalink
Fixing date parse when there's no firstAired entry. Use case insensit…
Browse files Browse the repository at this point in the history
…ive and 'aliases' for better series matching
  • Loading branch information
fernandog committed Apr 7, 2016
1 parent 1f87e70 commit 387befc
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions lib/subliminal/refiners/tvdb.py
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@ def match(series):
key = 0
if series['status'] != 'Continuing':
key += 1
if series['seriesName'] != name:
if series['seriesName'].lower() != name and name not in [alias.lower() for alias in series['aliases']]:
key += 2

return key
Expand Down Expand Up @@ -284,7 +284,7 @@ def refine(video, **kwargs):
logger.debug('Found result for original series without year')
found = True
break
if video.year == datetime.strptime(result['firstAired'], '%Y-%m-%d').year:
if result['firstAired'] and video.year == datetime.strptime(result['firstAired'], '%Y-%m-%d').year:
logger.debug('Found result with matching year')
found = True
break
Expand All @@ -299,7 +299,8 @@ def refine(video, **kwargs):
# add series information
logger.debug('Found series %r', result)
video.series = result['seriesName']
video.year = datetime.strptime(result['firstAired'], '%Y-%m-%d').year
if result['firstAired']:
video.year = datetime.strptime(result['firstAired'], '%Y-%m-%d').year
video.series_imdb_id = result['imdbId']
video.series_tvdb_id = result['id']

Expand Down

0 comments on commit 387befc

Please sign in to comment.