Add providers settings UI

pull/292/head
Halali 6 years ago
parent 7c59b2d82c
commit f5da9ebda0

@ -325,6 +325,42 @@ def save_wizard():
settings_subliminal_providers = request.forms.getall('settings_subliminal_providers')
settings.general.enabled_providers = u'' if not settings_subliminal_providers else ','.join(
settings_subliminal_providers)
settings_addic7ed_random_agents = request.forms.get('settings_addic7ed_random_agents')
if settings_addic7ed_random_agents is None:
settings_addic7ed_random_agents = 'False'
else:
settings_addic7ed_random_agents = 'True'
settings_opensubtitles_vip = request.forms.get('settings_opensubtitles_vip')
if settings_opensubtitles_vip is None:
settings_opensubtitles_vip = 'False'
else:
settings_opensubtitles_vip = 'True'
settings_opensubtitles_ssl = request.forms.get('settings_opensubtitles_ssl')
if settings_opensubtitles_ssl is None:
settings_opensubtitles_ssl = 'False'
else:
settings_opensubtitles_ssl = 'True'
settings_opensubtitles_skip_wrong_fps = request.forms.get('settings_opensubtitles_skip_wrong_fps')
if settings_opensubtitles_skip_wrong_fps is None:
settings_opensubtitles_skip_wrong_fps = 'False'
else:
settings_opensubtitles_skip_wrong_fps = 'True'
settings.addic7ed.username = request.forms.get('settings_addic7ed_username')
settings.addic7ed.password = request.forms.get('settings_addic7ed_password')
settings.addic7ed.random_agents = text_type(settings_addic7ed_random_agents)
settings.assrt.token = request.forms.get('settings_assrt_token')
settings.legendastv.username = request.forms.get('settings_legendastv_username')
settings.legendastv.password = request.forms.get('settings_legendastv_password')
settings.opensubtitles.username = request.forms.get('settings_opensubtitles_username')
settings.opensubtitles.password = request.forms.get('settings_opensubtitles_password')
settings.opensubtitles.vip = text_type(settings_opensubtitles_vip)
settings.opensubtitles.ssl = text_type(settings_opensubtitles_ssl)
settings.opensubtitles.skip_wrong_fps = text_type(settings_opensubtitles_skip_wrong_fps)
settings_subliminal_languages = request.forms.getall('settings_subliminal_languages')
c.execute("UPDATE table_settings_languages SET enabled = 0")
@ -372,8 +408,6 @@ def save_wizard():
with open(os.path.join(args.config_dir, 'config', 'config.ini'), 'w+') as handle:
settings.write(handle)
logging.info('Config file created successfully')
conn.commit()
c.close()
@ -1266,13 +1300,43 @@ def save_settings():
settings_subliminal_providers = request.forms.getall('settings_subliminal_providers')
settings.general.enabled_providers = u'' if not settings_subliminal_providers else ','.join(
settings_subliminal_providers)
settings_addic7ed_random_agents = request.forms.get('settings_addic7ed_random_agents')
if settings_addic7ed_random_agents is None:
settings_addic7ed_random_agents = 'False'
else:
settings_addic7ed_random_agents = 'True'
settings_opensubtitles_vip = request.forms.get('settings_opensubtitles_vip')
if settings_opensubtitles_vip is None:
settings_opensubtitles_vip = 'False'
else:
settings_opensubtitles_vip = 'True'
settings_opensubtitles_ssl = request.forms.get('settings_opensubtitles_ssl')
if settings_opensubtitles_ssl is None:
settings_opensubtitles_ssl = 'False'
else:
settings_opensubtitles_ssl = 'True'
settings_opensubtitles_skip_wrong_fps = request.forms.get('settings_opensubtitles_skip_wrong_fps')
if settings_opensubtitles_skip_wrong_fps is None:
settings_opensubtitles_skip_wrong_fps = 'False'
else:
settings_opensubtitles_skip_wrong_fps = 'True'
settings.addic7ed.username = request.forms.get('settings_addic7ed_username')
settings.addic7ed.password = request.forms.get('settings_addic7ed_password')
settings.addic7ed.random_agents = text_type(settings_addic7ed_random_agents)
settings.assrt.token = request.forms.get('settings_assrt_token')
settings.legendastv.username = request.forms.get('settings_legendastv_username')
settings.legendastv.password = request.forms.get('settings_legendastv_password')
settings.opensubtitles.username = request.forms.get('settings_opensubtitles_username')
settings.opensubtitles.password = request.forms.get('settings_opensubtitles_password')
settings.opensubtitles.vip = text_type(settings_opensubtitles_vip)
settings.opensubtitles.ssl = text_type(settings_opensubtitles_ssl)
settings.opensubtitles.skip_wrong_fps = text_type(settings_opensubtitles_skip_wrong_fps)
settings_subliminal_languages = request.forms.getall('settings_subliminal_languages')
c.execute("UPDATE table_settings_languages SET enabled = 0")

