Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/development' into development
Browse files Browse the repository at this point in the history
  • Loading branch information
halali committed Jan 12, 2019
2 parents 6a53ee7 + 2006f7b commit 94b9672
Show file tree
Hide file tree
Showing 3 changed files with 436 additions and 59 deletions.
5 changes: 4 additions & 1 deletion bazarr/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -1295,7 +1295,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')
Expand Down
256 changes: 205 additions & 51 deletions views/settings.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -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')

Expand Down Expand Up @@ -1083,86 +1083,196 @@
<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="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="addic7ed" class="ui toggle checkbox provider">
<input type="checkbox">
<label></label>
</div>
</div>
</div>
</div>
</div>
<div class="ui dividing header">Providers authentication (optional)</div>
<div class="twelve wide column">
<div class="ui grid">
<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="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>
Expand Down Expand Up @@ -1369,6 +1479,33 @@


<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();
}

$('.test_notification').on('click', function() {
const url_field = $(this).prev().val();
const url_protocol = url_field.split(':')[0];
Expand Down Expand Up @@ -1887,12 +2024,29 @@
$('#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() {
Expand Down
Loading

0 comments on commit 94b9672

Please sign in to comment.