Merge remote-tracking branch 'origin/development' into subliminal_patch

# Conflicts:
#	bazarr/get_movies.py
#	bazarr/get_subtitle.py
#	bazarr/init.py
#	bazarr/main.py
#	views/settings.tpl
pull/292/head
Halali 6 years ago
commit 0b706a4e41

@ -31,7 +31,6 @@ defaults = {
'page_size': '25',
'minimum_score_movie': '70',
'use_embedded_subs': 'True',
'only_monitored': 'False',
'adaptive_searching': 'False',
'enabled_providers': ''
},
@ -46,7 +45,8 @@ defaults = {
'base_url': '/',
'ssl': 'False',
'apikey': '',
'full_update': 'Daily'
'full_update': 'Daily',
'only_monitored': 'False',
},
'radarr': {
'ip': '127.0.0.1',
@ -54,7 +54,8 @@ defaults = {
'base_url': '/',
'ssl': 'False',
'apikey': '',
'full_update': 'Daily'
'full_update': 'Daily',
'only_monitored': 'False',
},
'proxy': {
'type': 'None',

@ -35,7 +35,7 @@ def sync_episodes():
c = db.cursor()
# Get current episodes id in DB
current_episodes_db = c.execute('SELECT sonarrEpisodeId FROM table_episodes').fetchall()
current_episodes_db = c.execute('SELECT sonarrEpisodeId, path FROM table_episodes').fetchall()
current_episodes_db_list = [x[0] for x in current_episodes_db]
current_episodes_sonarr = []
@ -109,15 +109,16 @@ def sync_episodes():
c.execute('DELETE FROM table_episodes WHERE sonarrEpisodeId = ?', (removed_episode,))
db.commit()
# Get episodes list after INSERT and UPDATE
episodes_now_in_db = c.execute('SELECT sonarrEpisodeId, path FROM table_episodes').fetchall()
# Close database connection
c.close()
# TODO: Commented until I find a way to make it store only episodes really updated.
#for updated_episode in episodes_to_update:
# store_subtitles(path_replace(updated_episode[1]))
for added_episode in episodes_to_add:
store_subtitles(path_replace(added_episode[3]))
# Get only episodes added or modified and store subtitles for them
altered_episodes = set(episodes_now_in_db).difference(set(current_episodes_db))
for altered_episode in altered_episodes:
store_subtitles(path_replace(altered_episode[1]))
logging.debug('BAZARR All episodes synced from Sonarr into database.')

@ -42,7 +42,7 @@ def update_movies():
# Get current movies in DB
db = sqlite3.connect(os.path.join(args.config_dir, 'db', 'bazarr.db'), timeout=30)
c = db.cursor()
current_movies_db = c.execute('SELECT tmdbId FROM table_movies').fetchall()
current_movies_db = c.execute('SELECT tmdbId, path FROM table_movies').fetchall()
db.close()
current_movies_db_list = [x[0] for x in current_movies_db]
@ -106,23 +106,23 @@ def update_movies():
else:
added_result = c.executemany('''INSERT OR IGNORE INTO table_movies(title, path, tmdbId, languages, subtitles,`hearing_impaired`, radarrId, overview, poster, fanart, `audio_language`, sceneName, monitored, sortTitle) VALUES (?,?,?,(SELECT languages FROM table_movies WHERE tmdbId = ?), '[]',(SELECT `hearing_impaired` FROM table_movies WHERE tmdbId = ?), ?, ?, ?, ?, ?, ?, ?, ?)''', movies_to_add)
db.commit()
db.close()
removed_movies = list(set(current_movies_db_list) - set(current_movies_radarr))
db = sqlite3.connect(os.path.join(args.config_dir, 'db', 'bazarr.db'), timeout=30)
c = db.cursor()
for removed_movie in removed_movies:
c.execute('DELETE FROM table_movies WHERE tmdbId = ?', (removed_movie,))
db.commit()
db.close()
db.commit()
for added_movie in movies_to_add:
store_subtitles_movie(path_replace_movie(added_movie[1]))
# Get movies list after INSERT and UPDATE
movies_now_in_db = c.execute('SELECT tmdbId, path FROM table_movies').fetchall()
# Close database connection
db.close()
# TODO: Commented until I find a way to make it store only episodes really updated.
# for updated_movie in movies_to_update:
# store_subtitles_movie(path_replace_movie(updated_movie[1]))
# Get only movies added or modified and store subtitles for them
altered_movies = set(movies_now_in_db).difference(set(current_movies_db))
for altered_movie in altered_movies:
store_subtitles_movie(path_replace_movie(altered_movie[1]))
logging.debug('BAZARR All movies synced from Radarr into database.')

@ -467,13 +467,13 @@ def manual_download_subtitle(path, language, hi, subtitle, provider, providers_a
return message
else:
logging.error(
'BAZARR Tried to manually download a subtitles for file: ' + path + " but we weren't able to do (probably throttled by ' + str(subtitle.provider_name) + '. Please retry later or select a subtitles from another provider.")
"BAZARR Tried to manually download a subtitles for file: " + path + " but we weren't able to do (probably throttled by " + str(subtitle.provider_name) + ". Please retry later or select a subtitles from another provider.")
return None
logging.debug('BAZARR Ended manually downloading subtitles for file: ' + path)
def series_download_subtitles(no):
if settings.general.getboolean('only_monitored'):
if settings.sonarr.getboolean('only_monitored'):
monitored_only_query_string = ' AND monitored = "True"'
else:
monitored_only_query_string = ""
@ -625,17 +625,22 @@ def wanted_search_missing_subtitles():
db.create_function("path_substitution_movie", 1, path_replace_movie)
c = db.cursor()
if settings.general.getboolean('only_monitored'):
monitored_only_query_string = ' AND monitored = "True"'
if settings.sonarr.getboolean('only_monitored'):
monitored_only_query_string_sonarr = ' AND monitored = "True"'
else:
monitored_only_query_string = ""
monitored_only_query_string_sonarr = ""
if settings.radarr.getboolean('only_monitored'):
monitored_only_query_string_radarr = ' AND monitored = "True"'
else:
monitored_only_query_string_radarr = ""
c.execute(
"SELECT path_substitution(path) FROM table_episodes WHERE missing_subtitles != '[]'" + monitored_only_query_string)
"SELECT path_substitution(path) FROM table_episodes WHERE missing_subtitles != '[]'" + monitored_only_query_string_sonarr)
episodes = c.fetchall()
c.execute(
"SELECT path_substitution_movie(path) FROM table_movies WHERE missing_subtitles != '[]'" + monitored_only_query_string)
"SELECT path_substitution_movie(path) FROM table_movies WHERE missing_subtitles != '[]'" + monitored_only_query_string_radarr)
movies = c.fetchall()
c.close()
@ -652,7 +657,7 @@ def wanted_search_missing_subtitles():
def search_active(timestamp):
if settings.general.getboolean('only_monitored'):
if settings.general.getboolean('adaptive_searching'):
search_deadline = timedelta(weeks=3)
search_delta = timedelta(weeks=1)
aa = datetime.fromtimestamp(float(timestamp))

