Avoid 'Insufficient data to process the guess' error (fix #1910)

pull/1929/head v1.1.1-beta.14
vitiko98 2 years ago
parent bc0a7c2e0f
commit fca1c9656e

@ -167,16 +167,19 @@ class Episode(Video):
if guess['type'] != 'episode': if guess['type'] != 'episode':
raise ValueError('The guess must be an episode guess') raise ValueError('The guess must be an episode guess')
if 'title' not in guess or 'episode' not in guess: # We'll ignore missing fields. The Video instance will be refined anyway.
raise ValueError('Insufficient data to process the guess')
# if 'title' not in guess or 'episode' not in guess:
# raise ValueError('Insufficient data to process the guess')
# Currently we only have single-ep support (guessit returns a multi-ep as a list with int values) # Currently we only have single-ep support (guessit returns a multi-ep as a list with int values)
# Most providers only support single-ep, so make sure it contains only 1 episode # Most providers only support single-ep, so make sure it contains only 1 episode
# In case of multi-ep, take the lowest episode (subtitles will normally be available on lowest episode number) # In case of multi-ep, take the lowest episode (subtitles will normally be available on lowest episode number)
episode_guess = guess.get('episode') episode_guess = guess.get('episode', 1)
episode = min(episode_guess) if episode_guess and isinstance(episode_guess, list) else episode_guess episode = min(episode_guess) if episode_guess and isinstance(episode_guess, list) else episode_guess
return cls(name, guess['title'], guess.get('season', 1), episode, title=guess.get('episode_title'), return cls(name, guess.get("title", "Unknown Title"), guess.get('season', 1), episode, title=guess.get('episode_title'),
year=guess.get('year'), source=guess.get('source'), original_series='year' not in guess, year=guess.get('year'), source=guess.get('source'), original_series='year' not in guess,
release_group=guess.get('release_group'), resolution=guess.get('screen_size'), release_group=guess.get('release_group'), resolution=guess.get('screen_size'),
video_codec=guess.get('video_codec'), audio_codec=guess.get('audio_codec'), video_codec=guess.get('video_codec'), audio_codec=guess.get('audio_codec'),
@ -220,14 +223,16 @@ class Movie(Video):
if guess['type'] != 'movie': if guess['type'] != 'movie':
raise ValueError('The guess must be a movie guess') raise ValueError('The guess must be a movie guess')
if 'title' not in guess: # We'll ignore missing fields. The Video instance will be refined anyway.
raise ValueError('Insufficient data to process the guess')
# if 'title' not in guess:
# raise ValueError('Insufficient data to process the guess')
alternative_titles = [] alternative_titles = []
if 'alternative_title' in guess: if 'alternative_title' in guess:
alternative_titles.append(u"%s %s" % (guess['title'], guess['alternative_title'])) alternative_titles.append(u"%s %s" % (guess['title'], guess['alternative_title']))
return cls(name, guess['title'], source=guess.get('source'), release_group=guess.get('release_group'), return cls(name, guess.get('title', 'Unknown Title'), source=guess.get('source'), release_group=guess.get('release_group'),
resolution=guess.get('screen_size'), video_codec=guess.get('video_codec'), resolution=guess.get('screen_size'), video_codec=guess.get('video_codec'),
audio_codec=guess.get('audio_codec'), year=guess.get('year'), alternative_titles=alternative_titles, audio_codec=guess.get('audio_codec'), year=guess.get('year'), alternative_titles=alternative_titles,
streaming_service=guess.get("streaming_service"), edition=guess.get("edition")) streaming_service=guess.get("streaming_service"), edition=guess.get("edition"))

Loading…
Cancel
Save