1
0
Fork 0
mirror of https://github.com/morpheus65535/bazarr synced 2024-12-24 16:52:06 +00:00

Continuing development.

This commit is contained in:
Louis Vézina 2019-05-21 23:33:59 -04:00
parent bb79ab5917
commit 85cad57b48
8 changed files with 96 additions and 26 deletions

View file

@ -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

View file

@ -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()

View file

@ -125,7 +125,7 @@
end
end
%>
<button id="config" class="ui button" data-tooltip="Edit series" data-tvdbid="{{details[5]}}" data-title="{{details[0]}}" data-poster="{{details[2]}}" data-audio="{{details[6]}}" data-languages="{{!subs_languages_list}}" data-hearing-impaired="{{details[4]}}"><i class="ui inverted large compact configure icon"></i></button>
<button id="config" class="ui button" data-tooltip="Edit series" data-tvdbid="{{details[5]}}" data-title="{{details[0]}}" data-poster="{{details[2]}}" data-audio="{{details[6]}}" data-languages="{{!subs_languages_list}}" data-hearing-impaired="{{details[4]}}" data-forced="{{details[9]}}"><i class="ui inverted large compact configure icon"></i></button>
</div>
</div>
</div>
@ -345,6 +345,18 @@
</div>
</div>
</div>
<div class="middle aligned row">
<div class="right aligned five wide column">
<label>Forced</label>
</div>
<div class="nine wide column">
<select name="forced" id="series_forced" class="ui fluid selection dropdown">
<option value="False">False</option>
<option value="True">True</option>
<option value="Both">Both</option>
</select>
</div>
</div>
</div>
</div>
</div>
@ -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(){

View file

@ -126,7 +126,7 @@
%if subs_languages is not None:
<button class="manual_search ui button" data-tooltip="Manually search for subtitles" data-inverted="" data-moviePath="{{details[8]}}" data-scenename="{{details[12]}}" data-language="{{subs_languages_list}}" data-hi="{{details[4]}}" data-forced="{{details[15]}}" data-movie_title="{{details[0]}}" data-radarrId="{{details[10]}}"><i class="ui inverted large compact user icon"></i></button>
%end
<button id="config" class="ui button" data-tooltip="Edit movie" data-inverted="" data-tmdbid="{{details[5]}}" data-title="{{details[0]}}" data-poster="{{details[2]}}" data-audio="{{details[6]}}" data-languages="{{!subs_languages_list}}" data-hearing-impaired="{{details[4]}}"><i class="ui inverted large compact configure icon"></i></button>
<button id="config" class="ui button" data-tooltip="Edit movie" data-inverted="" data-tmdbid="{{details[5]}}" data-title="{{details[0]}}" data-poster="{{details[2]}}" data-audio="{{details[6]}}" data-languages="{{!subs_languages_list}}" data-hearing-impaired="{{details[4]}}" data-forced="{{details[15]}}"><i class="ui inverted large compact configure icon"></i></button>
</div>
</div>
</div>
@ -305,6 +305,18 @@
</div>
</div>
</div>
<div class="middle aligned row">
<div class="right aligned five wide column">
<label>Forced</label>
</div>
<div class="nine wide column">
<select name="forced" id="movie_forced" class="ui fluid selection dropdown">
<option value="False">False</option>
<option value="True">True</option>
<option value="Both">Both</option>
</select>
</div>
</div>
</div>
</div>
</div>
@ -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(){

View file

@ -111,7 +111,7 @@
end
end
%>
<div class="config ui inverted basic compact icon" data-tooltip="Edit movies" data-inverted="" data-position="top right" data-no="{{row[5]}}" data-title="{{row[1]}}" data-poster="{{row[6]}}" data-languages="{{!subs_languages_list}}" data-hearing-impaired="{{row[4]}}" data-audio="{{row[7]}}">
<div class="config ui inverted basic compact icon" data-tooltip="Edit movies" data-inverted="" data-position="top right" data-no="{{row[5]}}" data-title="{{row[1]}}" data-poster="{{row[6]}}" data-languages="{{!subs_languages_list}}" data-forced="{{row[10]}}" data-hearing-impaired="{{row[4]}}" data-audio="{{row[7]}}">
<i class="ui black configure icon"></i>
</div>
</td>
@ -203,6 +203,18 @@
</div>
</div>
</div>
<div class="middle aligned row">
<div class="right aligned five wide column">
<label>Forced</label>
</div>
<div class="nine wide column">
<select name="forced" id="movies_forced" class="ui fluid selection dropdown">
<option value="False">False</option>
<option value="True">True</option>
<option value="Both">Both</option>
</select>
</div>
</div>
</div>
</div>
</div>
@ -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 {

View file

@ -129,7 +129,7 @@
end
end
%>
<div class="config ui inverted basic compact icon" data-tooltip="Edit series" data-inverted="" data-position="top right" data-no="{{row[5]}}" data-title="{{row[1]}}" data-poster="{{row[6]}}" data-languages="{{!subs_languages_list}}" data-hearing-impaired="{{row[4]}}" data-audio="{{row[7]}}">
<div class="config ui inverted basic compact icon" data-tooltip="Edit series" data-inverted="" data-position="top right" data-no="{{row[5]}}" data-title="{{row[1]}}" data-poster="{{row[6]}}" data-languages="{{!subs_languages_list}}" data-hearing-impaired="{{row[4]}}" data-forced="{{row[8]}}" data-audio="{{row[7]}}">
<i class="ui black configure icon"></i>
</div>
</td>
@ -221,6 +221,18 @@
</div>
</div>
</div>
<div class="middle aligned row">
<div class="right aligned five wide column">
<label>Forced</label>
</div>
<div class="nine wide column">
<select name="forced" id="series_forced" class="ui fluid selection dropdown">
<option value="False">False</option>
<option value="True">True</option>
<option value="Both">Both</option>
</select>
</div>
</div>
</div>
</div>
</div>
@ -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: {

View file

@ -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:
%>
<a data-moviePath="{{row[3]}}" data-sceneName="{{row[5]}}" data-language="{{alpha3_from_alpha2(str(language))}}" data-hi="{{row[4]}}" data-radarrId={{row[2]}} data-title="{{row[0].replace("'", "\'")}}" class="get_subtitle ui tiny label">
<a data-moviePath="{{row[3]}}" data-sceneName="{{row[5]}}" data-language="{{alpha3_from_alpha2(str(language.split(':')[0]))}}" data-hi="{{row[4]}}" data-forced="{{forced}}" data-radarrId={{row[2]}} data-title="{{row[0].replace("'", "\'")}}" class="get_subtitle ui tiny label">
{{language}}
<i style="margin-left:3px; margin-right:0" class="search icon"></i>
</a>
%else:
<a data-tooltip="Automatic searching delayed (adaptive search)" data-position="top right" data-inverted="" data-moviePath="{{row[3]}}" data-sceneName="{{row[5]}}" data-language="{{alpha3_from_alpha2(str(language))}}" data-hi="{{row[4]}}" data-radarrId={{row[2]}} data-title="{{row[0].replace("'", "\'")}}" class="get_subtitle ui tiny label">
<a data-tooltip="Automatic searching delayed (adaptive search)" data-position="top right" data-inverted="" data-moviePath="{{row[3]}}" data-sceneName="{{row[5]}}" data-language="{{alpha3_from_alpha2(str(language.split(':')[0]))}}" data-hi="{{row[4]}}" data-forced="{{forced}}" data-radarrId={{row[2]}} data-title="{{row[0].replace("'", "\'")}}" class="get_subtitle ui tiny label">
{{language}}
<i style="margin-left:3px; margin-right:0" class="search red icon"></i>
</a>
@ -86,7 +91,7 @@
%end
%end
%else:
<a data-moviePath="{{row[3]}}" data-sceneName="{{row[5]}}" data-language="{{alpha3_from_alpha2(str(language))}}" data-hi="{{row[4]}}" data-radarrId="{{row[2]}}" data-title="{{row[0].replace("'", "\'")}}" class="get_subtitle ui tiny label">
<a data-moviePath="{{row[3]}}" data-sceneName="{{row[5]}}" data-language="{{alpha3_from_alpha2(str(language.split(':')[0]))}}" data-hi="{{row[4]}}" data-forced="{{forced}}" data-radarrId="{{row[2]}}" data-title="{{row[0].replace("'", "\'")}}" class="get_subtitle ui tiny label">
{{language}}
<i style="margin-left:3px; margin-right:0" class="search icon"></i>
</a>
@ -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")
};

View file

@ -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:
%>
<a data-episodePath="{{row[5]}}" data-sceneName="{{row[8]}}" data-language="{{alpha3_from_alpha2(str(language))}}" data-hi="{{row[6]}}" data-sonarrSeriesId={{row[4]}} data-sonarrEpisodeId={{row[7]}} data-title="{{row[0].replace("'", "\'")}}" class="get_subtitle ui tiny label">
<a data-episodePath="{{row[5]}}" data-sceneName="{{row[8]}}" data-language="{{alpha3_from_alpha2(str(language.split(':')[0]))}}" data-hi="{{row[6]}}" data-forced="{{forced}}" data-sonarrSeriesId={{row[4]}} data-sonarrEpisodeId={{row[7]}} data-title="{{row[0].replace("'", "\'")}}" class="get_subtitle ui tiny label">
{{language}}
<i style="margin-left:3px; margin-right:0" class="search icon"></i>
</a>
%else:
<a data-tooltip="Automatic searching delayed (adaptive search)" data-position="top right" data-inverted="" data-episodePath="{{row[5]}}" data-sceneName="{{row[8]}}" data-language="{{alpha3_from_alpha2(str(language))}}" data-hi="{{row[6]}}" data-sonarrSeriesId={{row[4]}} data-sonarrEpisodeId={{row[7]}} data-title="{{row[0].replace("'", "\'")}}" class="get_subtitle ui tiny label">
<a data-tooltip="Automatic searching delayed (adaptive search)" data-position="top right" data-inverted="" data-episodePath="{{row[5]}}" data-sceneName="{{row[8]}}" data-language="{{alpha3_from_alpha2(str(language.split(':')[0]))}}" data-hi="{{row[6]}}" data-forced="{{forced}}" data-sonarrSeriesId={{row[4]}} data-sonarrEpisodeId={{row[7]}} data-title="{{row[0].replace("'", "\'")}}" class="get_subtitle ui tiny label">
{{language}}
<i style="margin-left:3px; margin-right:0" class="search red icon"></i>
</a>
@ -93,7 +98,7 @@
%end
%end
%else:
<a data-episodePath="{{row[5]}}" data-sceneName="{{row[8]}}" data-language="{{alpha3_from_alpha2(str(language))}}" data-hi="{{row[6]}}" data-sonarrSeriesId={{row[4]}} data-sonarrEpisodeId={{row[7]}} data-title="{{row[0].replace("'", "\'")}}" class="get_subtitle ui tiny label">
<a data-episodePath="{{row[5]}}" data-sceneName="{{row[8]}}" data-language="{{alpha3_from_alpha2(str(language.split(':')[0]))}}" data-hi="{{row[6]}}" data-forced="{{forced}}" data-sonarrSeriesId={{row[4]}} data-sonarrEpisodeId={{row[7]}} data-title="{{row[0].replace("'", "\'")}}" class="get_subtitle ui tiny label">
{{language}}
<i style="margin-left:3px; margin-right:0" class="search icon"></i>
</a>
@ -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")