@ -6,7 +6,10 @@ import logging
import time
from cork import Cork
from configparser2 import ConfigParser
try:
from configparser import ConfigParser
except ImportError:
from configparser2 import ConfigParser
from config import settings
from check_update import check_releases
from get_args import args
@ -84,6 +87,14 @@ if cfg.has_section('general'):
cfg.set('general', 'debug', 'False')
with open(config_file, 'w+') as configfile:
cfg.write(configfile)
if cfg.has_option('general', 'only_monitored'):
only_monitored = cfg.get('general', 'only_monitored')
cfg.set('sonarr', 'only_monitored', str(only_monitored))
cfg.set('radarr', 'only_monitored', str(only_monitored))
cfg.remove_option('general', 'only_monitored')
with open(config_file, 'w+') as configfile:
cfg.write(configfile)
# Move providers settings from DB to config file
try:
@ -95,9 +106,13 @@ try:
db.close()
providers_list = []
if len(enabled_providers) > 0:
if enabled_providers:
for provider in enabled_providers:
providers_list.append(provider[0])
else:
providers_list = None
if settings_providers:
for provider in settings_providers:
if provider[0] == 'opensubtitles':
settings.opensubtitles.username = provider[2]
@ -108,8 +123,6 @@ try:
elif provider[0] == 'legendastv':
settings.legendastv.username = provider[2]
settings.legendastv.password = provider[3]
else:
providers_list = None
settings.general.enabled_providers = u'' if not providers_list else ','.join(providers_list)
with open(os.path.join(config_dir, 'config', 'config.ini'), 'w+') as handle:

