Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Expose subtitle file size #2252

Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion bazarr/api/swaggerui.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@
"code3": fields.String(),
"path": fields.String(),
"forced": fields.Boolean(),
"hi": fields.Boolean()
"hi": fields.Boolean(),
"file_size": fields.Integer(),
phyzical marked this conversation as resolved.
Show resolved Hide resolved
}

subtitles_language_model = {
Expand Down
3 changes: 2 additions & 1 deletion bazarr/api/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,8 @@ def postprocess(item):
"code2": language[0],
"code3": alpha3_from_alpha2(language[0]),
"forced": False,
"hi": False}
"hi": False,
"file_size": subs[2]}
phyzical marked this conversation as resolved.
Show resolved Hide resolved
if len(language) > 1:
item['subtitles'][i].update(
{
Expand Down
1 change: 1 addition & 0 deletions bazarr/app/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@

app = create_app()
ui_bp.register_blueprint(api_bp, url_prefix='/api')
ui_bp.register_blueprint(api_bp, url_prefix='/api/v1', name="api_alias")
morpheus65535 marked this conversation as resolved.
Show resolved Hide resolved
phyzical marked this conversation as resolved.
Show resolved Hide resolved
# Mute UserWarning with flask-restx and Flask >= 2.2.0. Will be raised as an exception in 2.3.0
# https://github.com/python-restx/flask-restx/issues/485
warnings.filterwarnings('ignore', message='The setup method ')
Expand Down
10 changes: 7 additions & 3 deletions libs/flask_restx/api.py
morpheus65535 marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
Expand Up @@ -873,9 +873,13 @@ def _deferred_blueprint_init(self, setup_state):
setup_state.add_url_rule = MethodType(
Api._blueprint_setup_add_url_rule_patch, setup_state
)
if not setup_state.first_registration:
raise ValueError("flask-restx blueprints can only be registered once.")
self._init_app(setup_state.app)

phyzical marked this conversation as resolved.
Show resolved Hide resolved
# https://github.com/flask-restful/flask-restful/issues/509
# if not setup_state.first_registration:
# raise ValueError("flask-restx blueprints can only be registered once.")
# self._init_app(setup_state.app)
if setup_state.first_registration:
self._init_app(setup_state.app)
phyzical marked this conversation as resolved.
Show resolved Hide resolved

def mediatypes_method(self):
"""Return a method that returns a list of mediatypes"""
Expand Down