1
0
Fork 0
mirror of https://github.com/morpheus65535/bazarr synced 2024-12-23 08:13:14 +00:00

Remove scenename and embedded from Wizard and rework for default settings in save_wizard

This commit is contained in:
Halali 2018-10-21 16:50:42 +02:00
parent 9aba6cad49
commit 8be60afaff
2 changed files with 30 additions and 95 deletions

View file

@ -271,19 +271,6 @@ def save_settings():
settings_general_single_language = 'False' settings_general_single_language = 'False'
else: else:
settings_general_single_language = 'True' settings_general_single_language = 'True'
settings_general_scenename = request.forms.get('settings_general_scenename')
if settings_general_scenename is None:
settings_general_scenename = 'True'
else:
settings_general_scenename = 'False'
settings_general_embedded = request.forms.get('settings_general_embedded')
if settings_general_embedded is None:
settings_general_embedded = 'True'
else:
settings_general_embedded = 'False'
settings_general_adaptive_searching = request.forms.get('settings_general_adaptive_searching') settings_general_adaptive_searching = request.forms.get('settings_general_adaptive_searching')
if settings_general_adaptive_searching is None: if settings_general_adaptive_searching is None:
settings_general_adaptive_searching = 'False' settings_general_adaptive_searching = 'False'
@ -302,6 +289,10 @@ def save_settings():
cfg = ConfigParser() cfg = ConfigParser()
settings_general = get_general_settings()
settings_sonarr = get_sonarr_settings()
settings_radarr = get_radarr_settings()
if not cfg.has_section('general'): if not cfg.has_section('general'):
cfg.add_section('general') cfg.add_section('general')
@ -309,39 +300,39 @@ def save_settings():
cfg.set('general', 'port', text_type(settings_general_port)) cfg.set('general', 'port', text_type(settings_general_port))
cfg.set('general', 'base_url', text_type(settings_general_baseurl)) cfg.set('general', 'base_url', text_type(settings_general_baseurl))
cfg.set('general', 'path_mappings', text_type(settings_general_pathmapping)) cfg.set('general', 'path_mappings', text_type(settings_general_pathmapping))
cfg.set('general', 'log_level', 'INFO') cfg.set('general', 'log_level', text_type(get_general_settings()[4]))
cfg.set('general', 'branch', 'master') cfg.set('general', 'branch', text_type(get_general_settings()[5]))
cfg.set('general', 'auto_update', 'True') cfg.set('general', 'auto_update', text_type(get_general_settings()[6]))
cfg.set('general', 'single_language', text_type(settings_general_single_language)) cfg.set('general', 'single_language', text_type(settings_general_single_language))
cfg.set('general', 'minimum_score', '90') cfg.set('general', 'minimum_score', text_type(get_general_settings()[8]))
cfg.set('general', 'use_scenename', text_type(settings_general_scenename)) cfg.set('general', 'use_scenename', text_type(text_type(get_general_settings()[9])))
cfg.set('general', 'use_postprocessing', 'False') cfg.set('general', 'use_postprocessing', text_type(get_general_settings()[10]))
cfg.set('general', 'postprocessing_cmd', '') cfg.set('general', 'postprocessing_cmd', text_type(get_general_settings()[11]))
cfg.set('general', 'use_sonarr', text_type(settings_general_use_sonarr)) cfg.set('general', 'use_sonarr', text_type(settings_general_use_sonarr))
cfg.set('general', 'use_radarr', text_type(settings_general_use_radarr)) cfg.set('general', 'use_radarr', text_type(settings_general_use_radarr))
cfg.set('general', 'path_mappings_movie', text_type(settings_general_pathmapping_movie)) cfg.set('general', 'path_mappings_movie', text_type(settings_general_pathmapping_movie))
cfg.set('general', 'page_size', '25') cfg.set('general', 'page_size', text_type(get_general_settings()[21]))
cfg.set('general', 'minimum_score_movie', '70') cfg.set('general', 'minimum_score_movie', text_type(get_general_settings()[22]))
cfg.set('general', 'use_embedded_subs', text_type(settings_general_embedded)) cfg.set('general', 'use_embedded_subs', text_type(get_general_settings()[23]))
cfg.set('general', 'only_monitored', 'False') cfg.set('general', 'only_monitored', text_type(get_general_settings()[24]))
cfg.set('general', 'adaptive_searching', text_type(settings_general_adaptive_searching)) cfg.set('general', 'adaptive_searching', text_type(settings_general_adaptive_searching))
if not cfg.has_section('proxy'): if not cfg.has_section('proxy'):
cfg.add_section('proxy') cfg.add_section('proxy')
cfg.set('proxy', 'type', "None") cfg.set('proxy', 'type', text_type(get_proxy_settings()[0]))
cfg.set('proxy', 'url', "") cfg.set('proxy', 'url', text_type(get_proxy_settings()[1]))
cfg.set('proxy', 'port', "") cfg.set('proxy', 'port', text_type(get_proxy_settings()[2]))
cfg.set('proxy', 'username', "") cfg.set('proxy', 'username', text_type(get_proxy_settings()[3]))
cfg.set('proxy', 'password', "") cfg.set('proxy', 'password', text_type(get_proxy_settings()[4]))
cfg.set('proxy', 'exclude', "localhost,127.0.0.1") cfg.set('proxy', 'exclude', text_type(get_proxy_settings()[5]))
if not cfg.has_section('auth'): if not cfg.has_section('auth'):
cfg.add_section('auth') cfg.add_section('auth')
cfg.set('auth', 'type', "None") cfg.set('auth', 'type', text_type(get_auth_settings()[0]))
cfg.set('auth', 'username', "") cfg.set('auth', 'username', text_type(get_auth_settings()[1]))
cfg.set('auth', 'password', "") cfg.set('auth', 'password', text_type(get_auth_settings()[2]))
settings_sonarr_ip = request.forms.get('settings_sonarr_ip') settings_sonarr_ip = request.forms.get('settings_sonarr_ip')
settings_sonarr_port = request.forms.get('settings_sonarr_port') settings_sonarr_port = request.forms.get('settings_sonarr_port')
@ -361,7 +352,7 @@ def save_settings():
cfg.set('sonarr', 'base_url', text_type(settings_sonarr_baseurl)) cfg.set('sonarr', 'base_url', text_type(settings_sonarr_baseurl))
cfg.set('sonarr', 'ssl', text_type(settings_sonarr_ssl)) cfg.set('sonarr', 'ssl', text_type(settings_sonarr_ssl))
cfg.set('sonarr', 'apikey', text_type(settings_sonarr_apikey)) cfg.set('sonarr', 'apikey', text_type(settings_sonarr_apikey))
cfg.set('sonarr', 'full_update', 'Daily') cfg.set('sonarr', 'full_update', text_type(get_sonarr_settings()[5]))
settings_radarr_ip = request.forms.get('settings_radarr_ip') settings_radarr_ip = request.forms.get('settings_radarr_ip')
settings_radarr_port = request.forms.get('settings_radarr_port') settings_radarr_port = request.forms.get('settings_radarr_port')
@ -372,7 +363,6 @@ def save_settings():
else: else:
settings_radarr_ssl = 'True' settings_radarr_ssl = 'True'
settings_radarr_apikey = request.forms.get('settings_radarr_apikey') settings_radarr_apikey = request.forms.get('settings_radarr_apikey')
print(settings_radarr_apikey)
if settings_radarr_apikey != '': if settings_radarr_apikey != '':
cfg.set('general', 'use_radarr', 'True') cfg.set('general', 'use_radarr', 'True')
else: else:
@ -386,7 +376,7 @@ def save_settings():
cfg.set('radarr', 'base_url', text_type(settings_radarr_baseurl)) cfg.set('radarr', 'base_url', text_type(settings_radarr_baseurl))
cfg.set('radarr', 'ssl', text_type(settings_radarr_ssl)) cfg.set('radarr', 'ssl', text_type(settings_radarr_ssl))
cfg.set('radarr', 'apikey', text_type(settings_radarr_apikey)) cfg.set('radarr', 'apikey', text_type(settings_radarr_apikey))
cfg.set('radarr', 'full_update', 'Daily') cfg.set('radarr', 'full_update', text_type(get_radarr_settings()[5]))
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")
@ -1087,14 +1077,14 @@ def save_settings():
settings_general_single_language = 'True' settings_general_single_language = 'True'
settings_general_scenename = request.forms.get('settings_general_scenename') settings_general_scenename = request.forms.get('settings_general_scenename')
if settings_general_scenename is None: if settings_general_scenename is None:
settings_general_scenename = 'True'
else:
settings_general_scenename = 'False' settings_general_scenename = 'False'
else:
settings_general_scenename = 'True'
settings_general_embedded = request.forms.get('settings_general_embedded') settings_general_embedded = request.forms.get('settings_general_embedded')
if settings_general_embedded is None: if settings_general_embedded is None:
settings_general_embedded = 'True'
else:
settings_general_embedded = 'False' settings_general_embedded = 'False'
else:
settings_general_embedded = 'True'
settings_general_only_monitored = request.forms.get('settings_general_only_monitored') settings_general_only_monitored = request.forms.get('settings_general_only_monitored')
if settings_general_only_monitored is None: if settings_general_only_monitored is None:
settings_general_only_monitored = 'False' settings_general_only_monitored = 'False'

