Fixed multiple episodes subtitles upload to use the first episode number found. #1562

pull/1569/head
morpheus65535 3 years ago
parent 66585ec765
commit 56ffa722e5

@ -2014,10 +2014,16 @@ class SubtitleNameInfo(Resource):
if 'subtitle_language' in guessit_result: if 'subtitle_language' in guessit_result:
result['subtitle_language'] = str(guessit_result['subtitle_language']) result['subtitle_language'] = str(guessit_result['subtitle_language'])
result['episode'] = 0
if 'episode' in guessit_result: if 'episode' in guessit_result:
if isinstance(guessit_result['episode'], list):
# for multiple episodes file, choose the first episode number
if len(guessit_result['episode']):
# make sure that guessit returned a list of more than 0 items
result['episode'] = int(guessit_result['episode'][0])
elif isinstance(guessit_result['episode'], (str, int)):
# if single episode (should be int but just in case we cast it to int)
result['episode'] = int(guessit_result['episode']) result['episode'] = int(guessit_result['episode'])
else:
result['episode'] = 0
if 'season' in guessit_result: if 'season' in guessit_result:
result['season'] = int(guessit_result['season']) result['season'] = int(guessit_result['season'])

Loading…
Cancel
Save