diff options
author | Jack <[email protected]> | 2023-10-10 10:11:54 +0800 |
---|---|---|
committer | GitHub <[email protected]> | 2023-10-09 22:11:54 -0400 |
commit | 4e7dedc43c1ceb936b093338363a8c6ff46505c1 (patch) | |
tree | f55b2abde4d330299b24f514007cab0cd7ed2a77 | |
parent | 33af93a341b326ca314de31c2d312513b209b307 (diff) | |
download | bazarr-4e7dedc43c1ceb936b093338363a8c6ff46505c1.tar.gz bazarr-4e7dedc43c1ceb936b093338363a8c6ff46505c1.zip |
Exposed subtitle file size through API
-rw-r--r-- | bazarr/api/swaggerui.py | 3 | ||||
-rw-r--r-- | bazarr/api/utils.py | 4 |
2 files changed, 5 insertions, 2 deletions
diff --git a/bazarr/api/swaggerui.py b/bazarr/api/swaggerui.py index b225f1532..e8eb979a2 100644 --- a/bazarr/api/swaggerui.py +++ b/bazarr/api/swaggerui.py @@ -15,7 +15,8 @@ subtitles_model = { "code3": fields.String(), "path": fields.String(), "forced": fields.Boolean(), - "hi": fields.Boolean() + "hi": fields.Boolean(), + "file_size": fields.Integer() } subtitles_language_model = { diff --git a/bazarr/api/utils.py b/bazarr/api/utils.py index 5f47b40b7..a61d50527 100644 --- a/bazarr/api/utils.py +++ b/bazarr/api/utils.py @@ -62,12 +62,14 @@ def postprocess(item): item['subtitles'] = ast.literal_eval(item['subtitles']) for i, subs in enumerate(item['subtitles']): language = subs[0].split(':') + file_size = subs[2] if len(subs) > 2 else 0 item['subtitles'][i] = {"path": path_replace(subs[1]), "name": language_from_alpha2(language[0]), "code2": language[0], "code3": alpha3_from_alpha2(language[0]), "forced": False, - "hi": False} + "hi": False, + "file_size": file_size} if len(language) > 1: item['subtitles'][i].update( { |