1
0
mirror of https://github.com/moparisthebest/SickRage synced 2024-12-13 11:32:20 -05:00

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>
</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 global $anyQualities = $qualities[0]
#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>
</ul>
</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>
</div>

View File

@ -3,15 +3,23 @@ $(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()); });
$('#anyQualities option:selected').each(function (i, d) {
anyQualArray.push($(d).val());
});
$('#bestQualities option:selected').each(function (i, d) {
bestQualArray.push($(d).val());
});
$.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')
});
$.get(sbRoot + '/config/general/saveAddShowDefaults', {defaultStatus: $('#statusSelect').val(),
anyQualities: anyQualArray.join(','),
bestQualities: bestQualArray.join(','),
defaultFlattenFolders: $('#flatten_folders').prop('checked'),
subtitles: $('#subtitles').prop('checked') });
$(this).attr('disabled', true);
$.pnotify({
pnotify_title: 'Saved Defaults',
@ -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);
});

View File

@ -161,6 +161,7 @@ FLATTEN_FOLDERS_DEFAULT = None
SUBTITLES_DEFAULT = None
INDEXER_DEFAULT = None
INDEXER_TIMEOUT = None
SCENE_DEFAULT = None
ANIME_DEFAULT = None
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, \
AUTOPOSTPROCESSER_FREQUENCY, DEFAULT_AUTOPOSTPROCESSER_FREQUENCY, MIN_AUTOPOSTPROCESSER_FREQUENCY, \
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__:
return False
@ -589,6 +590,7 @@ def initialize(consoleLogging=True):
INDEXER_DEFAULT = check_setting_int(CFG, 'General', 'indexer_default', 0)
INDEXER_TIMEOUT = check_setting_int(CFG, 'General', 'indexer_timeout', 10)
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()
@ -1410,6 +1412,7 @@ def save_config():
new_config['General']['indexer_default'] = int(INDEXER_DEFAULT)
new_config['General']['indexer_timeout'] = int(INDEXER_TIMEOUT)
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']['version_notify'] = int(VERSION_NOTIFY)
new_config['General']['auto_update'] = int(AUTO_UPDATE)

View File

@ -132,9 +132,9 @@ class ShowQueue(generic_queue.GenericQueue):
return queueItemObj
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,
subtitles, anime)
subtitles, anime, scene)
self.add_item(queueItemObj)
@ -189,7 +189,7 @@ class ShowQueueItem(generic_queue.QueueItem):
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_id = indexer_id
@ -200,6 +200,7 @@ class QueueItemAdd(ShowQueueItem):
self.lang = lang
self.subtitles = subtitles
self.anime = anime
self.scene = scene
self.show = None
@ -285,6 +286,7 @@ class QueueItemAdd(ShowQueueItem):
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.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
# be smartish about this
@ -294,8 +296,6 @@ class QueueItemAdd(ShowQueueItem):
self.show.air_by_date = 0
if self.show.classification and "sports" in self.show.classification.lower():
self.show.sports = 1
#if self.show.genre and "animation" in self.show.genre.lower():
# self.show.anime = 1
except sickbeard.indexer_exception, e:
logger.log(
@ -385,7 +385,7 @@ class QueueItemAdd(ShowQueueItem):
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.
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.finish()

View File

@ -990,7 +990,8 @@ class ConfigGeneral:
sickbeard.ROOT_DIRS = rootDirString
@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:
anyQualities = anyQualities.split(',')
@ -1010,7 +1011,8 @@ class ConfigGeneral:
sickbeard.FLATTEN_FOLDERS_DEFAULT = config.checkbox_to_value(defaultFlattenFolders)
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()
@ -2336,7 +2338,8 @@ class NewHomeAddShows:
@cherrypy.expose
def addNewShow(self, whichSeries=None, indexerLang="en", rootDir=None, defaultStatus=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
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])
show_name = series_pieces[4]
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_id = int(whichSeries)
show_name = os.path.basename(os.path.normpath(fullShowPath))
@ -2410,11 +2417,11 @@ class NewHomeAddShows:
helpers.chmodAsParent(show_dir)
# prepare the inputs for passing along
scene = config.checkbox_to_value(scene)
anime = config.checkbox_to_value(anime)
flatten_folders = config.checkbox_to_value(flatten_folders)
subtitles = config.checkbox_to_value(subtitles)
if not anyQualities:
anyQualities = []
if not bestQualities:
@ -2427,7 +2434,7 @@ class NewHomeAddShows:
# add the show
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)
return finishAddShow()
@ -2498,7 +2505,9 @@ class NewHomeAddShows:
sickbeard.STATUS_DEFAULT,
sickbeard.QUALITY_DEFAULT,
sickbeard.FLATTEN_FOLDERS_DEFAULT,
sickbeard.SUBTITLES_DEFAULT)
sickbeard.SUBTITLES_DEFAULT,
sickbeard.ANIME_DEFAULT,
sickbeard.SCENE_DEFAULT)
num_added += 1
if num_added: