Fix for saving default options when adding shows.

Fix for default provider not being passed in properly.
This commit is contained in:
echel0n 2014-06-01 20:43:37 -07:00
parent 41a9e08155
commit 2ab436b764
6 changed files with 51 additions and 23 deletions

View file

@ -41,6 +41,14 @@
</label> </label>
</div> </div>
<div class="field-pair alt">
<input type="checkbox" name="scene" id="scene" #if $sickbeard.SCENE_DEFAULT then "checked=\"checked\"" else ""# />
<label for="scene" class="clearfix">
<span class="component-title">Scene Numbering</span>
<span class="component-desc">Is this show scene numbered?</span>
</label>
</div>
#set $qualities = $Quality.splitQuality($sickbeard.QUALITY_DEFAULT) #set $qualities = $Quality.splitQuality($sickbeard.QUALITY_DEFAULT)
#set global $anyQualities = $qualities[0] #set global $anyQualities = $qualities[0]
#set global $bestQualities = $qualities[1] #set global $bestQualities = $qualities[1]

View file

@ -278,7 +278,7 @@ a > i.icon-question-sign { background-image: url("$sbRoot/images/glyphicons-half
<li><a href="$sbRoot/config/anime/"><img src="$sbRoot/images/menu/config16.png" alt="" width="16" height="16" />Anime</a></li> <li><a href="$sbRoot/config/anime/"><img src="$sbRoot/images/menu/config16.png" alt="" width="16" height="16" />Anime</a></li>
</ul> </ul>
</li> </li>
<li id="donate"><a href="https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=YCTA5TEN2JE2J" rel="noreferrer" onclick="window.open('${sickbeard.ANON_REDIRECT}' + this.href); return false;"><img src="$sbRoot/images/paypal/btn_donate_LG.gif" alt="[donate]" /></a></li> <!-- <li id="donate"><a href="https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=YCTA5TEN2JE2J" rel="noreferrer" onclick="window.open('${sickbeard.ANON_REDIRECT}' + this.href); return false;"><img src="$sbRoot/images/paypal/btn_donate_LG.gif" alt="[donate]" /></a></li> //-->
</ul> </ul>
</div> </div>

View file

@ -3,14 +3,22 @@ $(document).ready(function () {
$('#saveDefaultsButton').click(function () { $('#saveDefaultsButton').click(function () {
var anyQualArray = []; var anyQualArray = [];
var bestQualArray = []; var bestQualArray = [];
$('#anyQualities option:selected').each(function (i, d) {anyQualArray.push($(d).val()); }); $('#anyQualities option:selected').each(function (i, d) {
$('#bestQualities option:selected').each(function (i, d) {bestQualArray.push($(d).val()); }); anyQualArray.push($(d).val());
});
$('#bestQualities option:selected').each(function (i, d) {
bestQualArray.push($(d).val());
});
$.get(sbRoot + '/config/general/saveAddShowDefaults', {defaultStatus: $('#statusSelect').val(), $.get(sbRoot + '/config/general/saveAddShowDefaults', {
anyQualities: anyQualArray.join(','), defaultStatus: $('#statusSelect').val(),
bestQualities: bestQualArray.join(','), anyQualities: anyQualArray.join(','),
defaultFlattenFolders: $('#flatten_folders').prop('checked'), bestQualities: bestQualArray.join(','),
subtitles: $('#subtitles').prop('checked') }); defaultFlattenFolders: $('#flatten_folders').prop('checked'),
subtitles: $('#subtitles').prop('checked'),
anime: $('#anime').prop('checked'),
scene: $('#scene').prop('checked')
});
$(this).attr('disabled', true); $(this).attr('disabled', true);
$.pnotify({ $.pnotify({
@ -20,7 +28,7 @@ $(document).ready(function () {
}); });
}); });
$('#statusSelect, #qualityPreset, #flatten_folders, #anyQualities, #bestQualities, #subtitles').change(function () { $('#statusSelect, #qualityPreset, #flatten_folders, #anyQualities, #bestQualities, #subtitles, #scene, #anime').change(function () {
$('#saveDefaultsButton').attr('disabled', false); $('#saveDefaultsButton').attr('disabled', false);
}); });

View file

@ -161,6 +161,7 @@ FLATTEN_FOLDERS_DEFAULT = None
SUBTITLES_DEFAULT = None SUBTITLES_DEFAULT = None
INDEXER_DEFAULT = None INDEXER_DEFAULT = None
INDEXER_TIMEOUT = None INDEXER_TIMEOUT = None
SCENE_DEFAULT = None
ANIME_DEFAULT = None ANIME_DEFAULT = None
PROVIDER_ORDER = [] PROVIDER_ORDER = []
@ -476,7 +477,7 @@ def initialize(consoleLogging=True):
USE_FAILED_DOWNLOADS, DELETE_FAILED, ANON_REDIRECT, LOCALHOST_IP, TMDB_API_KEY, DEBUG, PROXY_SETTING, \ USE_FAILED_DOWNLOADS, DELETE_FAILED, ANON_REDIRECT, LOCALHOST_IP, TMDB_API_KEY, DEBUG, PROXY_SETTING, \
AUTOPOSTPROCESSER_FREQUENCY, DEFAULT_AUTOPOSTPROCESSER_FREQUENCY, MIN_AUTOPOSTPROCESSER_FREQUENCY, \ AUTOPOSTPROCESSER_FREQUENCY, DEFAULT_AUTOPOSTPROCESSER_FREQUENCY, MIN_AUTOPOSTPROCESSER_FREQUENCY, \
ANIME_DEFAULT, NAMING_ANIME, ANIMESUPPORT, USE_ANIDB, ANIDB_USERNAME, ANIDB_PASSWORD, ANIDB_USE_MYLIST, \ ANIME_DEFAULT, NAMING_ANIME, ANIMESUPPORT, USE_ANIDB, ANIDB_USERNAME, ANIDB_PASSWORD, ANIDB_USE_MYLIST, \
ANIME_SPLIT_HOME, maintenanceScheduler ANIME_SPLIT_HOME, maintenanceScheduler, SCENE_DEFAULT
if __INITIALIZED__: if __INITIALIZED__:
return False return False
@ -589,6 +590,7 @@ def initialize(consoleLogging=True):
INDEXER_DEFAULT = check_setting_int(CFG, 'General', 'indexer_default', 0) INDEXER_DEFAULT = check_setting_int(CFG, 'General', 'indexer_default', 0)
INDEXER_TIMEOUT = check_setting_int(CFG, 'General', 'indexer_timeout', 10) INDEXER_TIMEOUT = check_setting_int(CFG, 'General', 'indexer_timeout', 10)
ANIME_DEFAULT = bool(check_setting_int(CFG, 'General', 'anime_default', 0)) ANIME_DEFAULT = bool(check_setting_int(CFG, 'General', 'anime_default', 0))
SCENE_DEFAULT = bool(check_setting_int(CFG, 'General', 'scene_default', 0))
PROVIDER_ORDER = check_setting_str(CFG, 'General', 'provider_order', '').split() PROVIDER_ORDER = check_setting_str(CFG, 'General', 'provider_order', '').split()
@ -1410,6 +1412,7 @@ def save_config():
new_config['General']['indexer_default'] = int(INDEXER_DEFAULT) new_config['General']['indexer_default'] = int(INDEXER_DEFAULT)
new_config['General']['indexer_timeout'] = int(INDEXER_TIMEOUT) new_config['General']['indexer_timeout'] = int(INDEXER_TIMEOUT)
new_config['General']['anime_default'] = int(ANIME_DEFAULT) new_config['General']['anime_default'] = int(ANIME_DEFAULT)
new_config['General']['scene_default'] = int(SCENE_DEFAULT)
new_config['General']['provider_order'] = ' '.join(PROVIDER_ORDER) new_config['General']['provider_order'] = ' '.join(PROVIDER_ORDER)
new_config['General']['version_notify'] = int(VERSION_NOTIFY) new_config['General']['version_notify'] = int(VERSION_NOTIFY)
new_config['General']['auto_update'] = int(AUTO_UPDATE) new_config['General']['auto_update'] = int(AUTO_UPDATE)

View file

@ -132,9 +132,9 @@ class ShowQueue(generic_queue.GenericQueue):
return queueItemObj return queueItemObj
def addShow(self, indexer, indexer_id, showDir, default_status=None, quality=None, flatten_folders=None, def addShow(self, indexer, indexer_id, showDir, default_status=None, quality=None, flatten_folders=None,
subtitles=None, lang="en", anime=None): subtitles=None, lang="en", anime=None, scene=None):
queueItemObj = QueueItemAdd(indexer, indexer_id, showDir, default_status, quality, flatten_folders, lang, queueItemObj = QueueItemAdd(indexer, indexer_id, showDir, default_status, quality, flatten_folders, lang,
subtitles, anime) subtitles, anime, scene)
self.add_item(queueItemObj) self.add_item(queueItemObj)
@ -189,7 +189,7 @@ class ShowQueueItem(generic_queue.QueueItem):
class QueueItemAdd(ShowQueueItem): class QueueItemAdd(ShowQueueItem):
def __init__(self, indexer, indexer_id, showDir, default_status, quality, flatten_folders, lang, subtitles, anime): def __init__(self, indexer, indexer_id, showDir, default_status, quality, flatten_folders, lang, subtitles, anime, scene):
self.indexer = indexer self.indexer = indexer
self.indexer_id = indexer_id self.indexer_id = indexer_id
@ -200,6 +200,7 @@ class QueueItemAdd(ShowQueueItem):
self.lang = lang self.lang = lang
self.subtitles = subtitles self.subtitles = subtitles
self.anime = anime self.anime = anime
self.scene = scene
self.show = None self.show = None
@ -285,6 +286,7 @@ class QueueItemAdd(ShowQueueItem):
self.show.quality = self.quality if self.quality else sickbeard.QUALITY_DEFAULT self.show.quality = self.quality if self.quality else sickbeard.QUALITY_DEFAULT
self.show.flatten_folders = self.flatten_folders if self.flatten_folders != None else sickbeard.FLATTEN_FOLDERS_DEFAULT self.show.flatten_folders = self.flatten_folders if self.flatten_folders != None else sickbeard.FLATTEN_FOLDERS_DEFAULT
self.show.anime = self.anime if self.anime != None else sickbeard.ANIME_DEFAULT self.show.anime = self.anime if self.anime != None else sickbeard.ANIME_DEFAULT
self.show.scene = self.scene if self.scene != None else sickbeard.SCENE_DEFAULT
self.show.paused = False self.show.paused = False
# be smartish about this # be smartish about this
@ -294,8 +296,6 @@ class QueueItemAdd(ShowQueueItem):
self.show.air_by_date = 0 self.show.air_by_date = 0
if self.show.classification and "sports" in self.show.classification.lower(): if self.show.classification and "sports" in self.show.classification.lower():
self.show.sports = 1 self.show.sports = 1
#if self.show.genre and "animation" in self.show.genre.lower():
# self.show.anime = 1
except sickbeard.indexer_exception, e: except sickbeard.indexer_exception, e:
logger.log( logger.log(
@ -385,7 +385,7 @@ class QueueItemAdd(ShowQueueItem):
sickbeard.scene_numbering.xem_refresh(self.show.indexerid, self.show.indexer, force=True) sickbeard.scene_numbering.xem_refresh(self.show.indexerid, self.show.indexer, force=True)
# check if show has XEM mapping so we can determin if searches should go by scene numbering or indexer numbering. # check if show has XEM mapping so we can determin if searches should go by scene numbering or indexer numbering.
if sickbeard.scene_numbering.get_xem_numbering_for_show(self.show.indexerid, self.show.indexer): if not self.scene and sickbeard.scene_numbering.get_xem_numbering_for_show(self.show.indexerid, self.show.indexer):
self.show.scene = 1 self.show.scene = 1
self.finish() self.finish()

View file

@ -990,7 +990,8 @@ class ConfigGeneral:
sickbeard.ROOT_DIRS = rootDirString sickbeard.ROOT_DIRS = rootDirString
@cherrypy.expose @cherrypy.expose
def saveAddShowDefaults(self, defaultStatus, anyQualities, bestQualities, defaultFlattenFolders, subtitles=False, anime=False): def saveAddShowDefaults(self, defaultStatus, anyQualities, bestQualities, defaultFlattenFolders, subtitles=False,
anime=False, scene=False):
if anyQualities: if anyQualities:
anyQualities = anyQualities.split(',') anyQualities = anyQualities.split(',')
@ -1010,7 +1011,8 @@ class ConfigGeneral:
sickbeard.FLATTEN_FOLDERS_DEFAULT = config.checkbox_to_value(defaultFlattenFolders) sickbeard.FLATTEN_FOLDERS_DEFAULT = config.checkbox_to_value(defaultFlattenFolders)
sickbeard.SUBTITLES_DEFAULT = config.checkbox_to_value(subtitles) sickbeard.SUBTITLES_DEFAULT = config.checkbox_to_value(subtitles)
sickbeard.ANIME_DEFAULT = int(anime) sickbeard.ANIME_DEFAULT = config.checkbox_to_value(anime)
sickbeard.SCENE_DEFAULT = config.checkbox_to_value(scene)
sickbeard.save_config() sickbeard.save_config()
@ -2336,7 +2338,8 @@ class NewHomeAddShows:
@cherrypy.expose @cherrypy.expose
def addNewShow(self, whichSeries=None, indexerLang="en", rootDir=None, defaultStatus=None, def addNewShow(self, whichSeries=None, indexerLang="en", rootDir=None, defaultStatus=None,
anyQualities=None, bestQualities=None, flatten_folders=None, subtitles=None, anyQualities=None, bestQualities=None, flatten_folders=None, subtitles=None,
fullShowPath=None, other_shows=None, skipShow=None, providedIndexer=None, anime=None): fullShowPath=None, other_shows=None, skipShow=None, providedIndexer=None, anime=None,
scene=None):
""" """
Receive tvdb id, dir, and other options and create a show from them. If extra show dirs are Receive tvdb id, dir, and other options and create a show from them. If extra show dirs are
provided then it forwards back to newShow, if not it goes to /home. provided then it forwards back to newShow, if not it goes to /home.
@ -2381,6 +2384,10 @@ class NewHomeAddShows:
indexer_id = int(series_pieces[3]) indexer_id = int(series_pieces[3])
show_name = series_pieces[4] show_name = series_pieces[4]
else: else:
# if no indexer was provided use the default indexer set in General settings
if not providedIndexer:
providedIndexer = sickbeard.INDEXER_DEFAULT
indexer = int(providedIndexer) indexer = int(providedIndexer)
indexer_id = int(whichSeries) indexer_id = int(whichSeries)
show_name = os.path.basename(os.path.normpath(fullShowPath)) show_name = os.path.basename(os.path.normpath(fullShowPath))
@ -2410,11 +2417,11 @@ class NewHomeAddShows:
helpers.chmodAsParent(show_dir) helpers.chmodAsParent(show_dir)
# prepare the inputs for passing along # prepare the inputs for passing along
scene = config.checkbox_to_value(scene)
anime = config.checkbox_to_value(anime) anime = config.checkbox_to_value(anime)
flatten_folders = config.checkbox_to_value(flatten_folders) flatten_folders = config.checkbox_to_value(flatten_folders)
subtitles = config.checkbox_to_value(subtitles) subtitles = config.checkbox_to_value(subtitles)
if not anyQualities: if not anyQualities:
anyQualities = [] anyQualities = []
if not bestQualities: if not bestQualities:
@ -2427,7 +2434,7 @@ class NewHomeAddShows:
# add the show # add the show
sickbeard.showQueueScheduler.action.addShow(indexer, indexer_id, show_dir, int(defaultStatus), newQuality, sickbeard.showQueueScheduler.action.addShow(indexer, indexer_id, show_dir, int(defaultStatus), newQuality,
flatten_folders, subtitles, indexerLang, anime) # @UndefinedVariable flatten_folders, subtitles, indexerLang, anime, scene) # @UndefinedVariable
ui.notifications.message('Show added', 'Adding the specified show into ' + show_dir) ui.notifications.message('Show added', 'Adding the specified show into ' + show_dir)
return finishAddShow() return finishAddShow()
@ -2498,7 +2505,9 @@ class NewHomeAddShows:
sickbeard.STATUS_DEFAULT, sickbeard.STATUS_DEFAULT,
sickbeard.QUALITY_DEFAULT, sickbeard.QUALITY_DEFAULT,
sickbeard.FLATTEN_FOLDERS_DEFAULT, sickbeard.FLATTEN_FOLDERS_DEFAULT,
sickbeard.SUBTITLES_DEFAULT) sickbeard.SUBTITLES_DEFAULT,
sickbeard.ANIME_DEFAULT,
sickbeard.SCENE_DEFAULT)
num_added += 1 num_added += 1
if num_added: if num_added: