Continuing development

pull/72/head
morpheus65535 7 years ago
parent dfeae77d5c
commit c2d0d54fab

@ -608,10 +608,12 @@ def settings():
settings_providers = c.fetchall() settings_providers = c.fetchall()
c.execute("SELECT * FROM table_settings_sonarr") c.execute("SELECT * FROM table_settings_sonarr")
settings_sonarr = c.fetchone() settings_sonarr = c.fetchone()
c.execute("SELECT * FROM table_settings_radarr")
settings_radarr = c.fetchone()
c.execute("SELECT * FROM table_settings_notifier") c.execute("SELECT * FROM table_settings_notifier")
settings_notifier = c.fetchall() settings_notifier = c.fetchall()
c.close() c.close()
return template('settings', __file__=__file__, bazarr_version=bazarr_version, settings_general=settings_general, settings_languages=settings_languages, settings_providers=settings_providers, settings_sonarr=settings_sonarr, settings_notifier=settings_notifier, base_url=base_url) return template('settings', __file__=__file__, bazarr_version=bazarr_version, settings_general=settings_general, settings_languages=settings_languages, settings_providers=settings_providers, settings_sonarr=settings_sonarr, settings_radarr=settings_radarr, settings_notifier=settings_notifier, base_url=base_url)
@route(base_url + 'save_settings', method='POST') @route(base_url + 'save_settings', method='POST')
def save_settings(): def save_settings():
@ -651,10 +653,23 @@ def save_settings():
else: else:
settings_general_use_postprocessing = 'True' settings_general_use_postprocessing = 'True'
settings_general_postprocessing_cmd = request.forms.get('settings_general_postprocessing_cmd') settings_general_postprocessing_cmd = request.forms.get('settings_general_postprocessing_cmd')
print "toto"
settings_general_use_sonarr = request.forms.get('settings_general_use_sonarr')
print settings_general_use_sonarr
if settings_general_use_sonarr is None:
settings_general_use_sonarr = 'False'
else:
settings_general_use_sonarr = 'True'
settings_general_use_radarr = request.forms.get('settings_general_use_radarr')
print settings_general_use_radarr
if settings_general_use_radarr is None:
settings_general_use_radarr = 'False'
else:
settings_general_use_radarr = 'True'
before = c.execute("SELECT ip, port, base_url FROM table_settings_general").fetchone() before = c.execute("SELECT ip, port, base_url, log_level, path_mapping FROM table_settings_general").fetchone()
after = (unicode(settings_general_ip), int(settings_general_port), unicode(settings_general_baseurl)) after = (unicode(settings_general_ip), int(settings_general_port), unicode(settings_general_baseurl), unicode(settings_general_loglevel), unicode(settings_general_pathmapping))
c.execute("UPDATE table_settings_general SET ip = ?, port = ?, base_url = ?, path_mapping = ?, log_level = ?, branch=?, auto_update=?, single_language=?, minimum_score=?, use_scenename=?, use_postprocessing=?, postprocessing_cmd=?", (unicode(settings_general_ip), int(settings_general_port), unicode(settings_general_baseurl), unicode(settings_general_pathmapping), unicode(settings_general_loglevel), unicode(settings_general_branch), unicode(settings_general_automatic), unicode(settings_general_single_language), unicode(settings_general_minimum_score), unicode(settings_general_scenename), unicode(settings_general_use_postprocessing), unicode(settings_general_postprocessing_cmd) )) c.execute("UPDATE table_settings_general SET ip = ?, port = ?, base_url = ?, path_mapping = ?, log_level = ?, branch=?, auto_update=?, single_language=?, minimum_score=?, use_scenename=?, use_postprocessing=?, postprocessing_cmd=?, use_sonarr=?, use_radarr=?", (unicode(settings_general_ip), int(settings_general_port), unicode(settings_general_baseurl), unicode(settings_general_pathmapping), unicode(settings_general_loglevel), unicode(settings_general_branch), unicode(settings_general_automatic), unicode(settings_general_single_language), unicode(settings_general_minimum_score), unicode(settings_general_scenename), unicode(settings_general_use_postprocessing), unicode(settings_general_postprocessing_cmd), unicode(settings_general_use_sonarr), unicode(settings_general_use_radarr)))
conn.commit() conn.commit()
if after != before: if after != before:
configured() configured()
@ -672,6 +687,19 @@ def save_settings():
settings_sonarr_sync = request.forms.get('settings_sonarr_sync') settings_sonarr_sync = request.forms.get('settings_sonarr_sync')
c.execute("UPDATE table_settings_sonarr SET ip = ?, port = ?, base_url = ?, ssl = ?, apikey = ?, full_update = ?", (settings_sonarr_ip, settings_sonarr_port, settings_sonarr_baseurl, settings_sonarr_ssl, settings_sonarr_apikey, settings_sonarr_sync)) c.execute("UPDATE table_settings_sonarr SET ip = ?, port = ?, base_url = ?, ssl = ?, apikey = ?, full_update = ?", (settings_sonarr_ip, settings_sonarr_port, settings_sonarr_baseurl, settings_sonarr_ssl, settings_sonarr_apikey, settings_sonarr_sync))
settings_radarr_ip = request.forms.get('settings_radarr_ip')
settings_radarr_port = request.forms.get('settings_radarr_port')
settings_radarr_baseurl = request.forms.get('settings_radarr_baseurl')
settings_radarr_ssl = request.forms.get('settings_radarr_ssl')
if settings_radarr_ssl is None:
settings_radarr_ssl = 'False'
else:
settings_radarr_ssl = 'True'
settings_radarr_apikey = request.forms.get('settings_radarr_apikey')
settings_radarr_sync = request.forms.get('settings_radarr_sync')
c.execute("UPDATE table_settings_radarr SET ip = ?, port = ?, base_url = ?, ssl = ?, apikey = ?, full_update = ?", (settings_radarr_ip, settings_radarr_port, settings_radarr_baseurl, settings_radarr_ssl, settings_radarr_apikey, settings_radarr_sync))
settings_subliminal_providers = request.forms.getall('settings_subliminal_providers') settings_subliminal_providers = request.forms.getall('settings_subliminal_providers')
c.execute("UPDATE table_settings_providers SET enabled = 0") c.execute("UPDATE table_settings_providers SET enabled = 0")
for item in settings_subliminal_providers: for item in settings_subliminal_providers:

@ -38,9 +38,18 @@ CREATE TABLE "table_settings_general" (
`path_mapping` TEXT, `path_mapping` TEXT,
`log_level` TEXT, `log_level` TEXT,
`branch` TEXT, `branch` TEXT,
`auto_update` INTEGER `auto_update` INTEGER,
`configured` INTEGER,
`updated` INTEGER,
`single_language` TEXT,
`minimum_score` TEXT,
`use_scenename` TEXT,
`use_postprocessing` TEXT,
`postprocessing_cmd` TEXT,
`use_sonarr` TEXT,
`use_radarr` TEXT
); );
INSERT INTO `table_settings_general` (ip,port,base_url,path_mapping,log_level, branch, auto_update) VALUES ('0.0.0.0',6767,'/',Null,'INFO','master','True'); INSERT INTO `table_settings_general` (ip,port,base_url,path_mapping,log_level, branch, auto_update, configured, updated, single_language, minimum_score, use_scenename, use_postprocessing, postprocessing_cmd, use_sonarr, use_radarr) VALUES ('0.0.0.0',6767,'/',Null,'INFO','master','True',0,0,'False','0','False','False',Null);
CREATE TABLE "table_history" ( CREATE TABLE "table_history" (
`id` INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT UNIQUE, `id` INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT UNIQUE,
`action` INTEGER NOT NULL, `action` INTEGER NOT NULL,

@ -31,8 +31,10 @@ def get_general_settings():
use_scenename = general_settings[11] use_scenename = general_settings[11]
use_postprocessing = general_settings[12] use_postprocessing = general_settings[12]
postprocessing_cmd = general_settings[13] postprocessing_cmd = general_settings[13]
use_sonarr = general_settings[14]
use_radarr = general_settings[15]
return [ip, port, base_url, path_mappings, log_level, branch, automatic, single_language, minimum_score, use_scenename, use_postprocessing, postprocessing_cmd] return [ip, port, base_url, path_mappings, log_level, branch, automatic, single_language, minimum_score, use_scenename, use_postprocessing, postprocessing_cmd, use_sonarr, use_radarr]
def path_replace(path): def path_replace(path):
for path_mapping in path_mappings: for path_mapping in path_mappings:
@ -78,4 +80,6 @@ single_language = result[7]
minimum_score = result[8] minimum_score = result[8]
use_scenename = result[9] use_scenename = result[9]
use_processing = result[10] use_processing = result[10]
postprocessing_cmd = result[11] postprocessing_cmd = result[11]
use_sonarr = result[12]
use_radarr = result[13]

@ -97,6 +97,20 @@ if os.path.exists(os.path.join(os.path.dirname(__file__), 'data/db/bazarr.db'))
except: except:
pass pass
try:
c.execute('alter table table_settings_general add column "use_sonarr" "text"')
except:
pass
else:
c.execute('UPDATE table_settings_general SET use_sonarr="True"')
try:
c.execute('alter table table_settings_general add column "use_radarr" "text"')
except:
pass
else:
c.execute('UPDATE table_settings_general SET use_radarr="False"')
# Commit change to db # Commit change to db
db.commit() db.commit()

@ -85,7 +85,7 @@
<div style='padding-left: 2em; padding-right: 2em;' class='ui container'> <div style='padding-left: 2em; padding-right: 2em;' class='ui container'>
<div id="divdetails" class="ui container"> <div id="divdetails" class="ui container">
<img class="left floated ui image" src="{{base_url}}image_proxy{{details[2]}}"> <img class="left floated ui image" style="max-height:250px;" src="{{base_url}}image_proxy{{details[2]}}">
<div class="ui right floated basic icon buttons"> <div class="ui right floated basic icon buttons">
<button id="scan_disk" class="ui button" data-tooltip="Scan disk for subtitles" data-inverted=""><i class="ui inverted large compact refresh icon"></i></button> <button id="scan_disk" class="ui button" data-tooltip="Scan disk for subtitles" data-inverted=""><i class="ui inverted large compact refresh icon"></i></button>
<button id="search_missing_subtitles" class="ui button" data-tooltip="Download missing subtitles" data-inverted=""><i class="ui inverted huge compact search icon"></i></button> <button id="search_missing_subtitles" class="ui button" data-tooltip="Download missing subtitles" data-inverted=""><i class="ui inverted huge compact search icon"></i></button>

@ -45,6 +45,7 @@
<div class="ui top attached tabular menu"> <div class="ui top attached tabular menu">
<a class="tabs item active" data-tab="general">General</a> <a class="tabs item active" data-tab="general">General</a>
<a class="tabs item" data-tab="sonarr">Sonarr</a> <a class="tabs item" data-tab="sonarr">Sonarr</a>
<a class="tabs item" data-tab="radarr">Radarr</a>
<a class="tabs item" data-tab="subliminal">Subliminal</a> <a class="tabs item" data-tab="subliminal">Subliminal</a>
<a class="tabs item" data-tab="notifier">Notifications</a> <a class="tabs item" data-tab="notifier">Notifications</a>
</div> </div>
@ -157,6 +158,49 @@
</div> </div>
</div> </div>
<div class="ui dividing header">Integration settings</div>
<div class="twelve wide column">
<div class="ui grid">
<div class="middle aligned row">
<div class="right aligned four wide column">
<label>Use Sonarr</label>
</div>
<div class="one wide column">
<div id="settings_use_sonarr" class="ui toggle checkbox" data-enabled={{settings_general[14]}}>
<input name="settings_general_use_sonarr" type="checkbox">
<label></label>
</div>
</div>
<div class="collapsed column">
<div class="collapsed center aligned column">
<div class="ui basic icon" data-tooltip="Enable Sonarr integration." data-inverted="">
<i class="help circle large icon"></i>
</div>
</div>
</div>
</div>
<div class="middle aligned row">
<div class="right aligned four wide column">
<label>Use Radarr</label>
</div>
<div class="one wide column">
<div id="settings_use_radarr" class="ui toggle checkbox" data-enabled={{settings_general[15]}}>
<input name="settings_general_use_radarr" type="checkbox">
<label></label>
</div>
</div>
<div class="collapsed column">
<div class="collapsed center aligned column">
<div class="ui basic icon" data-tooltip="Enable Radarr integration." data-inverted="">
<i class="help circle large icon"></i>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="ui dividing header">Path Mappings</div> <div class="ui dividing header">Path Mappings</div>
<div class="twelve wide column"> <div class="twelve wide column">
<div class="ui grid"> <div class="ui grid">
@ -449,7 +493,116 @@
</div> </div>
<div class="five wide column"> <div class="five wide column">
<div class='field'> <div class='field'>
<select name="settings_sonarr_sync" id="settings_sync" class="ui fluid selection dropdown"> <select name="settings_sonarr_sync" id="settings_sonarr_sync" class="ui fluid selection dropdown">
<option value="Manually">Manually</option>
<option value="Daily">Daily (at 4am)</option>
<option value="Weekly">Weekly (sunday at 4am)</option>
</select>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="ui bottom attached tab segment" data-tab="radarr">
<div class="ui container"><button class="submit ui blue right floated button" type="submit" value="Submit" form="settings_form">Save</button></div>
<div class="ui dividing header">Connection settings</div>
<div class="twelve wide column">
<div class="ui grid">
<div class="middle aligned row">
<div class="right aligned four wide column">
<label>Hostname or IP address</label>
</div>
<div class="five wide column">
<div class='field'>
<div class="ui fluid input">
<input name="settings_radarr_ip" type="text" value="{{settings_radarr[0]}}">
</div>
</div>
</div>
<div class="collapsed center aligned column">
<div class="ui basic icon" data-tooltip="Hostname or IP4 address of Radarr" data-inverted="">
<i class="help circle large icon"></i>
</div>
</div>
</div>
<div class="middle aligned row">
<div class="right aligned four wide column">
<label>Listening port</label>
</div>
<div class="five wide column">
<div class='field'>
<div class="ui fluid input">
<input name="settings_radarr_port" type="text" value="{{settings_radarr[1]}}">
</div>
</div>
</div>
<div class="collapsed center aligned column">
<div class="ui basic icon" data-tooltip="TCP port of Radarr" data-inverted="">
<i class="help circle large icon"></i>
</div>
</div>
</div>
<div class="middle aligned row">
<div class="right aligned four wide column">
<label>Base URL</label>
</div>
<div class="five wide column">
<div class="ui fluid input">
<input name="settings_radarr_baseurl" type="text" value="{{settings_radarr[2]}}">
</div>
</div>
<div class="collapsed center aligned column">
<div class="ui basic icon" data-tooltip="Base URL for Radarr (default: '/')" data-inverted="">
<i class="help circle large icon"></i>
</div>
</div>
</div>
<div class="middle aligned row">
<div class="right aligned four wide column">
<label>SSL enabled</label>
</div>
<div class="one wide column">
<div id="radarr_ssl_div" class="ui toggle checkbox" data-ssl={{settings_radarr[3]}}>
<input name="settings_radarr_ssl" type="checkbox">
<label></label>
</div>
</div>
</div>
<div class="middle aligned row">
<div class="right aligned four wide column">
<label>API key</label>
</div>
<div class="five wide column">
<div class='field'>
<div class="ui fluid input">
<input name="settings_radarr_apikey" type="text" value="{{settings_radarr[4]}}">
</div>
</div>
</div>
<div class="collapsed center aligned column">
<div class="ui basic icon" data-tooltip="API key for Radarr (32 alphanumeric characters)" data-inverted="">
<i class="help circle large icon"></i>
</div>
</div>
</div>
</div>
</div>
<div class="ui dividing header">Synchronization</div>
<div class="twelve wide column">
<div class="ui grid">
<div class="middle aligned row">
<div class="right aligned four wide column">
<label>Full sync frequency</label>
</div>
<div class="five wide column">
<div class='field'>
<select name="settings_radarr_sync" id="settings_radarr_sync" class="ui fluid selection dropdown">
<option value="Manually">Manually</option> <option value="Manually">Manually</option>
<option value="Daily">Daily (at 4am)</option> <option value="Daily">Daily (at 4am)</option>
<option value="Weekly">Weekly (sunday at 4am)</option> <option value="Weekly">Weekly (sunday at 4am)</option>
@ -483,7 +636,7 @@
</div> </div>
<div class="collapsed column"> <div class="collapsed column">
<div class="collapsed center aligned column"> <div class="collapsed center aligned column">
<div class="ui basic icon" data-tooltip="Use the scene name from Sonarr if available to circumvent usage of episode file renaming." data-inverted=""> <div class="ui basic icon" data-tooltip="Use the scene name from Sonarr/Radarr if available to circumvent usage of episode file renaming." data-inverted="">
<i class="help circle large icon"></i> <i class="help circle large icon"></i>
</div> </div>
</div> </div>
@ -725,6 +878,12 @@
$("#sonarr_ssl_div").checkbox('uncheck'); $("#sonarr_ssl_div").checkbox('uncheck');
} }
if ($('#radarr_ssl_div').data("ssl") == "True") {
$("#radarr_ssl_div").checkbox('check');
} else {
$("#radarr_ssl_div").checkbox('uncheck');
}
if ($('#settings_automatic_div').data("automatic") == "True") { if ($('#settings_automatic_div').data("automatic") == "True") {
$("#settings_automatic_div").checkbox('check'); $("#settings_automatic_div").checkbox('check');
} else { } else {
@ -759,6 +918,18 @@
} }
}); });
if ($('#settings_use_sonarr').data("enabled") == "True") {
$("#settings_use_sonarr").checkbox('check');
} else {
$("#settings_use_sonarr").checkbox('uncheck');
}
if ($('#settings_use_radarr').data("enabled") == "True") {
$("#settings_use_radarr").checkbox('check');
} else {
$("#settings_use_radarr").checkbox('uncheck');
}
$('.notifier_enabled').each(function(i, obj) { $('.notifier_enabled').each(function(i, obj) {
if ($(this).data("enabled") == 1) { if ($(this).data("enabled") == 1) {
$(this).checkbox('check'); $(this).checkbox('check');
@ -786,14 +957,17 @@
$('#settings_languages').dropdown('set selected',{{!enabled_languages}}); $('#settings_languages').dropdown('set selected',{{!enabled_languages}});
$('#settings_branch').dropdown('clear'); $('#settings_branch').dropdown('clear');
$('#settings_branch').dropdown('set selected','{{!settings_general[5]}}'); $('#settings_branch').dropdown('set selected','{{!settings_general[5]}}');
$('#settings_sync').dropdown('clear'); $('#settings_sonarr_sync').dropdown('clear');
$('#settings_sync').dropdown('set selected','{{!settings_sonarr[5]}}'); $('#settings_sonarr_sync').dropdown('set selected','{{!settings_sonarr[5]}}');
$('#settings_radarr_sync').dropdown('clear');
$('#settings_radarr_sync').dropdown('set selected','{{!settings_radarr[5]}}');
$('#settings_loglevel').dropdown(); $('#settings_loglevel').dropdown();
$('#settings_providers').dropdown(); $('#settings_providers').dropdown();
$('#settings_languages').dropdown(); $('#settings_languages').dropdown();
$('#settings_branch').dropdown(); $('#settings_branch').dropdown();
$('#settings_sync').dropdown(); $('#settings_sonarr_sync').dropdown();
$('#settings_radarr_sync').dropdown();
</script> </script>
<script> <script>
@ -848,6 +1022,33 @@
} }
] ]
}, },
settings_radarr_ip : {
rules : [
{
type : 'empty'
}
]
},
settings_radarr_port : {
rules : [
{
type : 'integer[1..65535]'
},
{
type : 'empty'
}
]
},
settings_radarr_apikey : {
rules : [
{
type : 'exactLength[32]'
},
{
type : 'empty'
}
]
},
settings_subliminal_providers : { settings_subliminal_providers : {
rules : [ rules : [
{ {

Loading…
Cancel
Save