mirror of
https://github.com/morpheus65535/bazarr
synced 2024-12-27 10:07:22 +00:00
Continuing development.
This commit is contained in:
parent
73269efebc
commit
eeba43e492
4 changed files with 49 additions and 14 deletions
|
@ -119,14 +119,26 @@ def download_subtitle(path, language, hi, forced, providers, providers_auth, sce
|
||||||
lang_obj = Language('por', 'BR')
|
lang_obj = Language('por', 'BR')
|
||||||
if forced == "True":
|
if forced == "True":
|
||||||
lang_obj.forced = True
|
lang_obj.forced = True
|
||||||
|
providers_auth['podnapisi']['only_foreign'] = True
|
||||||
|
providers_auth['subscene']['only_foreign'] = True
|
||||||
|
providers_auth['opensubtitles']['only_foreign'] = True
|
||||||
else:
|
else:
|
||||||
lang_obj.forced = False
|
lang_obj.forced = False
|
||||||
|
providers_auth['podnapisi']['only_foreign'] = False
|
||||||
|
providers_auth['subscene']['only_foreign'] = False
|
||||||
|
providers_auth['opensubtitles']['only_foreign'] = False
|
||||||
else:
|
else:
|
||||||
lang_obj = Language(l)
|
lang_obj = Language(l)
|
||||||
if forced == "True":
|
if forced == "True":
|
||||||
lang_obj.forced = True
|
lang_obj.forced = True
|
||||||
|
providers_auth['podnapisi']['only_foreign'] = True
|
||||||
|
providers_auth['subscene']['only_foreign'] = True
|
||||||
|
providers_auth['opensubtitles']['only_foreign'] = True
|
||||||
else:
|
else:
|
||||||
lang_obj.forced = False
|
lang_obj.forced = False
|
||||||
|
providers_auth['podnapisi']['only_foreign'] = False
|
||||||
|
providers_auth['subscene']['only_foreign'] = False
|
||||||
|
providers_auth['opensubtitles']['only_foreign'] = False
|
||||||
language_set.add(lang_obj)
|
language_set.add(lang_obj)
|
||||||
|
|
||||||
use_scenename = settings.general.getboolean('use_scenename')
|
use_scenename = settings.general.getboolean('use_scenename')
|
||||||
|
@ -273,14 +285,26 @@ def manual_search(path, language, hi, forced, providers, providers_auth, sceneNa
|
||||||
lang_obj = Language('por', 'BR')
|
lang_obj = Language('por', 'BR')
|
||||||
if forced == "True":
|
if forced == "True":
|
||||||
lang_obj.forced = True
|
lang_obj.forced = True
|
||||||
|
providers_auth['podnapisi']['only_foreign'] = True
|
||||||
|
providers_auth['subscene']['only_foreign'] = True
|
||||||
|
providers_auth['opensubtitles']['only_foreign'] = True
|
||||||
else:
|
else:
|
||||||
lang_obj.forced = False
|
lang_obj.forced = False
|
||||||
|
providers_auth['podnapisi']['only_foreign'] = False
|
||||||
|
providers_auth['subscene']['only_foreign'] = False
|
||||||
|
providers_auth['opensubtitles']['only_foreign'] = False
|
||||||
else:
|
else:
|
||||||
lang_obj = Language(lang)
|
lang_obj = Language(lang)
|
||||||
if forced == "True":
|
if forced == "True":
|
||||||
lang_obj.forced = True
|
lang_obj.forced = True
|
||||||
|
providers_auth['podnapisi']['only_foreign'] = True
|
||||||
|
providers_auth['subscene']['only_foreign'] = True
|
||||||
|
providers_auth['opensubtitles']['only_foreign'] = True
|
||||||
else:
|
else:
|
||||||
lang_obj.forced = False
|
lang_obj.forced = False
|
||||||
|
providers_auth['podnapisi']['only_foreign'] = False
|
||||||
|
providers_auth['subscene']['only_foreign'] = False
|
||||||
|
providers_auth['opensubtitles']['only_foreign'] = False
|
||||||
language_set.add(lang_obj)
|
language_set.add(lang_obj)
|
||||||
|
|
||||||
use_scenename = settings.general.getboolean('use_scenename')
|
use_scenename = settings.general.getboolean('use_scenename')
|
||||||
|
@ -301,7 +325,6 @@ def manual_search(path, language, hi, forced, providers, providers_auth, sceneNa
|
||||||
provider_configs=providers_auth,
|
provider_configs=providers_auth,
|
||||||
throttle_callback=provider_throttle,
|
throttle_callback=provider_throttle,
|
||||||
language_hook=None) # fixme
|
language_hook=None) # fixme
|
||||||
print subtitles
|
|
||||||
else:
|
else:
|
||||||
subtitles = []
|
subtitles = []
|
||||||
logging.info("BAZARR All providers are throttled")
|
logging.info("BAZARR All providers are throttled")
|
||||||
|
|
|
@ -215,7 +215,7 @@ def list_missing_subtitles(*no):
|
||||||
conn_db = sqlite3.connect(os.path.join(args.config_dir, 'db', 'bazarr.db'), timeout=30)
|
conn_db = sqlite3.connect(os.path.join(args.config_dir, 'db', 'bazarr.db'), timeout=30)
|
||||||
c_db = conn_db.cursor()
|
c_db = conn_db.cursor()
|
||||||
episodes_subtitles = c_db.execute(
|
episodes_subtitles = c_db.execute(
|
||||||
"SELECT table_episodes.sonarrEpisodeId, table_episodes.subtitles, table_shows.languages FROM table_episodes INNER JOIN table_shows on table_episodes.sonarrSeriesId = table_shows.sonarrSeriesId" + query_string).fetchall()
|
"SELECT table_episodes.sonarrEpisodeId, table_episodes.subtitles, table_shows.languages, table_shows.forced FROM table_episodes INNER JOIN table_shows on table_episodes.sonarrSeriesId = table_shows.sonarrSeriesId" + query_string).fetchall()
|
||||||
c_db.close()
|
c_db.close()
|
||||||
|
|
||||||
missing_subtitles_global = []
|
missing_subtitles_global = []
|
||||||
|
@ -235,6 +235,9 @@ def list_missing_subtitles(*no):
|
||||||
actual_subtitles.append(subtitle)
|
actual_subtitles.append(subtitle)
|
||||||
if episode_subtitles[2] is not None:
|
if episode_subtitles[2] is not None:
|
||||||
desired_subtitles = ast.literal_eval(episode_subtitles[2])
|
desired_subtitles = ast.literal_eval(episode_subtitles[2])
|
||||||
|
if episode_subtitles[3] == "True" and desired_subtitles is not None:
|
||||||
|
for i, desired_subtitle in enumerate(desired_subtitles):
|
||||||
|
desired_subtitles[i] = desired_subtitle + ":forced"
|
||||||
actual_subtitles_list = []
|
actual_subtitles_list = []
|
||||||
if desired_subtitles is None:
|
if desired_subtitles is None:
|
||||||
missing_subtitles_global.append(tuple(['[]', episode_subtitles[0]]))
|
missing_subtitles_global.append(tuple(['[]', episode_subtitles[0]]))
|
||||||
|
@ -263,7 +266,7 @@ def list_missing_subtitles_movies(*no):
|
||||||
pass
|
pass
|
||||||
conn_db = sqlite3.connect(os.path.join(args.config_dir, 'db', 'bazarr.db'), timeout=30)
|
conn_db = sqlite3.connect(os.path.join(args.config_dir, 'db', 'bazarr.db'), timeout=30)
|
||||||
c_db = conn_db.cursor()
|
c_db = conn_db.cursor()
|
||||||
movies_subtitles = c_db.execute("SELECT radarrId, subtitles, languages FROM table_movies" + query_string).fetchall()
|
movies_subtitles = c_db.execute("SELECT radarrId, subtitles, languages, forced FROM table_movies" + query_string).fetchall()
|
||||||
c_db.close()
|
c_db.close()
|
||||||
|
|
||||||
missing_subtitles_global = []
|
missing_subtitles_global = []
|
||||||
|
@ -283,6 +286,9 @@ def list_missing_subtitles_movies(*no):
|
||||||
actual_subtitles.append(subtitle)
|
actual_subtitles.append(subtitle)
|
||||||
if movie_subtitles[2] is not None:
|
if movie_subtitles[2] is not None:
|
||||||
desired_subtitles = ast.literal_eval(movie_subtitles[2])
|
desired_subtitles = ast.literal_eval(movie_subtitles[2])
|
||||||
|
if movie_subtitles[3] == "True" and desired_subtitles is not None:
|
||||||
|
for i, desired_subtitle in enumerate(desired_subtitles):
|
||||||
|
desired_subtitles[i] = desired_subtitle + ":forced"
|
||||||
actual_subtitles_list = []
|
actual_subtitles_list = []
|
||||||
if desired_subtitles is None:
|
if desired_subtitles is None:
|
||||||
missing_subtitles_global.append(tuple(['[]', movie_subtitles[0]]))
|
missing_subtitles_global.append(tuple(['[]', movie_subtitles[0]]))
|
||||||
|
|
|
@ -232,12 +232,12 @@
|
||||||
if language in lang:
|
if language in lang:
|
||||||
if search_active(lang[1]):
|
if search_active(lang[1]):
|
||||||
%>
|
%>
|
||||||
<a data-episodePath="{{episode[1]}}" data-scenename="{{episode[8]}}" data-language="{{alpha3_from_alpha2(str(language))}}" data-hi="{{details[4]}}" data-forced="{{details[9]}}" data-sonarrSeriesId="{{episode[5]}}" data-sonarrEpisodeId="{{episode[7]}}" class="get_subtitle ui tiny label">
|
<a data-episodePath="{{episode[1]}}" data-scenename="{{episode[8]}}" data-language="{{alpha3_from_alpha2(str(language.split(':')[0]))}}" data-hi="{{details[4]}}" data-forced="{{"True" if len(language.split(':')) > 1 else "False"}}" data-sonarrSeriesId="{{episode[5]}}" data-sonarrEpisodeId="{{episode[7]}}" class="get_subtitle ui tiny label">
|
||||||
{{language}}
|
{{language}}
|
||||||
<i style="margin-left:3px; margin-right:0" class="search icon"></i>
|
<i style="margin-left:3px; margin-right:0" class="search icon"></i>
|
||||||
</a>
|
</a>
|
||||||
%else:
|
%else:
|
||||||
<a data-tooltip="Automatic searching delayed (adaptive search)" data-position="top right" data-inverted="" data-episodePath="{{episode[1]}}" data-scenename="{{episode[8]}}" data-language="{{alpha3_from_alpha2(str(language))}}" data-hi="{{details[4]}}" data-forced="{{details[9]}}" data-sonarrSeriesId="{{episode[5]}}" data-sonarrEpisodeId="{{episode[7]}}" class="get_subtitle ui tiny label">
|
<a data-tooltip="Automatic searching delayed (adaptive search)" data-position="top right" data-inverted="" data-episodePath="{{episode[1]}}" data-scenename="{{episode[8]}}" data-language="{{alpha3_from_alpha2(str(language.split(':')[0]))}}" data-hi="{{details[4]}}" data-forced="{{"True" if len(language.split(':')) > 1 else "False"}}" data-sonarrSeriesId="{{episode[5]}}" data-sonarrEpisodeId="{{episode[7]}}" class="get_subtitle ui tiny label">
|
||||||
{{language}}
|
{{language}}
|
||||||
<i style="margin-left:3px; margin-right:0" class="search red icon"></i>
|
<i style="margin-left:3px; margin-right:0" class="search red icon"></i>
|
||||||
</a>
|
</a>
|
||||||
|
@ -245,7 +245,7 @@
|
||||||
%end
|
%end
|
||||||
%end
|
%end
|
||||||
%else:
|
%else:
|
||||||
<a data-episodePath="{{episode[1]}}" data-scenename="{{episode[8]}}" data-language="{{alpha3_from_alpha2(str(language))}}" data-hi="{{details[4]}}" data-forced="{{details[9]}}" data-sonarrSeriesId="{{episode[5]}}" data-sonarrEpisodeId="{{episode[7]}}" class="get_subtitle ui tiny label">
|
<a data-episodePath="{{episode[1]}}" data-scenename="{{episode[8]}}" data-language="{{alpha3_from_alpha2(str(language.split(':')[0]))}}" data-hi="{{details[4]}}" data-forced="{{"True" if len(language.split(':')) > 1 else "False"}}" data-sonarrSeriesId="{{episode[5]}}" data-sonarrEpisodeId="{{episode[7]}}" class="get_subtitle ui tiny label">
|
||||||
{{language}}
|
{{language}}
|
||||||
<i style="margin-left:3px; margin-right:0" class="search icon"></i>
|
<i style="margin-left:3px; margin-right:0" class="search icon"></i>
|
||||||
</a>
|
</a>
|
||||||
|
|
|
@ -193,18 +193,24 @@
|
||||||
</table>
|
</table>
|
||||||
<%
|
<%
|
||||||
for missing_subs_language in missing_subs_languages:
|
for missing_subs_language in missing_subs_languages:
|
||||||
|
if len(missing_subs_language) > 2:
|
||||||
|
forced = missing_subs_language[2]
|
||||||
|
else:
|
||||||
|
forced = False
|
||||||
|
end
|
||||||
|
|
||||||
if details[14] is not None and settings.general.getboolean('adaptive_searching') and missing_subs_language in details[14]:
|
if details[14] is not None and settings.general.getboolean('adaptive_searching') and missing_subs_language in details[14]:
|
||||||
for lang in ast.literal_eval(details[14]):
|
for lang in ast.literal_eval(details[14]):
|
||||||
if missing_subs_language in lang:
|
if missing_subs_language in lang:
|
||||||
if search_active(lang[1]):
|
if search_active(lang[1]):
|
||||||
%>
|
%>
|
||||||
<a class="get_subtitle ui small blue label" data-moviePath="{{details[8]}}" data-scenename="{{details[12]}}" data-language="{{alpha3_from_alpha2(str(missing_subs_language))}}" data-hi="{{details[4]}}" data-forced="{{details[15]}}" data-radarrId={{details[10]}}>
|
<a class="get_subtitle ui small blue label" data-moviePath="{{details[8]}}" data-scenename="{{details[12]}}" data-language="{{alpha3_from_alpha2(str(missing_subs_language.split(':')[0]))}}" data-hi="{{details[4]}}" data-forced="{{details[15]}}" data-radarrId={{details[10]}}>
|
||||||
{{language_from_alpha2(str(missing_subs_language))}}
|
{{!'<span class="ui" data-tooltip="Forced" data-inverted=""><i class="exclamation icon"></i></span>' if forced else ''}}{{language_from_alpha2(str(missing_subs_language.split(':')[0]))}}
|
||||||
<i style="margin-left:3px; margin-right:0" class="search icon"></i>
|
<i style="margin-left:3px; margin-right:0" class="search icon"></i>
|
||||||
</a>
|
</a>
|
||||||
%else:
|
%else:
|
||||||
<a data-tooltip="Automatic searching delayed (adaptive search)" data-position="top left" data-inverted="" class="get_subtitle ui small red label" data-moviePath="{{details[8]}}" data-scenename="{{details[12]}}" data-language="{{alpha3_from_alpha2(str(missing_subs_language))}}" data-hi="{{details[4]}}" data-forced="{{details[15]}}" data-radarrId={{details[10]}}>
|
<a data-tooltip="Automatic searching delayed (adaptive search)" data-position="top left" data-inverted="" class="get_subtitle ui small red label" data-moviePath="{{details[8]}}" data-scenename="{{details[12]}}" data-language="{{alpha3_from_alpha2(str(missing_subs_language.split(':')[0]))}}" data-hi="{{details[4]}}" data-forced="{{details[15]}}" data-radarrId={{details[10]}}>
|
||||||
{{language_from_alpha2(str(missing_subs_language))}}
|
{{!'<span class="ui" data-tooltip="Forced" data-inverted=""><i class="exclamation icon"></i></span>' if forced else ''}}{{language_from_alpha2(str(missing_subs_language.split(':')[0]))}}
|
||||||
<i style="margin-left:3px; margin-right:0" class="search icon"></i>
|
<i style="margin-left:3px; margin-right:0" class="search icon"></i>
|
||||||
</a>
|
</a>
|
||||||
<%
|
<%
|
||||||
|
@ -213,8 +219,8 @@
|
||||||
end
|
end
|
||||||
else:
|
else:
|
||||||
%>
|
%>
|
||||||
<a class="get_subtitle ui small blue label" data-moviePath="{{details[8]}}" data-scenename="{{details[12]}}" data-language="{{alpha3_from_alpha2(str(missing_subs_language))}}" data-hi="{{details[4]}}" data-forced="{{details[15]}}" data-radarrId={{details[10]}}>
|
<a class="get_subtitle ui small blue label" data-moviePath="{{details[8]}}" data-scenename="{{details[12]}}" data-language="{{alpha3_from_alpha2(str(missing_subs_language.split(':')[0]))}}" data-hi="{{details[4]}}" data-forced="{{details[15]}}" data-radarrId={{details[10]}}>
|
||||||
{{language_from_alpha2(str(missing_subs_language))}}
|
{{!'<span class="ui" data-tooltip="Forced" data-inverted=""><i class="exclamation icon"></i></span>' if forced else ''}}{{language_from_alpha2(str(missing_subs_language.split(':')[0]))}}
|
||||||
<i style="margin-left:3px; margin-right:0" class="search icon"></i>
|
<i style="margin-left:3px; margin-right:0" class="search icon"></i>
|
||||||
</a>
|
</a>
|
||||||
<%
|
<%
|
||||||
|
|
Loading…
Reference in a new issue