This commit is contained in:
Louis Vézina 2020-05-07 07:39:59 -04:00
parent 004e7943ea
commit 9741ed2b91
11 changed files with 205 additions and 13 deletions

View File

@ -289,16 +289,21 @@ class Series(Resource):
# Confirm if path exist
item.update({"exist": os.path.isdir(mapped_path)})
only_monitored_where_clause = ''
if settings.sonarr.getboolean('only_monitored'):
only_monitored_where_clause = " AND table_episodes.monitored == 'True'"
# Add missing subtitles episode count
item.update({"episodeMissingCount": database.execute("SELECT COUNT(*) as count FROM table_episodes WHERE "
"sonarrSeriesId=? AND missing_subtitles is not null "
"AND missing_subtitles != '[]'",
(item['sonarrSeriesId'],), only_one=True)['count']})
"AND missing_subtitles != '[]'" +
only_monitored_where_clause, (item['sonarrSeriesId'],),
only_one=True)['count']})
# Add episode count
item.update({"episodeFileCount": database.execute("SELECT COUNT(*) as count FROM table_episodes WHERE "
"sonarrSeriesId=?", (item['sonarrSeriesId'],),
only_one=True)['count']})
"sonarrSeriesId=?" + only_monitored_where_clause,
(item['sonarrSeriesId'],), only_one=True)['count']})
# Add the series desired subtitles language code2
try:

View File

@ -51,7 +51,8 @@ defaults = {
'days_to_upgrade_subs': '7',
'upgrade_manual': 'True',
'anti_captcha_provider': 'None',
'wanted_search_frequency': '3'
'wanted_search_frequency': '3',
'wanted_search_frequency_movie': '3'
},
'auth': {
'type': 'None',

View File

@ -18,6 +18,7 @@ import warnings
import queueconfig
import apprise
import requests
import calendar
from get_args import args
@ -366,7 +367,8 @@ def settingsnotifications():
@app.route('/settings/scheduler/')
@login_required
def settingsscheduler():
return render_template('settingsscheduler.html')
days_of_the_week = list(enumerate(calendar.day_name))
return render_template('settingsscheduler.html', days=days_of_the_week)
@app.route('/check_update')

View File

@ -297,6 +297,7 @@
// Hide checkmark over save button
$('#save_button_checkmark').hide();
$('#save_button').prop('disabled', true).css('cursor', 'not-allowed');
// Hide update_div if args.no-update
{% if args.no_update %}
@ -351,6 +352,7 @@
complete: function () {
$('#save_button_checkmark').show();
form_changed = false;
$('#save_button').prop('disabled', true).css('cursor', 'not-allowed');
setTimeout(
function()
{
@ -359,6 +361,12 @@
}
});
});
// monitor changes to the settings_form
$('#settings_form').on('change', function() {
form_changed = true;
$('#save_button').prop('disabled', false).css('cursor', 'auto');
})
});
function generate_apikey() {
@ -370,10 +378,5 @@
}
$( "#settings-auth-apikey" ).val( result );
}
// monitor changes to the settings_form
$('#settings_form').on('change', function() {
form_changed = true;
})
</script>
{% endblock tail %}

View File

@ -169,6 +169,7 @@
// Hide checkmark over save button
$('#save_button_checkmark').hide();
$('#save_button').prop('disabled', true).css('cursor', 'not-allowed');
// Listen to selection change on enabled_languages select and keep series and movies default language select synced
$('#enabled_languages').on('changed.bs.select', function(event, clickedIndex, isSelected, previousValue) {
@ -269,6 +270,7 @@
complete: function () {
$('#save_button_checkmark').show();
form_changed = false;
$('#save_button').prop('disabled', true).css('cursor', 'not-allowed');
setTimeout(
function()
{
@ -311,8 +313,9 @@
{
$('#settings_form').on('change', function() {
form_changed = true;
$('#save_button').prop('disabled', false).css('cursor', 'auto');
})
}, 2000);
}, 1000);
});
</script>
{% endblock tail %}

View File