@ -259,11 +259,6 @@ def save_wizard():
settings_general_single_language = 'False'
else:
settings_general_single_language = 'True'
settings_general_adaptive_searching = request.forms.get('settings_general_adaptive_searching')
if settings_general_adaptive_searching is None:
settings_general_adaptive_searching = 'False'
else:
settings_general_adaptive_searching = 'True'
settings_general_use_sonarr = request.forms.get('settings_general_use_sonarr')
if settings_general_use_sonarr is None:
settings_general_use_sonarr = 'False'
@ -283,7 +278,6 @@ def save_wizard():
settings.general.use_sonarr = text_type(settings_general_use_sonarr)
settings.general.use_radarr = text_type(settings_general_use_radarr)
settings.general.path_mappings_movie = text_type(settings_general_pathmapping_movie)
settings.general.adaptive_searching = text_type(settings_general_adaptive_searching)
settings_sonarr_ip = request.forms.get('settings_sonarr_ip')
settings_sonarr_port = request.forms.get('settings_sonarr_port')
@ -294,12 +288,18 @@ def save_wizard():
else:
settings_sonarr_ssl = 'True'
settings_sonarr_apikey = request.forms.get('settings_sonarr_apikey')
settings_sonarr_only_monitored = request.forms.get('settings_sonarr_only_monitored')
if settings_sonarr_only_monitored is None:
settings_sonarr_only_monitored = 'False'
else:
settings_sonarr_only_monitored = 'True'
settings.sonarr.ip = text_type(settings_sonarr_ip)
settings.sonarr.port = text_type(settings_sonarr_port)
settings.sonarr.base_url = text_type(settings_sonarr_baseurl)
settings.sonarr.ssl = text_type(settings_sonarr_ssl)
settings.sonarr.apikey = text_type(settings_sonarr_apikey)
settings.sonarr.only_monitored = text_type(settings_sonarr_only_monitored)
settings_radarr_ip = request.forms.get('settings_radarr_ip')
settings_radarr_port = request.forms.get('settings_radarr_port')
@ -310,16 +310,18 @@ def save_wizard():
else:
settings_radarr_ssl = 'True'
settings_radarr_apikey = request.forms.get('settings_radarr_apikey')
if settings_radarr_apikey != '':
settings.general.use_radarr = 'True'
settings_radarr_only_monitored = request.forms.get('settings_radarr_only_monitored')
if settings_radarr_only_monitored is None:
settings_radarr_only_monitored = 'False'
else:
settings.general.use_radarr = 'False'
settings_radarr_only_monitored = 'True'
settings.radarr.ip = text_type(settings_radarr_ip)
settings.radarr.port = text_type(settings_radarr_port)
settings.radarr.base_url = text_type(settings_radarr_baseurl)
settings.radarr.ssl = text_type(settings_radarr_ssl)
settings.radarr.apikey = text_type(settings_radarr_apikey)
settings.radarr.only_monitored = text_type(settings_radarr_only_monitored)
settings_subliminal_providers = request.forms.getall('settings_subliminal_providers')
settings.general.enabled_providers = u'' if not settings_subliminal_providers else ','.join(settings_subliminal_providers)
@ -477,7 +479,7 @@ def series():
offset = (int(page) - 1) * page_size
max_page = int(math.ceil(missing_count / (page_size + 0.0)))
if settings.general.getboolean('only_monitored'):
if settings.sonarr.getboolean('only_monitored'):
monitored_only_query_string = ' AND monitored = "True"'
else:
monitored_only_query_string = ""
@ -957,7 +959,7 @@ def wantedseries():
db.create_function("path_substitution", 1, path_replace)
c = db.cursor()
if settings.general.getboolean('only_monitored'):
if settings.sonarr.getboolean('only_monitored'):
monitored_only_query_string = ' AND monitored = "True"'
else:
monitored_only_query_string = ""
@ -989,7 +991,7 @@ def wantedmovies():
db.create_function("path_substitution", 1, path_replace_movie)
c = db.cursor()
if settings.general.getboolean('only_monitored'):
if settings.radarr.getboolean('only_monitored'):
monitored_only_query_string = ' AND monitored = "True"'
else:
monitored_only_query_string = ""
@ -1089,11 +1091,6 @@ def save_settings():
settings_general_embedded = 'False'
else:
settings_general_embedded = 'True'
settings_general_only_monitored = request.forms.get('settings_general_only_monitored')
if settings_general_only_monitored is None:
settings_general_only_monitored = 'False'
else:
settings_general_only_monitored = 'True'
settings_general_adaptive_searching = request.forms.get('settings_general_adaptive_searching')
if settings_general_adaptive_searching is None:
settings_general_adaptive_searching = 'False'
@ -1140,7 +1137,6 @@ def save_settings():
settings.general.page_size = text_type(settings_page_size)
settings.general.minimum_score_movie = text_type(settings_general_minimum_score_movies)
settings.general.use_embedded_subs = text_type(settings_general_embedded)
settings.general.only_monitored = text_type(settings_general_only_monitored)
settings.general.adaptive_searching = text_type(settings_general_adaptive_searching)
if after != before:
@ -1216,6 +1212,11 @@ def save_settings():
else:
settings_sonarr_ssl = 'True'
settings_sonarr_apikey = request.forms.get('settings_sonarr_apikey')
settings_sonarr_only_monitored = request.forms.get('settings_sonarr_only_monitored')
if settings_sonarr_only_monitored is None:
settings_sonarr_only_monitored = 'False'
else:
settings_sonarr_only_monitored = 'True'
settings_sonarr_sync = request.forms.get('settings_sonarr_sync')
settings.sonarr.ip = text_type(settings_sonarr_ip)
@ -1223,6 +1224,7 @@ def save_settings():
settings.sonarr.base_url = text_type(settings_sonarr_baseurl)
settings.sonarr.ssl = text_type(settings_sonarr_ssl)
settings.sonarr.apikey = text_type(settings_sonarr_apikey)
settings.sonarr.only_monitored = text_type(settings_sonarr_only_monitored)
settings.sonarr.full_update = text_type(settings_sonarr_sync)
settings_radarr_ip = request.forms.get('settings_radarr_ip')
@ -1234,6 +1236,11 @@ def save_settings():
else:
settings_radarr_ssl = 'True'
settings_radarr_apikey = request.forms.get('settings_radarr_apikey')
settings_radarr_only_monitored = request.forms.get('settings_radarr_only_monitored')
if settings_radarr_only_monitored is None:
settings_radarr_only_monitored = 'False'
else:
settings_radarr_only_monitored = 'True'
settings_radarr_sync = request.forms.get('settings_radarr_sync')
settings.radarr.ip = text_type(settings_radarr_ip)
@ -1241,6 +1248,7 @@ def save_settings():
settings.radarr.base_url = text_type(settings_radarr_baseurl)
settings.radarr.ssl = text_type(settings_radarr_ssl)
settings.radarr.apikey = text_type(settings_radarr_apikey)
settings.radarr.only_monitored = text_type(settings_radarr_only_monitored)
settings.radarr.full_update = text_type(settings_radarr_sync)
settings_subliminal_providers = request.forms.getall('settings_subliminal_providers')
@ -1323,7 +1331,10 @@ def save_settings():
# reschedule full update task according to settings
sonarr_full_update()
redirect(ref)
if ref.find('saved=true') > 0:
redirect(ref)
else:
redirect(ref + "?saved=true")
@route(base_url + 'check_update')
@ -1754,7 +1765,7 @@ def api_history():
def test_url(protocol, url):
url = urllib.unquote(url)
try:
result = requests.get(protocol + "://" + url, allow_redirects=False).json()['version']
result = requests.get(protocol + "://" + url, allow_redirects=False, verify=False).json()['version']
except:
return dict(status=False)
else:

