From b3db2da3d84946222234bf3793be149a26f2fed1 Mon Sep 17 00:00:00 2001 From: LASER-Yi Date: Sat, 26 Sep 2020 20:58:56 +0800 Subject: [PATCH 1/3] add mass upload feature --- bazarr/api.py | 13 +- views/episodes.html | 390 ++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 402 insertions(+), 1 deletion(-) diff --git a/bazarr/api.py b/bazarr/api.py index 07c73d77e..6ad28c5d9 100644 --- a/bazarr/api.py +++ b/bazarr/api.py @@ -37,7 +37,7 @@ from scheduler import scheduler from subsyncer import subsync from filesystem import browse_bazarr_filesystem, browse_sonarr_filesystem, browse_radarr_filesystem -from subliminal_patch.core import SUBTITLE_EXTENSIONS +from subliminal_patch.core import SUBTITLE_EXTENSIONS, guessit from flask import Flask, jsonify, request, Response, Blueprint, url_for, make_response @@ -549,6 +549,15 @@ class Episodes(Resource): item.update({"desired_languages": desired_languages}) return jsonify(draw=draw, recordsTotal=row_count, recordsFiltered=row_count, data=result) +class SubtitleNameInfo(Resource): + @authenticate + def get(self): + name = request.args.get('filename') + if name is not None: + result = guessit(name, options=None) + return jsonify(data=result) + else: + return '', 400 class EpisodesSubtitlesDelete(Resource): @authenticate @@ -1990,6 +1999,8 @@ api.add_resource(SystemProviders, '/systemproviders') api.add_resource(SystemStatus, '/systemstatus') api.add_resource(SystemReleases, '/systemreleases') +api.add_resource(SubtitleNameInfo, '/subtitle_name_info') + api.add_resource(Series, '/series') api.add_resource(SeriesEditor, '/series_editor') api.add_resource(SeriesEditSave, '/series_edit_save') diff --git a/views/episodes.html b/views/episodes.html index ab39dd6a9..37a2e40a6 100644 --- a/views/episodes.html +++ b/views/episodes.html @@ -62,6 +62,10 @@ {% block bcright %}
+
+ +