@ -117,6 +117,7 @@
// Hide checkmark over save button
$('#save_button_checkmark').hide();
$('#save_button').prop('disabled', true).css('cursor', 'not-allowed');
var table = $('#notification_providers').DataTable({
select: {
@ -128,7 +129,7 @@
searching: false,
ordering: false,
lengthChange: true,
responsive: false,
responsive: true,
paging: false,
info: false,
processing: true,
@ -149,6 +150,13 @@
}
},
{ data: 'url' }
],
"columnDefs": [
{
"targets": [ 2 ],
"visible": false,
"searchable": false
}
]
});
@ -194,6 +202,7 @@
complete: function () {
$('#save_button_checkmark').show();
form_changed = false;
$('#save_button').prop('disabled', true).css('cursor', 'not-allowed');
setTimeout(
function()
{
@ -206,6 +215,7 @@
// monitor changes to the settings_form
$('#settings_form').on('change', function() {
form_changed = true;
$('#save_button').prop('disabled', false).css('cursor', 'auto');
})
});
</script>

View File

@ -659,6 +659,7 @@
// Hide checkmark over save button
$('#save_button_checkmark').hide();
$('#save_button').prop('disabled', true).css('cursor', 'not-allowed');
// Hide *_div on Select input changed to None
$('.provider').on('change', function() {
@ -707,6 +708,7 @@
complete: function () {
$('#save_button_checkmark').show();
form_changed = false;
$('#save_button').prop('disabled', true).css('cursor', 'not-allowed');
setTimeout(
function()
{
@ -719,6 +721,7 @@
// monitor changes to the settings_form
$('#settings_form').on('change', function() {
form_changed = true;
$('#save_button').prop('disabled', false).css('cursor', 'auto');
})
});
</script>

View File

@ -253,6 +253,7 @@
// Hide checkmark over save button
$('#save_button_checkmark').hide();
$('#save_button').prop('disabled', true).css('cursor', 'not-allowed');
// Hide *_div on Select input changed to None
$('#settings-general-use_radarr').on('change', function() {
@ -287,6 +288,7 @@
complete: function () {
$('#save_button_checkmark').show();
form_changed = false;
$('#save_button').prop('disabled', true).css('cursor', 'not-allowed');
setTimeout(
function()
{
@ -389,6 +391,7 @@
// monitor changes to the settings_form
$('#settings_form').on('change', function() {
form_changed = true;
$('#save_button').prop('disabled', false).css('cursor', 'auto');
})
});
</script>

View File

@ -71,7 +71,128 @@
</select>
</div>
</div>
<br>
<h4>Disk Indexing</h4>
<hr/>
<div class="row">
<div class="col-sm-3 text-right">
<b>Update all Episode Subtitles from disk</b>
</div>
<div class="form-group col-sm-4">
<select class="form-control selectpicker" id="settings-sonarr-full_update" name="settings-sonarr-full_update">
<option value="Manually">Manually</option>
<option value="Daily">Daily</option>
<option value="Weekly">Weekly</option>
</select>
</div>
</div>
<div id="settings-sonarr-full_update_day-div" class="row">
<div class="col-sm-4 text-right">
<b>Day of the week</b>
</div>
<div class="form-group col-sm-3">
<select class="form-control selectpicker" id="settings-sonarr-full_update_day" name="settings-sonarr-full_update_day">
{% for idx, i in days %}
<option value="{{idx}}">{{i}}</option>
{% endfor %}
</select>
</div>
</div>
<div id="settings-sonarr-full_update_hour-div" class="row">
<div class="col-sm-4 text-right">
<b>Hour of the day</b>
</div>
<div class="form-group col-sm-3">
<select class="form-control selectpicker" id="settings-sonarr-full_update_hour" name="settings-sonarr-full_update_hour">
{% for i in range(24) %}
<option value="{{i}}">{{i}}:00</option>
{% endfor %}
</select>
</div>
</div>
<div class="row">
<div class="col-sm-3 text-right">
<b>Update all Movie Subtitles from disk</b>
</div>
<div class="form-group col-sm-4">
<select class="form-control selectpicker" id="settings-radarr-full_update" name="settings-radarr-full_update">
<option value="Manually">Manually</option>
<option value="Daily">Daily</option>
<option value="Weekly">Weekly</option>
</select>
</div>
</div>
<div id="settings-radarr-full_update_day-div" class="row">
<div class="col-sm-4 text-right">
<b>Day of the week</b>
</div>
<div class="form-group col-sm-3">
<select class="form-control selectpicker" id="settings-radarr-full_update_day" name="settings-radarr-full_update_day">
{% for idx, i in days %}
<option value="{{idx}}">{{i}}</option>
{% endfor %}
</select>
</div>
</div>
<div id="settings-radarr-full_update_hour-div" class="row">
<div class="col-sm-4 text-right">
<b>Hour of the day</b>
</div>
<div class="form-group col-sm-3">
<select class="form-control selectpicker" id="settings-radarr-full_update_hour" name="settings-radarr-full_update_hour">
{% for i in range(24) %}
<option value="{{i}}">{{i}}:00</option>
{% endfor %}
</select>
</div>
</div>
<br>
<h4>Search and Upgrade Subtitles</h4>
<hr/>
<div class="row">
<div class="col-sm-3 text-right">
<b>Search for Missing Series Subtitles</b>
</div>
<div class="form-group col-sm-4">
<select class="form-control selectpicker" id="settings-general-wanted_search_frequency" name="settings-general-wanted_search_frequency">
<option value="3">3 hours</option>
<option value="6">6 hours</option>
<option value="12">12 hours</option>
<option value="24">24 hours</option>
</select>
</div>
</div>
<div class="row">
<div class="col-sm-3 text-right">
<b>Search for Missing Movies Subtitles</b>
</div>
<div class="form-group col-sm-4">
<select class="form-control selectpicker" id="settings-general-wanted_search_frequency_movie" name="settings-general-wanted_search_frequency_movie">
<option value="3">3 hours</option>
<option value="6">6 hours</option>
<option value="12">12 hours</option>
<option value="24">24 hours</option>
</select>
</div>
</div>
<div class="row">
<div class="col-sm-3 text-right">
<b>Upgrade previously downloaded Subtitles</b>
</div>
<div class="form-group col-sm-4">
<select class="form-control selectpicker" id="settings-general-upgrade_frequency" name="settings-general-upgrade_frequency">
<option value="1">1 hours</option>
<option value="3">3 hours</option>
<option value="6">6 hours</option>
<option value="12">12 hours</option>
<option value="24">24 hours</option>
</select>
</div>
</div>
<br>
</form>
</div>
{% endblock body %}
@ -89,11 +210,44 @@
// Hide checkmark over save button
$('#save_button_checkmark').hide();
$('#save_button').prop('disabled', true).css('cursor', 'not-allowed');
// Hide *_div on Select input changed to None
$('#settings-sonarr-full_update').on('change', function() {
$('#settings-sonarr-full_update_day-div').hide();
$('#settings-sonarr-full_update_hour-div').hide();
if ($(this).val() === 'Daily') {
$('#settings-sonarr-full_update_hour-div').show();
} else if ($(this).val() === 'Weekly') {
$('#settings-sonarr-full_update_day-div').show();
$('#settings-sonarr-full_update_hour-div').show();
}
});
$('#settings-radarr-full_update').on('change', function() {
$('#settings-radarr-full_update_day-div').hide();
$('#settings-radarr-full_update_hour-div').hide();
if ($(this).val() === 'Daily') {
$('#settings-radarr-full_update_hour-div').show();
} else if ($(this).val() === 'Weekly') {
$('#settings-radarr-full_update_day-div').show();
$('#settings-radarr-full_update_hour-div').show();
}
});
// Set Select input values
$('#settings-sonarr-series_sync').val('{{settings.sonarr.series_sync}}').trigger('change');
$('#settings-sonarr-episodes_sync').val('{{settings.sonarr.episodes_sync}}').trigger('change');
$('#settings-radarr-movies_sync').val('{{settings.radarr.movies_sync}}').trigger('change');
$('#settings-sonarr-full_update').val('{{settings.sonarr.full_update}}').trigger('change');
$('#settings-sonarr-full_update_day').val('{{settings.sonarr.full_update_day}}').trigger('change');
$('#settings-sonarr-full_update_hour').val('{{settings.sonarr.full_update_hour}}').trigger('change');
$('#settings-radarr-full_update').val('{{settings.radarr.full_update}}').trigger('change');
$('#settings-radarr-full_update_day').val('{{settings.radarr.full_update_day}}').trigger('change');
$('#settings-radarr-full_update_hour').val('{{settings.radarr.full_update_hour}}').trigger('change');
$('#settings-general-wanted_search_frequency').val('{{settings.general.wanted_search_frequency}}').trigger('change');
$('#settings-general-wanted_search_frequency_movie').val('{{settings.general.wanted_search_frequency}}').trigger('change');
$('#settings-general-upgrade_frequency').val('{{settings.general.upgrade_frequency}}').trigger('change');
$('.selectpicker').selectpicker('refresh')
$('#save_button').on('click', function() {
@ -113,6 +267,7 @@
complete: function () {
$('#save_button_checkmark').show();
form_changed = false;
$('#save_button').prop('disabled', true).css('cursor', 'not-allowed');
setTimeout(
function()
{
@ -125,6 +280,7 @@
// monitor changes to the settings_form
$('#settings_form').on('change', function() {
form_changed = true;
$('#save_button').prop('disabled', false).css('cursor', 'auto');
})
});
</script>

View File

@ -253,6 +253,7 @@
// Hide checkmark over save button
$('#save_button_checkmark').hide();
$('#save_button').prop('disabled', true).css('cursor', 'not-allowed');
// Hide *_div on Select input changed to None
$('#settings-general-use_sonarr').on('change', function() {
@ -287,6 +288,7 @@
complete: function () {
$('#save_button_checkmark').show();
form_changed = false;
$('#save_button').prop('disabled', true).css('cursor', 'not-allowed');
setTimeout(
function()
{
@ -390,6 +392,7 @@
// monitor changes to the settings_form
$('#settings_form').on('change', function() {
form_changed = true;
$('#save_button').prop('disabled', false).css('cursor', 'auto');
})
});
</script>

View File

@ -307,6 +307,7 @@
// Hide checkmark over save button
$('#save_button_checkmark').hide();
$('#save_button').prop('disabled', true).css('cursor', 'not-allowed');
// Hide *_div on Select input changed to None
$('#settings-general-subfolder').on('change', function() {
@ -395,6 +396,7 @@
complete: function () {
$('#save_button_checkmark').show();
form_changed = false;
$('#save_button').prop('disabled', true).css('cursor', 'not-allowed');
setTimeout(
function()
{
@ -407,6 +409,7 @@
// monitor changes to the settings_form
$('#settings_form').on('change', function() {
form_changed = true;
$('#save_button').prop('disabled', false).css('cursor', 'auto');
})
});
</script>