@ -28,16 +28,22 @@
% import sqlite3
% from config import settings
%if settings.general.getboolean('only_monitored'):
% monitored_only_query_string = ' AND monitored = "True"'
%if settings.sonarr.getboolean('only_monitored'):
% monitored_only_query_string_sonarr = ' AND monitored = "True"'
%else:
% monitored_only_query_string = ""
% monitored_only_query_string_sonarr = ""
%end
%if settings.radarr.getboolean('only_monitored'):
% monitored_only_query_string_radarr = ' AND monitored = "True"'
%else:
% monitored_only_query_string_radarr = ""
%end
% conn = sqlite3.connect(os.path.join(args.config_dir, 'db', 'bazarr.db'), timeout=30)
% c = conn.cursor()
% wanted_series = c.execute("SELECT COUNT(*) FROM table_episodes WHERE missing_subtitles != '[]'" + monitored_only_query_string).fetchone()
% wanted_movies = c.execute("SELECT COUNT(*) FROM table_movies WHERE missing_subtitles != '[]'" + monitored_only_query_string).fetchone()
% wanted_series = c.execute("SELECT COUNT(*) FROM table_episodes WHERE missing_subtitles != '[]'" + monitored_only_query_string_sonarr).fetchone()
% wanted_movies = c.execute("SELECT COUNT(*) FROM table_movies WHERE missing_subtitles != '[]'" + monitored_only_query_string_radarr).fetchone()
<div id="divmenu" class="ui container">
<div class="ui grid">

