From 9741ed2b9168c6d943cd7a1dccb23565ab3506ea Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Louis=20V=C3=A9zina?=
<5130500+morpheus65535@users.noreply.github.com>
Date: Thu, 7 May 2020 07:39:59 -0400
Subject: [PATCH] WIP
---
bazarr/api.py | 13 ++-
bazarr/config.py | 3 +-
bazarr/main.py | 4 +-
views/settingsgeneral.html | 13 ++-
views/settingslanguages.html | 5 +-
views/settingsnotifications.html | 12 ++-
views/settingsproviders.html | 3 +
views/settingsradarr.html | 3 +
views/settingsscheduler.html | 156 +++++++++++++++++++++++++++++++
views/settingssonarr.html | 3 +
views/settingssubtitles.html | 3 +
11 files changed, 205 insertions(+), 13 deletions(-)
diff --git a/bazarr/api.py b/bazarr/api.py
index 1d747b2b8..fe4c36903 100644
--- a/bazarr/api.py
+++ b/bazarr/api.py
@@ -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:
diff --git a/bazarr/config.py b/bazarr/config.py
index d5b7fe3f7..71e580a96 100644
--- a/bazarr/config.py
+++ b/bazarr/config.py
@@ -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',
diff --git a/bazarr/main.py b/bazarr/main.py
index 8cfb73718..ae04375ae 100644
--- a/bazarr/main.py
+++ b/bazarr/main.py
@@ -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')
diff --git a/views/settingsgeneral.html b/views/settingsgeneral.html
index b9bddf996..6dc0627e8 100644
--- a/views/settingsgeneral.html
+++ b/views/settingsgeneral.html
@@ -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;
- })
{% endblock tail %}
diff --git a/views/settingslanguages.html b/views/settingslanguages.html
index 85afa844d..1296d4f51 100644
--- a/views/settingslanguages.html
+++ b/views/settingslanguages.html
@@ -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);
});
{% endblock tail %}
diff --git a/views/settingsnotifications.html b/views/settingsnotifications.html
index 4930ebf07..42fb42d1a 100644
--- a/views/settingsnotifications.html
+++ b/views/settingsnotifications.html
@@ -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');
})
});
diff --git a/views/settingsproviders.html b/views/settingsproviders.html
index 378e861f0..4c62e04de 100644
--- a/views/settingsproviders.html
+++ b/views/settingsproviders.html
@@ -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');
})
});
diff --git a/views/settingsradarr.html b/views/settingsradarr.html
index 4c4ae9654..129c33a39 100644
--- a/views/settingsradarr.html
+++ b/views/settingsradarr.html
@@ -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');
})
});
diff --git a/views/settingsscheduler.html b/views/settingsscheduler.html
index c1d27d21c..1a5edb2e0 100644
--- a/views/settingsscheduler.html
+++ b/views/settingsscheduler.html
@@ -71,7 +71,128 @@
+
+