mirror of
https://github.com/morpheus65535/bazarr.git
synced 2025-01-01 12:32:25 +08:00
Exposed subtitle file size through API
This commit is contained in:
parent
33af93a341
commit
4e7dedc43c
2 changed files with 5 additions and 2 deletions
|
@ -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 = {
|
||||
|
|
|
@ -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(
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue