diff --git a/bazarr/embedded_subs_reader.py b/bazarr/embedded_subs_reader.py index 7cc44c29e..835f577f5 100644 --- a/bazarr/embedded_subs_reader.py +++ b/bazarr/embedded_subs_reader.py @@ -35,7 +35,7 @@ class EmbeddedSubsReader: else: for detected_language in detected_languages: subtitles_list.append([detected_language, False]) - # I can't get the forced flag from ffprobe so I always assume it as not forced + # I can't get the forced flag from ffprobe so I always assume it isn't forced return subtitles_list diff --git a/bazarr/main.py b/bazarr/main.py index a5ee82d67..0235ead67 100644 --- a/bazarr/main.py +++ b/bazarr/main.py @@ -643,6 +643,7 @@ def edit_series(no): lang = '[]' hi = request.forms.get('hearing_impaired') + forced = request.forms.get('forced') if hi == "on": hi = "True" @@ -651,8 +652,8 @@ def edit_series(no): conn = sqlite3.connect(os.path.join(args.config_dir, 'db', 'bazarr.db'), timeout=30) c = conn.cursor() - c.execute("UPDATE table_shows SET languages = ?, hearing_impaired = ? WHERE sonarrSeriesId LIKE ?", - (str(lang), hi, no)) + c.execute("UPDATE table_shows SET languages = ?, hearing_impaired = ?, forced = ? WHERE sonarrSeriesId LIKE ?", + (str(lang), hi, forced, no)) conn.commit() c.close() @@ -671,6 +672,7 @@ def edit_serieseditor(): series = ast.literal_eval(str('[' + series + ']')) lang = request.forms.getall('languages') hi = request.forms.get('hearing_impaired') + forced = request.forms.get('forced') conn = sqlite3.connect(os.path.join(args.config_dir, 'db', 'bazarr.db'), timeout=30) c = conn.cursor() @@ -684,6 +686,8 @@ def edit_serieseditor(): c.execute("UPDATE table_shows SET languages = ? WHERE sonarrSeriesId LIKE ?", (lang, serie)) if hi != '': c.execute("UPDATE table_shows SET hearing_impaired = ? WHERE sonarrSeriesId LIKE ?", (hi, serie)) + if forced != '': + c.execute("UPDATE table_shows SET forced = ? WHERE sonarrSeriesId LIKE ?", (forced, serie)) conn.commit() c.close() @@ -795,6 +799,7 @@ def edit_movieseditor(): movies = ast.literal_eval(str('[' + movies + ']')) lang = request.forms.getall('languages') hi = request.forms.get('hearing_impaired') + forced = request.forms.get('forced') conn = sqlite3.connect(os.path.join(args.config_dir, 'db', 'bazarr.db'), timeout=30) c = conn.cursor() @@ -808,6 +813,8 @@ def edit_movieseditor(): c.execute("UPDATE table_movies SET languages = ? WHERE radarrId LIKE ?", (lang, movie)) if hi != '': c.execute("UPDATE table_movies SET hearing_impaired = ? WHERE radarrId LIKE ?", (hi, movie)) + if forced != '': + c.execute("UPDATE table_movies SET forced = ? WHERE radarrId LIKE ?", (forced, movie)) conn.commit() c.close() @@ -841,6 +848,7 @@ def edit_movie(no): lang = '[]' hi = request.forms.get('hearing_impaired') + forced = request.forms.get('forced') if hi == "on": hi = "True" @@ -849,7 +857,7 @@ def edit_movie(no): conn = sqlite3.connect(os.path.join(args.config_dir, 'db', 'bazarr.db'), timeout=30) c = conn.cursor() - c.execute("UPDATE table_movies SET languages = ?, hearing_impaired = ? WHERE radarrId LIKE ?", (str(lang), hi, no)) + c.execute("UPDATE table_movies SET languages = ?, hearing_impaired = ?, forced = ? WHERE radarrId LIKE ?", (str(lang), hi, forced, no)) conn.commit() c.close() diff --git a/views/episodes.tpl b/views/episodes.tpl index 94eb06e07..71fca45c6 100644 --- a/views/episodes.tpl +++ b/views/episodes.tpl @@ -125,7 +125,7 @@ end end %> - + @@ -345,6 +345,18 @@ +
+
+ +
+
+ +
+
@@ -473,17 +485,16 @@ const languages_array = eval($(this).data("languages")); $('#series_languages').dropdown('set selected',languages_array); + $('#series_forced').dropdown('clear'); + $('#series_forced').dropdown('set selected',$(this).data("forced")); + if ($(this).data("hearing-impaired") === "True") { $("#series_hearing-impaired_div").checkbox('check'); } else { $("#series_hearing-impaired_div").checkbox('uncheck'); } - $('.config_dialog') - .modal({ - centered: true - }) - .modal('show'); + $('.config_dialog').modal('show'); }); $('.manual_search').on('click', function(){ diff --git a/views/movie.tpl b/views/movie.tpl index 10888deda..9eda04ed8 100644 --- a/views/movie.tpl +++ b/views/movie.tpl @@ -126,7 +126,7 @@ %if subs_languages is not None: %end - + @@ -305,6 +305,18 @@ +
+
+ +
+
+ +
+
@@ -432,17 +444,16 @@ const languages_array = eval($(this).data("languages")); $('#movie_languages').dropdown('set selected',languages_array); + $('#movie_forced').dropdown('clear'); + $('#movie_forced').dropdown('set selected',$(this).data("forced")); + if ($(this).data("hearing-impaired") === "True") { $("#movie_hearing-impaired_div").checkbox('check'); } else { $("#movie_hearing-impaired_div").checkbox('uncheck'); } - $('.config_dialog') - .modal({ - centered: true - }) - .modal('show'); + $('.config_dialog').modal('show'); }); $('.manual_search').on('click', function(){ diff --git a/views/movies.tpl b/views/movies.tpl index de96f150c..b471f3784 100644 --- a/views/movies.tpl +++ b/views/movies.tpl @@ -111,7 +111,7 @@ end end %> -
+
@@ -203,6 +203,18 @@
+
+
+ +
+
+ +
+
@@ -266,6 +278,9 @@ var languages_array = eval($(this).data("languages")); $('#movies_languages').dropdown('set selected',languages_array); + $('#movies_forced').dropdown('clear'); + $('#movies_forced').dropdown('set selected',$(this).data("forced")); + if ($(this).data("hearing-impaired") === "True") { $("#movies_hearing-impaired_div").checkbox('check'); } else { diff --git a/views/series.tpl b/views/series.tpl index 610496b80..4de5565c5 100644 --- a/views/series.tpl +++ b/views/series.tpl @@ -129,7 +129,7 @@ end end %> -
+
@@ -221,6 +221,18 @@
+
+
+ +
+
+ +
+
@@ -283,6 +295,9 @@ const languages_array = eval($(this).data("languages")); $('#series_languages').dropdown('set selected',languages_array); + $('#series_forced').dropdown('clear'); + $('#series_forced').dropdown('set selected',$(this).data("forced")); + if ($(this).data("hearing-impaired") === "True") { $("#series_hearing-impaired_div").checkbox('check'); } else { @@ -292,8 +307,6 @@ $('.small.modal').modal('show'); }); - $('#series_languages').dropdown(); - $('.progress').progress({ label: 'ratio', text: { diff --git a/views/wantedmovies.tpl b/views/wantedmovies.tpl index 64a28b5cb..a5aa2882f 100644 --- a/views/wantedmovies.tpl +++ b/views/wantedmovies.tpl @@ -67,18 +67,23 @@ from get_subtitle import search_active from config import settings for language in missing_languages: + if language.endswith(':forced'): + forced = True + else: + forced = False + end if row[6] is not None and settings.general.getboolean('adaptive_searching') and language in row[6]: for lang in ast.literal_eval(row[6]): if language in lang: active = search_active(lang[1]) if active: %> - + {{language}} %else: - + {{language}} @@ -86,7 +91,7 @@ %end %end %else: - + {{language}} @@ -170,6 +175,7 @@ sceneName: $(this).attr("data-sceneName"), language: $(this).attr("data-language"), hi: $(this).attr("data-hi"), + forced: $(this).attr("data-forced"), radarrId: $(this).attr("data-radarrId"), title: $(this).attr("data-title") }; diff --git a/views/wantedseries.tpl b/views/wantedseries.tpl index 287db15d6..423a811c7 100644 --- a/views/wantedseries.tpl +++ b/views/wantedseries.tpl @@ -74,18 +74,23 @@ from get_subtitle import search_active from config import settings for language in missing_languages: + if language.endswith(':forced'): + forced = True + else: + forced = False + end if row[9] is not None and settings.general.getboolean('adaptive_searching') and language in row[9]: for lang in ast.literal_eval(row[9]): if language in lang: active = search_active(lang[1]) if active: %> - + {{language}} %else: - + {{language}} @@ -93,7 +98,7 @@ %end %end %else: - + {{language}} @@ -177,6 +182,7 @@ sceneName: $(this).attr("data-sceneName"), language: $(this).attr("data-language"), hi: $(this).attr("data-hi"), + forced: $(this).attr("data-forced"), sonarrSeriesId: $(this).attr("data-sonarrSeriesId"), sonarrEpisodeId: $(this).attr("data-sonarrEpisodeId"), title: $(this).attr("data-title")