View file

@ -332,49 +332,6 @@
Prev Prev
</button> </button>
</div> </div>
<div class="ui dividing header">Subtitles options</div>
<div class="twelve wide column">
<div class="ui grid">
<div class="middle aligned row">
<div class="right aligned four wide column">
<label>Use scene name when available</label>
</div>
<div class="one wide column">
<div id="settings_scenename" class="ui toggle checkbox" data-scenename={{settings_general[9]}}>
<input name="settings_general_scenename" type="checkbox">
<label></label>
</div>
</div>
<div class="collapsed column">
<div class="collapsed center aligned column">
<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>
</div>
</div>
</div>
</div>
<div class="middle aligned row">
<div class="right aligned four wide column">
<label>Use embedded subtitles</label>
</div>
<div class="one wide column">
<div id="settings_embedded" class="ui toggle checkbox" data-embedded={{settings_general[23]}}>
<input name="settings_general_embedded" type="checkbox">
<label></label>
</div>
</div>
<div class="collapsed column">
<div class="collapsed center aligned column">
<div class="ui basic icon" data-tooltip="Use embedded subtitles in media files when determining missing ones." 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="ui dividing header">Subtitles providers</div>
<div class="twelve wide column"> <div class="twelve wide column">
<div class="ui orange message"> <div class="ui orange message">
@ -950,18 +907,6 @@ $(document).ready(function() {
$("#settings_single_language").checkbox('uncheck'); $("#settings_single_language").checkbox('uncheck');
} }
if ($('#settings_scenename').data("scenename") == "True") {
$("#settings_scenename").checkbox('check');
} else {
$("#settings_scenename").checkbox('uncheck');
}
if ($('#settings_embedded').data("embedded") == "True") {
$("#settings_embedded").checkbox('check');
} else {
$("#settings_embedded").checkbox('uncheck');
}
$('#settings_languages').dropdown('setting', 'onAdd', function(val, txt){ $('#settings_languages').dropdown('setting', 'onAdd', function(val, txt){
$("#settings_serie_default_languages").append( $("#settings_serie_default_languages").append(
$("<option></option>").attr("value", val).text(txt) $("<option></option>").attr("value", val).text(txt)