diff --git a/bazarr/api.py b/bazarr/api.py index 55659871a..2b4745814 100644 --- a/bazarr/api.py +++ b/bazarr/api.py @@ -557,9 +557,22 @@ class SubtitleNameInfo(Resource): opts = dict() opts['type'] = 'episode' result = guessit(name, options=opts) + + res = dict() + if 'episode' in result: + res['episode'] = result['episode'] + else: + res['episode'] = 0 + + if 'season' in result: + res['season'] = result['season'] + else: + res['season'] = 0 + if 'subtitle_language' in result: - result['subtitle_language'] = str(result['subtitle_language']) - return jsonify(data=result) + res['subtitle_language'] = str(result['subtitle_language']) + + return jsonify(data=res) else: return '', 400