diff --git a/CHANGES.md b/CHANGES.md
index 5522af15..da909998 100644
--- a/CHANGES.md
+++ b/CHANGES.md
@@ -10,6 +10,8 @@
* Change startup code cleanup and PEP8
* Change authentication credentials to display more securely on config pages
* Add a "Use as default home page" selector to General Config/Interface/User Interface
+* Add option to the third step of "Add Show" to set episodes as wanted from the first and latest season, this triggers
+ a backlog search on those episodes after the show is added
* Change to improve the integrity of the already post processed video checker
* Add Kodi notifier and metadata
* Add priority, device, and sound support to Pushover notifier (port from midgetspy/sickbeard)
diff --git a/gui/slick/interfaces/default/home_addExistingShow.tmpl b/gui/slick/interfaces/default/home_addExistingShow.tmpl
index e398b54d..e7fc323a 100644
--- a/gui/slick/interfaces/default/home_addExistingShow.tmpl
+++ b/gui/slick/interfaces/default/home_addExistingShow.tmpl
@@ -75,6 +75,8 @@
+ If you tried to add a show, arrived here and can't see the folder, then that show may already be in your show list.
+
diff --git a/gui/slick/interfaces/default/inc_addShowOptions.tmpl b/gui/slick/interfaces/default/inc_addShowOptions.tmpl
index dbbd23ce..90e027a5 100644
--- a/gui/slick/interfaces/default/inc_addShowOptions.tmpl
+++ b/gui/slick/interfaces/default/inc_addShowOptions.tmpl
@@ -26,6 +26,28 @@
#set global $bestQualities = $qualities[1]
#include $os.path.join($sickbeard.PROG_DIR, 'gui/slick/interfaces/default/inc_qualityChooser.tmpl')
+#try:
+ #if True == $enable_default_wanted:
+
+ From season 1 forward, set
+
+
+
+ episodes as wanted (10 ... 0, and where -1 is whole first season)
+
+
+ From latest going back, set
+
+
+
+ episodes as wanted (10 ... 0, and where -1 is whole latest season)
+
+
+
+ #end if
+#except (NameError, NotFound):
+ #pass
+#end try
@@ -86,4 +108,4 @@
#include $os.path.join($sickbeard.PROG_DIR, 'gui/slick/interfaces/default/inc_blackwhitelist.tmpl')
#else
-#end if
\ No newline at end of file
+#end if
diff --git a/gui/slick/js/addShowOptions.js b/gui/slick/js/addShowOptions.js
index ceea7714..6b684e8b 100644
--- a/gui/slick/js/addShowOptions.js
+++ b/gui/slick/js/addShowOptions.js
@@ -1,35 +1,39 @@
-$(document).ready(function () {
+$(document).ready(function(){
- $('#saveDefaultsButton').click(function () {
- var anyQualArray = [];
- var bestQualArray = [];
- $('#anyQualities option:selected').each(function (i, d) {
- anyQualArray.push($(d).val());
- });
- $('#bestQualities option:selected').each(function (i, d) {
- bestQualArray.push($(d).val());
- });
+ $('#saveDefaultsButton').click(function() {
+ var anyQualArray = [], bestQualArray = [];
- $.get(sbRoot + '/config/general/saveAddShowDefaults', {
- defaultStatus: $('#statusSelect').val(),
- anyQualities: anyQualArray.join(','),
- bestQualities: bestQualArray.join(','),
- defaultFlattenFolders: $('#flatten_folders').prop('checked'),
- subtitles: $('#subtitles').prop('checked'),
- anime: $('#anime').prop('checked'),
- scene: $('#scene').prop('checked')
- });
+ $('#anyQualities option:selected').each(function(i, d) {
+ anyQualArray.push($(d).val());
+ });
+ $('#bestQualities option:selected').each(function(i, d) {
+ bestQualArray.push($(d).val());
+ });
- $(this).attr('disabled', true);
- new PNotify({
- title: 'Saved Defaults',
- text: 'Your "add show" defaults have been set to your current selections.',
- shadow: false
- });
- });
+ $.get(sbRoot + '/config/general/saveAddShowDefaults', {
+ default_status: $('#statusSelect').val(),
+ any_qualities: anyQualArray.join(','),
+ best_qualities: bestQualArray.join(','),
+ default_wanted_begin: $('#wanted-begin').val(),
+ default_wanted_latest: $('#wanted-latest').val(),
+ default_flatten_folders: $('#flatten_folders').prop('checked'),
+ default_scene: $('#scene').prop('checked'),
+ default_subtitles: $('#subtitles').prop('checked'),
+ default_anime: $('#anime').prop('checked')
+ });
- $('#statusSelect, #qualityPreset, #flatten_folders, #anyQualities, #bestQualities, #subtitles, #scene, #anime').change(function () {
- $('#saveDefaultsButton').attr('disabled', false);
- });
+ new PNotify({
+ title: 'Saving Defaults',
+ text: 'Saving your "add show" defaults.',
+ shadow: false
+ });
+
+ $(this).attr('disabled', true);
+ });
+
+ $('#statusSelect, #qualityPreset, #anyQualities, #bestQualities, #wanted-begin, #wanted-latest,'
+ + ' #flatten_folders, #scene, #subtitles, #anime').change(function() {
+ $('#saveDefaultsButton').attr('disabled', false);
+ });
});
\ No newline at end of file
diff --git a/sickbeard/__init__.py b/sickbeard/__init__.py
index 4fec4f21..e872b78c 100755
--- a/sickbeard/__init__.py
+++ b/sickbeard/__init__.py
@@ -166,6 +166,8 @@ METADATA_KODI = None
QUALITY_DEFAULT = None
STATUS_DEFAULT = None
+WANTED_BEGIN_DEFAULT = None
+WANTED_LATEST_DEFAULT = None
FLATTEN_FOLDERS_DEFAULT = False
SUBTITLES_DEFAULT = False
INDEXER_DEFAULT = None
@@ -493,7 +495,7 @@ def initialize(consoleLogging=True):
PLEX_SERVER_HOST, PLEX_HOST, PLEX_USERNAME, PLEX_PASSWORD, DEFAULT_BACKLOG_FREQUENCY, MIN_BACKLOG_FREQUENCY, BACKLOG_STARTUP, SKIP_REMOVED_FILES, \
showUpdateScheduler, __INITIALIZED__, LAUNCH_BROWSER, TRASH_REMOVE_SHOW, TRASH_ROTATE_LOGS, HOME_SEARCH_FOCUS, SORT_ARTICLE, showList, loadingShowList, UPDATE_SHOWS_ON_START, SHOW_UPDATE_HOUR, \
NEWZNAB_DATA, NZBS, NZBS_UID, NZBS_HASH, INDEXER_DEFAULT, INDEXER_TIMEOUT, USENET_RETENTION, TORRENT_DIR, \
- QUALITY_DEFAULT, FLATTEN_FOLDERS_DEFAULT, SUBTITLES_DEFAULT, STATUS_DEFAULT, RECENTSEARCH_STARTUP, \
+ QUALITY_DEFAULT, FLATTEN_FOLDERS_DEFAULT, SUBTITLES_DEFAULT, STATUS_DEFAULT, WANTED_BEGIN_DEFAULT, WANTED_LATEST_DEFAULT, RECENTSEARCH_STARTUP, \
GROWL_NOTIFY_ONSNATCH, GROWL_NOTIFY_ONDOWNLOAD, GROWL_NOTIFY_ONSUBTITLEDOWNLOAD, TWITTER_NOTIFY_ONSNATCH, TWITTER_NOTIFY_ONDOWNLOAD, TWITTER_NOTIFY_ONSUBTITLEDOWNLOAD, \
USE_GROWL, GROWL_HOST, GROWL_PASSWORD, USE_PROWL, PROWL_NOTIFY_ONSNATCH, PROWL_NOTIFY_ONDOWNLOAD, PROWL_NOTIFY_ONSUBTITLEDOWNLOAD, PROWL_API, PROWL_PRIORITY, PROG_DIR, \
USE_PYTIVO, PYTIVO_NOTIFY_ONSNATCH, PYTIVO_NOTIFY_ONDOWNLOAD, PYTIVO_NOTIFY_ONSUBTITLEDOWNLOAD, PYTIVO_UPDATE_LIBRARY, PYTIVO_HOST, PYTIVO_SHARE_NAME, PYTIVO_TIVO_NAME, \
@@ -651,6 +653,8 @@ def initialize(consoleLogging=True):
QUALITY_DEFAULT = check_setting_int(CFG, 'General', 'quality_default', SD)
STATUS_DEFAULT = check_setting_int(CFG, 'General', 'status_default', SKIPPED)
+ WANTED_BEGIN_DEFAULT = check_setting_int(CFG, 'General', 'wanted_begin_default', 0)
+ WANTED_LATEST_DEFAULT = check_setting_int(CFG, 'General', 'wanted_latest_default', 0)
VERSION_NOTIFY = bool(check_setting_int(CFG, 'General', 'version_notify', 1))
AUTO_UPDATE = bool(check_setting_int(CFG, 'General', 'auto_update', 0))
NOTIFY_ON_UPDATE = bool(check_setting_int(CFG, 'General', 'notify_on_update', 1))
@@ -1438,6 +1442,8 @@ def save_config():
new_config['General']['skip_removed_files'] = int(SKIP_REMOVED_FILES)
new_config['General']['quality_default'] = int(QUALITY_DEFAULT)
new_config['General']['status_default'] = int(STATUS_DEFAULT)
+ new_config['General']['wanted_begin_default'] = int(WANTED_BEGIN_DEFAULT)
+ new_config['General']['wanted_latest_default'] = int(WANTED_LATEST_DEFAULT)
new_config['General']['flatten_folders_default'] = int(FLATTEN_FOLDERS_DEFAULT)
new_config['General']['indexer_default'] = int(INDEXER_DEFAULT)
new_config['General']['indexer_timeout'] = int(INDEXER_TIMEOUT)
diff --git a/sickbeard/show_queue.py b/sickbeard/show_queue.py
index 393dc838..806fd6bc 100644
--- a/sickbeard/show_queue.py
+++ b/sickbeard/show_queue.py
@@ -132,9 +132,11 @@ class ShowQueue(generic_queue.GenericQueue):
return queueItemObj
def addShow(self, indexer, indexer_id, showDir, default_status=None, quality=None, flatten_folders=None,
- lang="en", subtitles=None, anime=None, scene=None, paused=None, blacklist=None, whitelist=None):
+ lang="en", subtitles=None, anime=None, scene=None, paused=None, blacklist=None, whitelist=None,
+ default_wanted_begin=None, default_wanted_latest=None):
queueItemObj = QueueItemAdd(indexer, indexer_id, showDir, default_status, quality, flatten_folders, lang,
- subtitles, anime, scene, paused, blacklist, whitelist)
+ subtitles, anime, scene, paused, blacklist, whitelist,
+ default_wanted_begin, default_wanted_latest)
self.add_item(queueItemObj)
@@ -191,12 +193,14 @@ class ShowQueueItem(generic_queue.QueueItem):
class QueueItemAdd(ShowQueueItem):
def __init__(self, indexer, indexer_id, showDir, default_status, quality, flatten_folders, lang, subtitles, anime,
- scene, paused, blacklist, whitelist):
+ scene, paused, blacklist, whitelist, default_wanted_begin, default_wanted_latest):
self.indexer = indexer
self.indexer_id = indexer_id
self.showDir = showDir
self.default_status = default_status
+ self.default_wanted_begin = default_wanted_begin
+ self.default_wanted_latest = default_wanted_latest
self.quality = quality
self.flatten_folders = flatten_folders
self.lang = lang
@@ -380,10 +384,36 @@ class QueueItemAdd(ShowQueueItem):
myDB.action("UPDATE tv_episodes SET status = ? WHERE status = ? AND showid = ? AND season != 0",
[self.default_status, SKIPPED, self.show.indexerid])
- # if they started with WANTED eps then run the backlog
- if self.default_status == WANTED:
- logger.log(u"Launching backlog for this show since its episodes are WANTED")
+ # if they gave a number to start or number to end as wanted, then change those eps to it
+ def get_wanted_sql(wanted_max, sql_vars):
+ actual = 0
+ if wanted_max:
+ my_db = db.DBConnection()
+ sql = "UPDATE `tv_episodes` SET status=%s" % WANTED\
+ + " WHERE indexerid IN "\
+ + "(SELECT t1.indexerid FROM `tv_episodes` t1 JOIN "\
+ + "(SELECT %s(season),showid,season FROM `tv_episodes` WHERE '%s'=showid" % (sql_vars[0], self.show.indexerid)\
+ + " AND '0'