mirror of
https://github.com/morpheus65535/bazarr.git
synced 2025-01-19 05:07:51 +08:00
Fixed multiple episodes subtitles upload to use the first episode number found. #1562
This commit is contained in:
parent
66585ec765
commit
56ffa722e5
1 changed files with 9 additions and 3 deletions
|
@ -2014,10 +2014,16 @@ class SubtitleNameInfo(Resource):
|
|||
if 'subtitle_language' in guessit_result:
|
||||
result['subtitle_language'] = str(guessit_result['subtitle_language'])
|
||||
|
||||
result['episode'] = 0
|
||||
if 'episode' in guessit_result:
|
||||
result['episode'] = int(guessit_result['episode'])
|
||||
else:
|
||||
result['episode'] = 0
|
||||
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'])
|
||||
|
||||
if 'season' in guessit_result:
|
||||
result['season'] = int(guessit_result['season'])
|
||||
|
|
Loading…
Reference in a new issue