Skip to content

Commit

Permalink
Allow episode search without episode number
Browse files Browse the repository at this point in the history
This fixes #692.

Not finding the episode number shouldn't raise an error, most of the time
it actually works without one anyway.
  • Loading branch information
evuez committed Oct 12, 2016
1 parent 7eb7a53 commit ff6ae65
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions subliminal/video.py
Original file line number Diff line number Diff line change
Expand Up @@ -162,13 +162,14 @@ def fromguess(cls, name, guess):
if guess['type'] != 'episode':
raise ValueError('The guess must be an episode guess')

if 'title' not in guess or 'episode' not in guess:
if 'title' not in guess:
raise ValueError('Insufficient data to process the guess')

return cls(name, guess['title'], guess.get('season', 1), guess['episode'], title=guess.get('episode_title'),
year=guess.get('year'), format=guess.get('format'), original_series='year' not in guess,
release_group=guess.get('release_group'), resolution=guess.get('screen_size'),
video_codec=guess.get('video_codec'), audio_codec=guess.get('audio_codec'))
return cls(name, guess['title'], guess.get('season', 1), guess.get('episode', 1),
title=guess.get('episode_title'), year=guess.get('year'), format=guess.get('format'),
original_series='year' not in guess, release_group=guess.get('release_group'),
resolution=guess.get('screen_size'), video_codec=guess.get('video_codec'),
audio_codec=guess.get('audio_codec'))

@classmethod
def fromname(cls, name):
Expand Down

0 comments on commit ff6ae65

Please sign in to comment.