@ -40,7 +40,7 @@
</head>
<body>
<div id='loader' class="ui page dimmer">
<div id="loader_text" class="ui indeterminate text loader">Loading...</div>
<div id="loader_text" class="ui indeterminate text loader">Saving settings...</div>
</div>
% include('menu.tpl')
@ -780,6 +780,26 @@
</div>
</div>
</div>
<div class="middle aligned row">
<div class="right aligned four wide column">
<label>Download only monitored</label>
</div>
<div class="one wide column">
<div id="settings_only_monitored_sonarr" class="ui toggle checkbox" data-monitored={{settings.sonarr.getboolean('only_monitored')}}>
<input name="settings_sonarr_only_monitored" type="checkbox">
<label></label>
</div>
</div>
<div class="collapsed column">
<div class="collapsed center aligned column">
<div class="ui basic icon" data-tooltip="Automatic download of subtitles will happen only for monitored episodes in Sonarr." data-inverted="">
<i class="help circle large icon"></i>
</div>
</div>
</div>
</div>
</div>
</div>
@ -906,6 +926,26 @@
</div>
</div>
</div>
<div class="middle aligned row">
<div class="right aligned four wide column">
<label>Download only monitored</label>
</div>
<div class="one wide column">
<div id="settings_only_monitored_radarr" class="ui toggle checkbox" data-monitored={{settings.radarr.getboolean('only_monitored')}}>
<input name="settings_radarr_only_monitored" type="checkbox">
<label></label>
</div>
</div>
<div class="collapsed column">
<div class="collapsed center aligned column">
<div class="ui basic icon" data-tooltip="Automatic download of subtitles will happen only for monitored movies in Radarr." data-inverted="">
<i class="help circle large icon"></i>
</div>
</div>
</div>
</div>
</div>
</div>
@ -1020,128 +1060,219 @@
<div class="middle aligned row">
<div class="right aligned four wide column">
<label>Download only monitored</label>
<label>Adaptive searching</label>
</div>
<div class="one wide column">
<div id="settings_only_monitored" class="ui toggle checkbox" data-monitored={{settings.general.getboolean('only_monitored')}}>
<input name="settings_general_only_monitored" type="checkbox">
<div id="settings_adaptive_searching" class="ui toggle checkbox" data-adaptive={{settings.general.getboolean('adaptive_searching')}}>
<input name="settings_general_adaptive_searching" type="checkbox">
<label></label>
</div>
</div>
<div class="collapsed column">
<div class="collapsed center aligned column">
<div class="ui basic icon" data-tooltip="Automatic download of subtitles will happen only for monitored episodes/movies in Sonarr/Radarr." data-inverted="">
<div class="ui basic icon" data-tooltip="When searching for subtitles, Bazarr will search less frequently after sometime to limit call to providers." data-inverted="">
<i class="help circle large icon"></i>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="ui dividing header">Subtitles providers</div>
<div class="twelve wide column">
<div class="ui grid">
<div class="middle aligned row">
<div class="right aligned four wide column">
<label>Adaptive searching</label>
<label>Addic7ed</label>
</div>
<div class="one wide column">
<div id="settings_adaptive_searching" class="ui toggle checkbox" data-adaptive={{settings.general.getboolean('adaptive_searching')}}>
<input name="settings_general_adaptive_searching" type="checkbox">
<div id="addic7ed" class="ui toggle checkbox provider">
<input type="checkbox">
<label></label>
</div>
</div>
<div class="collapsed column">
<div class="collapsed center aligned column">
<div class="ui basic icon" data-tooltip="When searching for subtitles, Bazarr will search less frequently after sometime to limit call to providers." data-inverted="">
<i class="help circle large icon"></i>
</div>
<div id="addic7ed_option" class="ui grid container">
<div class="middle aligned row">
<div class="right aligned six wide column">
<label>Username</label>
</div>
<div class="six wide column">
<div class="ui fluid input">
<input name="settings_addic7ed_username" type="text" value="{{settings.addic7ed.username if settings.addic7ed.username != None else ''}}">
</div>
</div>
</div>
<div class="middle aligned row">
<div class="right aligned six wide column">
<label>Password</label>
</div>
<div class="six wide column">
<div class="ui fluid input">
<input name="settings_addic7ed_password" type="password" value="{{settings.addic7ed.password if settings.addic7ed.password != None else ''}}">
</div>
</div>
</div>
</div>
</div>
</div>
<div class="ui dividing header">Subtitles providers</div>
<div class="twelve wide column">
<div class="ui grid">
<div class="middle aligned row">
<div class="right aligned four wide column">
<label>Enabled providers</label>
<label>LegendasTV</label>
</div>
<div class="eleven wide column">
<div class='field'>
<select name="settings_subliminal_providers" id="settings_providers" multiple="" class="ui fluid search selection dropdown">
<option value="">Providers</option>
%enabled_providers = []
%providers = settings.general.enabled_providers.lower().split(',')
%for provider in settings_providers:
<option value="{{provider}}">{{provider}}</option>
%end
%for provider in providers:
%enabled_providers.append(str(provider))
%end
</select>
<div class="one wide column">
<div id="legendastv" class="ui toggle checkbox provider">
<input type="checkbox">
<label></label>
</div>
</div>
</div>
</div>
</div>
<div class="ui dividing header">Providers settings (optional)</div>
<div class="twelve wide column">
<div class="ui grid">
<div id="legendastv_option" class="ui grid container">
<div class="middle aligned row">
<div class="right aligned six wide column">
<label>Username</label>
</div>
<div class="six wide column">
<div class="ui fluid input">
<input name="settings_legendastv_username" type="text" value="{{settings.legendastv.username if settings.legendastv.username != None else ''}}">
</div>
</div>
</div>
<div class="middle aligned row">
<div class="right aligned six wide column">
<label>Password</label>
</div>
<div class="six wide column">
<div class="ui fluid input">
<input name="settings_legendastv_password" type="password" value="{{settings.legendastv.password if settings.legendastv.password != None else ''}}">
</div>
</div>
</div>
</div>
<div class="middle aligned row">
<div class="right aligned four wide column">
<label>OpenSubtitles</label>
</div>
<div class="five wide column">
<div class="ui fluid input">
<h4 class="ui header">Username</h4>
<div class="one wide column">
<div id="opensubtitles" class="ui toggle checkbox provider">
<input type="checkbox">
<label></label>
</div>
</div>
<div class="five wide column">
<div class="ui fluid input">
<h4 class="ui header">Password (stored in clear text)</h4>
</div>
<div id="opensubtitles_option" class="ui grid container">
<div class="middle aligned row">
<div class="right aligned six wide column">
<label>Username</label>
</div>
<div class="six wide column">
<div class="ui fluid input">
<input name="settings_opensubtitles_username" type="text" value="{{settings.opensubtitles.username if settings.opensubtitles.username != None else ''}}">
</div>
</div>
</div>
<div class="middle aligned row">
<div class="right aligned six wide column">
<label>Password</label>
</div>
<div class="six wide column">
<div class="ui fluid input">
<input name="settings_opensubtitles_password" type="password" value="{{settings.opensubtitles.password if settings.opensubtitles.password != None else ''}}">
</div>
</div>
</div>
</div>
<div class="middle aligned row">
<div class="right aligned four wide column">
<label>addic7ed</label>
<label>Podnapisi</label>
</div>
<div class="five wide column">
<div class="ui fluid input">
<input name="settings_addic7ed_username" type="text" value="{{settings.addic7ed.username if settings.addic7ed.username != None else ''}}">
<div class="one wide column">
<div id="podnapisi" class="ui toggle checkbox provider">
<input type="checkbox">
<label></label>
</div>
</div>
<div class="five wide column">
<div class="ui fluid input">
<input name="settings_addic7ed_password" type="password" value="{{settings.addic7ed.password if settings.addic7ed.password != None else ''}}">
</div>
<div id="podnapisi_option" class="ui grid container">
</div>
<div class="middle aligned row">
<div class="right aligned four wide column">
<label>Shooter</label>
</div>
<div class="one wide column">
<div id="shooter" class="ui toggle checkbox provider">
<input type="checkbox">
<label></label>
</div>
</div>
</div>
<div id="shooter_option" class="ui grid container">
</div>
<div class="middle aligned row">
<div class="right aligned four wide column">
<label>legendastv</label>
<label>Subscenter</label>
</div>
<div class="five wide column">
<div class="ui fluid input">
<input name="settings_legendastv_username" type="text" value="{{settings.legendastv.username if settings.legendastv.username != None else ''}}">
<div class="one wide column">
<div id="subscenter" class="ui toggle checkbox provider">
<input type="checkbox">
<label></label>
</div>
</div>
<div class="five wide column">
<div class="ui fluid input">
<input name="settings_legendastv_password" type="password" value="{{settings.legendastv.password if settings.legendastv.password != None else ''}}">
</div>
<div id="subcenter_option" class="ui grid container">
</div>
<div class="middle aligned row">
<div class="right aligned four wide column">
<label>TheSubDB</label>
</div>
<div class="one wide column">
<div id="thesubdb" class="ui toggle checkbox provider">
<input type="checkbox">
<label></label>
</div>
</div>
</div>
<div id="thesubdb_option" class="ui grid container">
</div>
<div class="middle aligned row">
<div class="right aligned four wide column">
<label>opensubtitles</label>
<label>TVSubtitles</label>
</div>
<div class="five wide column">
<div class="ui fluid input">
<input name="settings_opensubtitles_username" type="text" value="{{settings.opensubtitles.username if settings.opensubtitles.username != None else ''}}">
<div class="one wide column">
<div id="tvsubtitles" class="ui toggle checkbox provider">
<input type="checkbox">
<label></label>
</div>
</div>
<div class="five wide column">
<div class="ui fluid input">
<input name="settings_opensubtitles_password" type="password" value="{{settings.opensubtitles.password if settings.opensubtitles.password != None else ''}}">
</div>
<div id="tvsubtitles_option" class="ui grid container">
</div>
<div class="middle aligned row">
<div class="eleven wide column">
<div class='field' hidden>
<select name="settings_subliminal_providers" id="settings_providers" multiple="" class="ui fluid search selection dropdown">
<option value="">Providers</option>
%enabled_providers = []
%providers = settings.general.enabled_providers.lower().split(',')
%for provider in settings_providers:
<option value="{{provider}}">{{provider}}</option>
%end
%for provider in providers:
%enabled_providers.append(str(provider))
%end
</select>
</div>
</div>
</div>
@ -1348,7 +1479,34 @@
<script>
$('.test_notification').on('click', function() {
function getQueryVariable(variable)
{
var query = window.location.search.substring(1);
var vars = query.split("&");
for (var i=0;i<vars.length;i++) {
var pair = vars[i].split("=");
if(pair[0] == variable){return pair[1];}
}
return(false);
}
if (getQueryVariable("saved") == 'true') {
new Noty({
text: 'Settings saved.',
timeout: 5000,
progressBar: false,
animation: {
open: null,
close: null
},
killer: true,
type: 'info',
layout: 'bottomRight',
theme: 'semanticui'
}).show();
}
$('.test_notification').on('click', function() {
const url_field = $(this).prev().val();
const url_protocol = url_field.split(':')[0];
const url_string = url_field.split('://')[1];
@ -1424,10 +1582,16 @@ $('.test_notification').on('click', function() {
$("#settings_embedded").checkbox('uncheck');
}
if ($('#settings_only_monitored').data("monitored") === "True") {
$("#settings_only_monitored").checkbox('check');
if ($('#settings_only_monitored_sonarr').data("monitored") === "True") {
$("#settings_only_monitored_sonarr").checkbox('check');
} else {
$("#settings_only_monitored").checkbox('uncheck');
$("#settings_only_monitored_sonarr").checkbox('uncheck');
}
if ($('#settings_only_monitored_radarr').data("monitored") === "True") {
$("#settings_only_monitored_radarr").checkbox('check');
} else {
$("#settings_only_monitored_radarr").checkbox('uncheck');
}
if ($('#settings_adaptive_searching').data("adaptive") === "True") {
@ -1860,12 +2024,29 @@ $('.test_notification').on('click', function() {
$('#settings_providers').dropdown('setting', 'onChange', function(){
$('.form').form('validate field', 'settings_subliminal_providers');
});
$('#settings_languages').dropdown('setting', 'onChange', function(){
$('.form').form('validate field', 'settings_subliminal_languages');
$("#settings_providers > option").each(function() {
$('#'+$(this).val()+'_option').hide();
});
$("#settings_providers > option:selected").each(function() {
$('[id='+this.value+']').checkbox('check');
$('#'+$(this).val()+'_option').show();
});
$('.submit').on('click', function() {
alert('Settings saved.');
$('.provider').checkbox({
onChecked: function() {
$('#settings_providers').dropdown('set selected', $(this).parent().attr('id'));
$('#'+$(this).parent().attr('id')+'_option').show();
},
onUnchecked: function() {
$('#settings_providers').dropdown('remove selected', $(this).parent().attr('id'));
$('#'+$(this).parent().attr('id')+'_option').hide();
}
});
$('#settings_languages').dropdown('setting', 'onChange', function(){
$('.form').form('validate field', 'settings_subliminal_languages');
});
$(function() {

@ -38,16 +38,22 @@
% import sqlite3
% from config import settings
%if settings.general.getboolean('only_monitored'):
% monitored_only_query_string = ' AND monitored = "True"'
%if settings.sonarr.getboolean('only_monitored'):
% monitored_only_query_string_sonarr = ' AND monitored = "True"'
%else:
% monitored_only_query_string = ""
% monitored_only_query_string_sonarr = ""
%end
%if settings.radarr.getboolean('only_monitored'):
% monitored_only_query_string_radarr = ' AND monitored = "True"'
%else:
% monitored_only_query_string_radarr = ""
%end
% conn = sqlite3.connect(os.path.join(args.config_dir, 'db', 'bazarr.db'), timeout=30)
% c = conn.cursor()
% wanted_series = c.execute("SELECT COUNT(*) FROM table_episodes WHERE missing_subtitles != '[]'" + monitored_only_query_string).fetchone()
% wanted_movies = c.execute("SELECT COUNT(*) FROM table_movies WHERE missing_subtitles != '[]'" + monitored_only_query_string).fetchone()
% wanted_series = c.execute("SELECT COUNT(*) FROM table_episodes WHERE missing_subtitles != '[]'" + monitored_only_query_string_sonarr).fetchone()
% wanted_movies = c.execute("SELECT COUNT(*) FROM table_movies WHERE missing_subtitles != '[]'" + monitored_only_query_string_radarr).fetchone()
% c.close()
<div id='loader' class="ui page dimmer">

@ -48,7 +48,7 @@
</head>
<body>
<div id='loader' class="ui page dimmer">
<div class="ui indeterminate text loader">Loading...</div>
<div class="ui indeterminate text loader">Saving settings...</div>
</div>
<div class="ui modal" id="browsemodal">
@ -340,10 +340,185 @@
<div class="ui grid">
<div class="middle aligned row">
<div class="right aligned four wide column">
<label>Enabled providers</label>
<label>Addic7ed</label>
</div>
<div class="one wide column">
<div id="addic7ed" class="ui toggle checkbox provider">
<input type="checkbox">
<label></label>
</div>
</div>
</div>
<div id="addic7ed_option" class="ui grid container">
<div class="middle aligned row">
<div class="right aligned six wide column">
<label>Username</label>
</div>
<div class="six wide column">
<div class="ui fluid input">
<input name="settings_addic7ed_username" type="text" value="{{settings.addic7ed.username if settings.addic7ed.username != None else ''}}">
</div>
</div>
</div>
<div class="middle aligned row">
<div class="right aligned six wide column">
<label>Password</label>
</div>
<div class="six wide column">
<div class="ui fluid input">
<input name="settings_addic7ed_password" type="password" value="{{settings.addic7ed.password if settings.addic7ed.password != None else ''}}">
</div>
</div>
</div>
</div>
<div class="middle aligned row">
<div class="right aligned four wide column">
<label>LegendasTV</label>
</div>
<div class="one wide column">
<div id="legendastv" class="ui toggle checkbox provider">
<input type="checkbox">
<label></label>
</div>
</div>
</div>
<div id="legendastv_option" class="ui grid container">
<div class="middle aligned row">
<div class="right aligned six wide column">
<label>Username</label>
</div>
<div class="six wide column">
<div class="ui fluid input">
<input name="settings_legendastv_username" type="text" value="{{settings.legendastv.username if settings.legendastv.username != None else ''}}">
</div>
</div>
</div>
<div class="middle aligned row">
<div class="right aligned six wide column">
<label>Password</label>
</div>
<div class="six wide column">
<div class="ui fluid input">
<input name="settings_legendastv_password" type="password" value="{{settings.legendastv.password if settings.legendastv.password != None else ''}}">
</div>
</div>
</div>
</div>
<div class="middle aligned row">
<div class="right aligned four wide column">
<label>OpenSubtitles</label>
</div>
<div class="one wide column">
<div id="opensubtitles" class="ui toggle checkbox provider">
<input type="checkbox">
<label></label>
</div>
</div>
</div>
<div id="opensubtitles_option" class="ui grid container">
<div class="middle aligned row">
<div class="right aligned six wide column">
<label>Username</label>
</div>
<div class="six wide column">
<div class="ui fluid input">
<input name="settings_opensubtitles_username" type="text" value="{{settings.opensubtitles.username if settings.opensubtitles.username != None else ''}}">
</div>
</div>
</div>
<div class="middle aligned row">
<div class="right aligned six wide column">
<label>Password</label>
</div>
<div class="six wide column">
<div class="ui fluid input">
<input name="settings_opensubtitles_password" type="password" value="{{settings.opensubtitles.password if settings.opensubtitles.password != None else ''}}">
</div>
</div>
</div>
</div>
<div class="middle aligned row">
<div class="right aligned four wide column">
<label>Podnapisi</label>
</div>
<div class="one wide column">
<div id="podnapisi" class="ui toggle checkbox provider">
<input type="checkbox">
<label></label>
</div>
</div>
</div>
<div id="podnapisi_option" class="ui grid container">
</div>
<div class="middle aligned row">
<div class="right aligned four wide column">
<label>Shooter</label>
</div>
<div class="one wide column">
<div id="shooter" class="ui toggle checkbox provider">
<input type="checkbox">
<label></label>
</div>
</div>
</div>
<div id="shooter_option" class="ui grid container">
</div>
<div class="middle aligned row">
<div class="right aligned four wide column">
<label>Subscenter</label>
</div>
<div class="one wide column">
<div id="subscenter" class="ui toggle checkbox provider">
<input type="checkbox">
<label></label>
</div>
</div>
</div>
<div id="subcenter_option" class="ui grid container">
</div>
<div class="middle aligned row">
<div class="right aligned four wide column">
<label>TheSubDB</label>
</div>
<div class="one wide column">
<div id="thesubdb" class="ui toggle checkbox provider">
<input type="checkbox">
<label></label>
</div>
</div>
</div>
<div id="thesubdb_option" class="ui grid container">
</div>
<div class="middle aligned row">
<div class="right aligned four wide column">
<label>TVSubtitles</label>
</div>
<div class="one wide column">
<div id="tvsubtitles" class="ui toggle checkbox provider">
<input type="checkbox">
<label></label>
</div>
</div>
</div>
<div id="tvsubtitles_option" class="ui grid container">
</div>
<div class="middle aligned row">
<div class="eleven wide column">
<div class='field'>
<div class='field' hidden>
<select name="settings_subliminal_providers" id="settings_providers" multiple="" class="ui fluid search selection dropdown">
<option value="">Providers</option>
%enabled_providers = []
@ -649,6 +824,25 @@
</div>
</div>
</div>
<div class="sonarr_hide middle aligned row">
<div class="right aligned four wide column">
<label>Download only monitored</label>
</div>
<div class="one wide column">
<div id="settings_only_monitored_sonarr" class="ui toggle checkbox" data-monitored={{settings.sonarr.getboolean('only_monitored')}}>
<input name="settings_sonarr_only_monitored" type="checkbox">
<label></label>
</div>
</div>
<div class="collapsed column">
<div class="collapsed center aligned column">
<div class="ui basic icon" data-tooltip="Automatic download of subtitles will happen only for monitored episodes in Sonarr." data-inverted="">
<i class="help circle large icon"></i>
</div>
</div>
</div>
</div>
</div>
</div>
@ -781,6 +975,25 @@
</div>
</div>
</div>
<div class="radarr_hide middle aligned row">
<div class="right aligned four wide column">
<label>Download only monitored</label>
</div>
<div class="one wide column">
<div id="settings_only_monitored_radarr" class="ui toggle checkbox" data-monitored={{settings.radarr.getboolean('only_monitored')}}>
<input name="settings_radarr_only_monitored" type="checkbox">
<label></label>
</div>
</div>
<div class="collapsed column">
<div class="collapsed center aligned column">
<div class="ui basic icon" data-tooltip="Automatic download of subtitles will happen only for monitored movies in Radarr." data-inverted="">
<i class="help circle large icon"></i>
</div>
</div>
</div>
</div>
</div>
</div>
@ -792,6 +1005,33 @@
</html>
<script>
function getQueryVariable(variable)
{
var query = window.location.search.substring(1);
var vars = query.split("&");
for (var i=0;i<vars.length;i++) {
var pair = vars[i].split("=");
if(pair[0] == variable){return pair[1];}
}
return(false);
}
if (getQueryVariable("saved") == 'true') {
new Noty({
text: 'Settings saved.',
timeout: 5000,
progressBar: false,
animation: {
open: null,
close: null
},
killer: true,
type: 'info',
layout: 'bottomRight',
theme: 'semanticui'
}).show();
}
$(function() {
$('.next1').on('click', function(e) {
@ -968,6 +1208,18 @@ $(function() {
$("#settings_movie_default_hi_div").addClass('disabled');
}
if ($('#settings_only_monitored_sonarr').data("monitored") === "True") {
$("#settings_only_monitored_sonarr").checkbox('check');
} else {
$("#settings_only_monitored_sonarr").checkbox('uncheck');
}
if ($('#settings_only_monitored_radarr').data("monitored") === "True") {
$("#settings_only_monitored_radarr").checkbox('check');
} else {
$("#settings_only_monitored_radarr").checkbox('uncheck');
}
$('#settings_movie_default_enabled_div').checkbox({
onChecked: function() {
$("#settings_movie_default_languages").parent().removeClass('disabled');
@ -1180,9 +1432,26 @@ $(function() {
})
;
$('#settings_providers').dropdown('setting', 'onChange', function(){
$('.form').form('validate field', 'settings_subliminal_providers');
$("#settings_providers > option").each(function() {
$('#'+$(this).val()+'_option').hide();
});
$("#settings_providers > option:selected").each(function() {
$('[id='+this.value+']').checkbox('check');
$('#'+$(this).val()+'_option').show();
});
$('.provider').checkbox({
onChecked: function() {
$('#settings_providers').dropdown('set selected', $(this).parent().attr('id'));
$('#'+$(this).parent().attr('id')+'_option').show();
},
onUnchecked: function() {
$('#settings_providers').dropdown('remove selected', $(this).parent().attr('id'));
$('#'+$(this).parent().attr('id')+'_option').hide();
}
});
$('#settings_languages').dropdown('setting', 'onChange', function(){
$('.form').form('validate field', 'settings_subliminal_languages');
});

Loading…
Cancel
Save