@ -1081,6 +1081,21 @@
<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>Argenteam</label>
</div>
<div class="one wide column">
<div id="argenteam" class="ui toggle checkbox provider">
<input type="checkbox">
<label></label>
</div>
</div>
</div>
<div id="argenteam_option" class="ui grid container">
</div>
<div class="middle aligned row">
<div class="right aligned four wide column">
<label>Addic7ed</label>
@ -1113,6 +1128,63 @@
</div>
</div>
</div>
<div class="middle aligned row">
<div class="right aligned six wide column">
<label>Random user-agents</label>
</div>
<div class="one wide column">
<div id="settings_addic7ed_random_agents" class="ui toggle checkbox" data-randomagents={{settings.addic7ed.getboolean('random_agents')}}>
<input type="checkbox" name="settings_addic7ed_random_agents">
<label></label>
</div>
</div>
<div class="collapsed column">
<div class="collapsed center aligned column">
<div class="ui basic icon" data-tooltip="Use random user agents" data-inverted="">
<i class="help circle large icon"></i>
</div>
</div>
</div>
</div>
</div>
<div class="middle aligned row">
<div class="right aligned four wide column">
<label>Assrt</label>
</div>
<div class="one wide column">
<div id="assrt" class="ui toggle checkbox provider">
<input type="checkbox">
<label></label>
</div>
</div>
</div>
<div id="assrt_option" class="ui grid container">
<div class="middle aligned row">
<div class="right aligned six wide column">
<label>Token</label>
</div>
<div class="six wide column">
<div class="ui fluid input">
<input name="settings_assrt_token" type="text" value="{{settings.assrt.token if settings.assrt.token != None else ''}}">
</div>
</div>
</div>
</div>
<div class="middle aligned row">
<div class="right aligned four wide column">
<label>Hosszupuska</label>
</div>
<div class="one wide column">
<div id="hosszupuska" class="ui toggle checkbox provider">
<input type="checkbox">
<label></label>
</div>
</div>
</div>
<div id="hosszupuska_option" class="ui grid container">
</div>
<div class="middle aligned row">
@ -1149,6 +1221,21 @@
</div>
</div>
<div class="middle aligned row">
<div class="right aligned four wide column">
<label>Napiprojekt</label>
</div>
<div class="one wide column">
<div id="napiprojekt" class="ui toggle checkbox provider">
<input type="checkbox">
<label></label>
</div>
</div>
</div>
<div id="napiprojekt_option" class="ui grid container">
</div>
<div class="middle aligned row">
<div class="right aligned four wide column">
<label>OpenSubtitles</label>
@ -1181,6 +1268,53 @@
</div>
</div>
</div>
<div class="middle aligned row">
<div class="right aligned six wide column">
<label>VIP</label>
</div>
<div class="one wide column">
<div id="settings_opensubtitles_vip" class="ui toggle checkbox" data-osvip={{settings.opensubtitles.getboolean('vip')}}>
<input type="checkbox" name="settings_opensubtitles_vip">
<label></label>
</div>
</div>
<div class="collapsed column">
<div class="collapsed center aligned column">
<div class="ui basic icon" data-tooltip="ad-free subs, 1000 subs/day, no-cache VIP server: http://v.ht/osvip" data-inverted="">
<i class="help circle large icon"></i>
</div>
</div>
</div>
</div>
<div class="middle aligned row">
<div class="right aligned six wide column">
<label>Use SSL</label>
</div>
<div class="one wide column">
<div id="settings_opensubtitles_ssl" class="ui toggle checkbox" data-osssl={{settings.opensubtitles.getboolean('ssl')}}>
<input type="checkbox" name="settings_opensubtitles_ssl">
<label></label>
</div>
</div>
<div class="collapsed column">
<div class="collapsed center aligned column">
<div class="ui basic icon" data-tooltip="Use SSL connection to OS" data-inverted="">
<i class="help circle large icon"></i>
</div>
</div>
</div>
</div>
<div class="middle aligned row">
<div class="right aligned six wide column">
<label>Skip wrong FPS</label>
</div>
<div class="one wide column">
<div id="settings_opensubtitles_skip_wrong_fps" class="ui toggle checkbox" data-osfps={{settings.opensubtitles.getboolean('skip_wrong_fps')}}>
<input type="checkbox" name="settings_opensubtitles_skip_wrong_fps">
<label></label>
</div>
</div>
</div>
</div>
<div class="middle aligned row">
@ -1230,16 +1364,31 @@
<div class="middle aligned row">
<div class="right aligned four wide column">
<label>TheSubDB</label>
<label>Supersubtitles</label>
</div>
<div class="one wide column">
<div id="supersubtitles" class="ui toggle checkbox provider">
<input type="checkbox">
<label></label>
</div>
</div>
</div>
<div id="supersubtitles_option" class="ui grid container">
</div>
<div class="middle aligned row">
<div class="right aligned four wide column">
<label>Titlovi</label>
</div>
<div class="one wide column">
<div id="thesubdb" class="ui toggle checkbox provider">
<div id="titlovi" class="ui toggle checkbox provider">
<input type="checkbox">
<label></label>
</div>
</div>
</div>
<div id="thesubdb_option" class="ui grid container">
<div id="titlovi_option" class="ui grid container">
</div>
@ -1258,7 +1407,6 @@
</div>
<div class="middle aligned row">
<div class="eleven wide column">
<div class='field' hidden>
@ -1600,6 +1748,30 @@
$("#settings_adaptive_searching").checkbox('uncheck');
}
if ($('#settings_addic7ed_random_agents').data("randomagents") === "True") {
$("#settings_addic7ed_random_agents").checkbox('check');
} else {
$("#settings_addic7ed_random_agents").checkbox('uncheck');
}
if ($('#settings_opensubtitles_vip').data("osvip") === "True") {
$("#settings_opensubtitles_vip").checkbox('check');
} else {
$("#settings_opensubtitles_vip").checkbox('uncheck');
}
if ($('#settings_opensubtitles_ssl').data("osssl") === "True") {
$("#settings_opensubtitles_ssl").checkbox('check');
} else {
$("#settings_opensubtitles_ssl").checkbox('uncheck');
}
if ($('#settings_opensubtitles_skip_wrong_fps').data("osfps") === "True") {
$("#settings_opensubtitles_skip_wrong_fps").checkbox('check');
} else {
$("#settings_opensubtitles_skip_wrong_fps").checkbox('uncheck');
}
if ($('#settings_use_postprocessing').data("postprocessing") === "True") {
$("#settings_use_postprocessing").checkbox('check');
$("#settings_general_postprocessing_cmd_div").removeClass('disabled');

@ -338,6 +338,21 @@
<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>Argenteam</label>
</div>
<div class="one wide column">
<div id="argenteam" class="ui toggle checkbox provider">
<input type="checkbox">
<label></label>
</div>
</div>
</div>
<div id="argenteam_option" class="ui grid container">
</div>
<div class="middle aligned row">
<div class="right aligned four wide column">
<label>Addic7ed</label>
@ -370,6 +385,63 @@
</div>
</div>
</div>
<div class="middle aligned row">
<div class="right aligned six wide column">
<label>Random user-agents</label>
</div>
<div class="one wide column">
<div id="settings_addic7ed_random_agents" class="ui toggle checkbox" data-randomagents={{settings.addic7ed.getboolean('random_agents')}}>
<input type="checkbox" name="settings_addic7ed_random_agents">
<label></label>
</div>
</div>
<div class="collapsed column">
<div class="collapsed center aligned column">
<div class="ui basic icon" data-tooltip="Use random user agents" data-inverted="">
<i class="help circle large icon"></i>
</div>
</div>
</div>
</div>
</div>
<div class="middle aligned row">
<div class="right aligned four wide column">
<label>Assrt</label>
</div>
<div class="one wide column">
<div id="assrt" class="ui toggle checkbox provider">
<input type="checkbox">
<label></label>
</div>
</div>
</div>
<div id="assrt_option" class="ui grid container">
<div class="middle aligned row">
<div class="right aligned six wide column">
<label>Token</label>
</div>
<div class="six wide column">
<div class="ui fluid input">
<input name="settings_assrt_token" type="text" value="{{settings.assrt.token if settings.assrt.token != None else ''}}">
</div>
</div>
</div>
</div>
<div class="middle aligned row">
<div class="right aligned four wide column">
<label>Hosszupuska</label>
</div>
<div class="one wide column">
<div id="hosszupuska" class="ui toggle checkbox provider">
<input type="checkbox">
<label></label>
</div>
</div>
</div>
<div id="hosszupuska_option" class="ui grid container">
</div>
<div class="middle aligned row">
@ -406,6 +478,21 @@
</div>
</div>
<div class="middle aligned row">
<div class="right aligned four wide column">
<label>Napiprojekt</label>
</div>
<div class="one wide column">
<div id="napiprojekt" class="ui toggle checkbox provider">
<input type="checkbox">
<label></label>
</div>
</div>
</div>
<div id="napiprojekt_option" class="ui grid container">
</div>
<div class="middle aligned row">
<div class="right aligned four wide column">
<label>OpenSubtitles</label>
@ -438,6 +525,53 @@
</div>
</div>
</div>
<div class="middle aligned row">
<div class="right aligned six wide column">
<label>VIP</label>
</div>
<div class="one wide column">
<div id="settings_opensubtitles_vip" class="ui toggle checkbox" data-osvip={{settings.opensubtitles.getboolean('vip')}}>
<input type="checkbox" name="settings_opensubtitles_vip">
<label></label>
</div>
</div>
<div class="collapsed column">
<div class="collapsed center aligned column">
<div class="ui basic icon" data-tooltip="ad-free subs, 1000 subs/day, no-cache VIP server: http://v.ht/osvip" data-inverted="">
<i class="help circle large icon"></i>
</div>
</div>
</div>
</div>
<div class="middle aligned row">
<div class="right aligned six wide column">
<label>Use SSL</label>
</div>
<div class="one wide column">
<div id="settings_opensubtitles_ssl" class="ui toggle checkbox" data-osssl={{settings.opensubtitles.getboolean('ssl')}}>
<input type="checkbox" name="settings_opensubtitles_ssl">
<label></label>
</div>
</div>
<div class="collapsed column">
<div class="collapsed center aligned column">
<div class="ui basic icon" data-tooltip="Use SSL connection to OS" data-inverted="">
<i class="help circle large icon"></i>
</div>
</div>
</div>
</div>
<div class="middle aligned row">
<div class="right aligned six wide column">
<label>Skip wrong FPS</label>
</div>
<div class="one wide column">
<div id="settings_opensubtitles_skip_wrong_fps" class="ui toggle checkbox" data-osfps={{settings.opensubtitles.getboolean('skip_wrong_fps')}}>
<input type="checkbox" name="settings_opensubtitles_skip_wrong_fps">
<label></label>
</div>
</div>
</div>
</div>
<div class="middle aligned row">
@ -487,16 +621,31 @@
<div class="middle aligned row">
<div class="right aligned four wide column">
<label>TheSubDB</label>
<label>Supersubtitles</label>
</div>
<div class="one wide column">
<div id="supersubtitles" class="ui toggle checkbox provider">
<input type="checkbox">
<label></label>
</div>
</div>
</div>
<div id="supersubtitles_option" class="ui grid container">
</div>
<div class="middle aligned row">
<div class="right aligned four wide column">
<label>Titlovi</label>
</div>
<div class="one wide column">
<div id="thesubdb" class="ui toggle checkbox provider">
<div id="titlovi" class="ui toggle checkbox provider">
<input type="checkbox">
<label></label>
</div>
</div>
</div>
<div id="thesubdb_option" class="ui grid container">
<div id="titlovi_option" class="ui grid container">
</div>
@ -1140,6 +1289,30 @@ $(function() {
$("#radarr_ssl_div").checkbox('uncheck');
}
if ($('#settings_addic7ed_random_agents').data("randomagents") === "True") {
$("#settings_addic7ed_random_agents").checkbox('check');
} else {
$("#settings_addic7ed_random_agents").checkbox('uncheck');
}
if ($('#settings_opensubtitles_vip').data("osvip") === "True") {
$("#settings_opensubtitles_vip").checkbox('check');
} else {
$("#settings_opensubtitles_vip").checkbox('uncheck');
}
if ($('#settings_opensubtitles_ssl').data("osssl") === "True") {
$("#settings_opensubtitles_ssl").checkbox('check');
} else {
$("#settings_opensubtitles_ssl").checkbox('uncheck');
}
if ($('#settings_opensubtitles_skip_wrong_fps').data("osfps") === "True") {
$("#settings_opensubtitles_skip_wrong_fps").checkbox('check');
} else {
$("#settings_opensubtitles_skip_wrong_fps").checkbox('uncheck');
}
if ($('#settings_single_language').data("single-language") === "True") {
$("#settings_single_language").checkbox('check');
} else {

Loading…
Cancel
Save