From 6b0636217915330c073505552ccce178e64c70eb Mon Sep 17 00:00:00 2001 From: LASER-Yi Date: Tue, 21 Sep 2021 13:26:51 +0800 Subject: [PATCH] Fix error code 500 in /api/subtitles/info API #1551 --- bazarr/api.py | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/bazarr/api.py b/bazarr/api.py index 28d29b192..5e6873ead 100644 --- a/bazarr/api.py +++ b/bazarr/api.py @@ -2008,18 +2008,19 @@ class SubtitleNameInfo(Resource): for name in names: opts = dict() opts['type'] = 'episode' - result = guessit(name, options=opts) + guessit_result = guessit(name, options=opts) + result = {} result['filename'] = name - if 'subtitle_language' in result: - result['subtitle_language'] = str(result['subtitle_language']) + if 'subtitle_language' in guessit_result: + result['subtitle_language'] = str(guessit_result['subtitle_language']) - if 'episode' in result: - result['episode'] = result['episode'] + if 'episode' in guessit_result: + result['episode'] = int(guessit_result['episode']) else: result['episode'] = 0 - if 'season' in result: - result['season'] = result['season'] + if 'season' in guessit_result: + result['season'] = int(guessit_result['season']) else: result['season'] = 0