Testing fix for redirect issues and blank pages.

Fix for create pid issues.
Fix for creating index on tv provider cache tables.
This commit is contained in:
echel0n 2014-06-28 22:54:29 -07:00
parent ca60203e9e
commit cafdc57b2c
8 changed files with 75 additions and 63 deletions

View file

@ -257,7 +257,7 @@ def main():
sys.exit("PID file: " + sickbeard.PIDFILE + " already exists. Exiting.") sys.exit("PID file: " + sickbeard.PIDFILE + " already exists. Exiting.")
# The pidfile is only useful in daemon mode, make sure we can write the file properly # The pidfile is only useful in daemon mode, make sure we can write the file properly
if sickbeard.CREATEPID: if sickbeard.CREATEPID and not sickbeard.restarted:
if sickbeard.DAEMON: if sickbeard.DAEMON:
pid_dir = os.path.dirname(sickbeard.PIDFILE) pid_dir = os.path.dirname(sickbeard.PIDFILE)
if not os.access(pid_dir, os.F_OK): if not os.access(pid_dir, os.F_OK):

View file

@ -1184,6 +1184,13 @@
<span class="component-desc">Get your key at: <a href="http://trakt.tv/settings/api" rel="noreferrer" onclick="window.open('${sickbeard.ANON_REDIRECT}' + this.href, '_blank'); return false;">http://trakt.tv/settings/api</a></span> <span class="component-desc">Get your key at: <a href="http://trakt.tv/settings/api" rel="noreferrer" onclick="window.open('${sickbeard.ANON_REDIRECT}' + this.href, '_blank'); return false;">http://trakt.tv/settings/api</a></span>
</label> </label>
</div> </div>
<div class="field-pair">
<input type="checkbox" class="enabler" name="trakt_sync" id="trakt_sync" #if $sickbeard.TRAKT_SYNC then "checked=\"checked\"" else ""# />
<label class="clearfix" for="trakt_sync">
<span class="component-title">Sync Libraries:</span>
<span class="component-desc">Syncs SickRage's show library with your trakt.tv show library</span>
</label>
</div>
<div class="field-pair"> <div class="field-pair">
<input type="checkbox" class="enabler" name="trakt_use_recommended" id="trakt_use_recommended" #if $sickbeard.TRAKT_USE_RECOMMENDED then "checked=\"checked\"" else ""# /> <input type="checkbox" class="enabler" name="trakt_use_recommended" id="trakt_use_recommended" #if $sickbeard.TRAKT_USE_RECOMMENDED then "checked=\"checked\"" else ""# />
<label class="clearfix" for="trakt_use_recommended"> <label class="clearfix" for="trakt_use_recommended">

View file

@ -355,6 +355,7 @@ TRAKT_USE_WATCHLIST = False
TRAKT_METHOD_ADD = 0 TRAKT_METHOD_ADD = 0
TRAKT_START_PAUSED = False TRAKT_START_PAUSED = False
TRAKT_USE_RECOMMENDED = False TRAKT_USE_RECOMMENDED = False
TRAKT_SYNC = False
USE_PYTIVO = False USE_PYTIVO = False
PYTIVO_NOTIFY_ONSNATCH = False PYTIVO_NOTIFY_ONSNATCH = False
@ -445,7 +446,7 @@ def initialize(consoleLogging=True):
TORRENT_USERNAME, TORRENT_PASSWORD, TORRENT_HOST, TORRENT_PATH, TORRENT_SEED_TIME, TORRENT_PAUSED, TORRENT_HIGH_BANDWIDTH, TORRENT_LABEL, TORRENT_VERIFY_CERT, \ TORRENT_USERNAME, TORRENT_PASSWORD, TORRENT_HOST, TORRENT_PATH, TORRENT_SEED_TIME, TORRENT_PAUSED, TORRENT_HIGH_BANDWIDTH, TORRENT_LABEL, TORRENT_VERIFY_CERT, \
USE_XBMC, XBMC_ALWAYS_ON, XBMC_NOTIFY_ONSNATCH, XBMC_NOTIFY_ONDOWNLOAD, XBMC_NOTIFY_ONSUBTITLEDOWNLOAD, XBMC_UPDATE_FULL, XBMC_UPDATE_ONLYFIRST, \ USE_XBMC, XBMC_ALWAYS_ON, XBMC_NOTIFY_ONSNATCH, XBMC_NOTIFY_ONDOWNLOAD, XBMC_NOTIFY_ONSUBTITLEDOWNLOAD, XBMC_UPDATE_FULL, XBMC_UPDATE_ONLYFIRST, \
XBMC_UPDATE_LIBRARY, XBMC_HOST, XBMC_USERNAME, XBMC_PASSWORD, BACKLOG_FREQUENCY, \ XBMC_UPDATE_LIBRARY, XBMC_HOST, XBMC_USERNAME, XBMC_PASSWORD, BACKLOG_FREQUENCY, \
USE_TRAKT, TRAKT_USERNAME, TRAKT_PASSWORD, TRAKT_API, TRAKT_REMOVE_WATCHLIST, TRAKT_USE_WATCHLIST, TRAKT_METHOD_ADD, TRAKT_START_PAUSED, traktCheckerScheduler, TRAKT_USE_RECOMMENDED, \ USE_TRAKT, TRAKT_USERNAME, TRAKT_PASSWORD, TRAKT_API, TRAKT_REMOVE_WATCHLIST, TRAKT_USE_WATCHLIST, TRAKT_METHOD_ADD, TRAKT_START_PAUSED, traktCheckerScheduler, TRAKT_USE_RECOMMENDED, TRAKT_SYNC, \
USE_PLEX, PLEX_NOTIFY_ONSNATCH, PLEX_NOTIFY_ONDOWNLOAD, PLEX_NOTIFY_ONSUBTITLEDOWNLOAD, PLEX_UPDATE_LIBRARY, \ USE_PLEX, PLEX_NOTIFY_ONSNATCH, PLEX_NOTIFY_ONDOWNLOAD, PLEX_NOTIFY_ONSUBTITLEDOWNLOAD, PLEX_UPDATE_LIBRARY, \
PLEX_SERVER_HOST, PLEX_HOST, PLEX_USERNAME, PLEX_PASSWORD, DEFAULT_BACKLOG_FREQUENCY, MIN_BACKLOG_FREQUENCY, BACKLOG_STARTUP, SKIP_REMOVED_FILES, \ PLEX_SERVER_HOST, PLEX_HOST, PLEX_USERNAME, PLEX_PASSWORD, DEFAULT_BACKLOG_FREQUENCY, MIN_BACKLOG_FREQUENCY, BACKLOG_STARTUP, SKIP_REMOVED_FILES, \
showUpdateScheduler, __INITIALIZED__, LAUNCH_BROWSER, UPDATE_SHOWS_ON_START, SORT_ARTICLE, showList, loadingShowList, \ showUpdateScheduler, __INITIALIZED__, LAUNCH_BROWSER, UPDATE_SHOWS_ON_START, SORT_ARTICLE, showList, loadingShowList, \
@ -794,6 +795,7 @@ def initialize(consoleLogging=True):
TRAKT_METHOD_ADD = check_setting_str(CFG, 'Trakt', 'trakt_method_add', "0") TRAKT_METHOD_ADD = check_setting_str(CFG, 'Trakt', 'trakt_method_add', "0")
TRAKT_START_PAUSED = bool(check_setting_int(CFG, 'Trakt', 'trakt_start_paused', 0)) TRAKT_START_PAUSED = bool(check_setting_int(CFG, 'Trakt', 'trakt_start_paused', 0))
TRAKT_USE_RECOMMENDED = bool(check_setting_int(CFG, 'Trakt', 'trakt_use_recommended', 0)) TRAKT_USE_RECOMMENDED = bool(check_setting_int(CFG, 'Trakt', 'trakt_use_recommended', 0))
TRAKT_SYNC = bool(check_setting_int(CFG, 'Trakt', 'trakt_sync', 0))
CheckSection(CFG, 'pyTivo') CheckSection(CFG, 'pyTivo')
USE_PYTIVO = bool(check_setting_int(CFG, 'pyTivo', 'use_pytivo', 0)) USE_PYTIVO = bool(check_setting_int(CFG, 'pyTivo', 'use_pytivo', 0))
@ -1668,6 +1670,7 @@ def save_config():
new_config['Trakt']['trakt_method_add'] = TRAKT_METHOD_ADD new_config['Trakt']['trakt_method_add'] = TRAKT_METHOD_ADD
new_config['Trakt']['trakt_start_paused'] = int(TRAKT_START_PAUSED) new_config['Trakt']['trakt_start_paused'] = int(TRAKT_START_PAUSED)
new_config['Trakt']['trakt_use_recommended'] = int(TRAKT_USE_RECOMMENDED) new_config['Trakt']['trakt_use_recommended'] = int(TRAKT_USE_RECOMMENDED)
new_config['Trakt']['trakt_sync'] = int(TRAKT_SYNC)
new_config['pyTivo'] = {} new_config['pyTivo'] = {}
new_config['pyTivo']['use_pytivo'] = int(USE_PYTIVO) new_config['pyTivo']['use_pytivo'] = int(USE_PYTIVO)

View file

@ -390,6 +390,7 @@ class QueueItemAdd(ShowQueueItem):
sickbeard.traktCheckerScheduler.action.manageNewShow(self.show) sickbeard.traktCheckerScheduler.action.manageNewShow(self.show)
# add show to trakt.tv library # add show to trakt.tv library
if sickbeard.TRAKT_SYNC:
sickbeard.traktCheckerScheduler.action.addShowToTraktLibrary(self.show) sickbeard.traktCheckerScheduler.action.addShowToTraktLibrary(self.show)
# Load XEM data to DB for show # Load XEM data to DB for show

View file

@ -44,7 +44,7 @@ class TraktChecker():
self.updateEpisodes() self.updateEpisodes()
# sync trakt.tv library with sickrage library # sync trakt.tv library with sickrage library
if sickbeard.TRAKT_USE_RECOMMENDED: if sickbeard.TRAKT_SYNC:
self.syncLibrary() self.syncLibrary()
def findShow(self, indexerid): def findShow(self, indexerid):

View file

@ -19,6 +19,7 @@
from __future__ import with_statement from __future__ import with_statement
import base64 import base64
import inspect import inspect
import urlparse
import zipfile import zipfile
import os.path import os.path
@ -80,7 +81,6 @@ except ImportError:
from lib import adba from lib import adba
from Cheetah.Template import Template from Cheetah.Template import Template
from tornado import gen
from tornado.web import RequestHandler, HTTPError, asynchronous from tornado.web import RequestHandler, HTTPError, asynchronous
req_headers = None req_headers = None
@ -155,11 +155,11 @@ class MainHandler(RequestHandler):
def http_error_404_handler(self): def http_error_404_handler(self):
""" Custom handler for 404 error, redirect back to main page """ """ Custom handler for 404 error, redirect back to main page """
return self.redirect('/home/') return self.redirectTo('/home/')
def write_error(self, status_code, **kwargs): def write_error(self, status_code, **kwargs):
if status_code == 404: if status_code == 404:
return self.redirect('/home/') return self.redirectTo('/home/')
elif status_code == 401: elif status_code == 401:
self.finish(self.http_error_401_handler()) self.finish(self.http_error_401_handler())
else: else:
@ -208,17 +208,20 @@ class MainHandler(RequestHandler):
raise HTTPError(404) raise HTTPError(404)
def redirect(self, url, permanent=False, status=None): def redirectTo(self, url):
self._transforms = [] self._transforms = []
return super(MainHandler, self).redirect(sickbeard.WEB_ROOT + url, True, 303)
url = urlparse.urljoin(sickbeard.WEB_ROOT, url)
logger.log(u"Redirecting to: " + url, logger.DEBUG)
self.redirect(url, status=303)
def get(self, *args, **kwargs): def get(self, *args, **kwargs):
response = self._dispatch() response = self._dispatch()
self.finish(response) self.finish(response)
def post(self, *args, **kwargs): def post(self, *args, **kwargs):
response = self._dispatch() self._dispatch()
self.finish(response)
def robots_txt(self, *args, **kwargs): def robots_txt(self, *args, **kwargs):
""" Keep web crawlers out """ """ Keep web crawlers out """
@ -260,7 +263,7 @@ class MainHandler(RequestHandler):
sickbeard.HOME_LAYOUT = layout sickbeard.HOME_LAYOUT = layout
return self.redirect("/home/") return self.redirectTo("/home/")
def setHistoryLayout(self, layout): def setHistoryLayout(self, layout):
@ -269,13 +272,13 @@ class MainHandler(RequestHandler):
sickbeard.HISTORY_LAYOUT = layout sickbeard.HISTORY_LAYOUT = layout
return self.redirect("/history/") return self.redirectTo("/history/")
def toggleDisplayShowSpecials(self, show): def toggleDisplayShowSpecials(self, show):
sickbeard.DISPLAY_SHOW_SPECIALS = not sickbeard.DISPLAY_SHOW_SPECIALS sickbeard.DISPLAY_SHOW_SPECIALS = not sickbeard.DISPLAY_SHOW_SPECIALS
return self.redirect("/home/displayShow?show=" + show) return self.redirectTo("/home/displayShow?show=" + show)
def setComingEpsLayout(self, layout): def setComingEpsLayout(self, layout):
if layout not in ('poster', 'banner', 'list'): if layout not in ('poster', 'banner', 'list'):
@ -283,13 +286,13 @@ class MainHandler(RequestHandler):
sickbeard.COMING_EPS_LAYOUT = layout sickbeard.COMING_EPS_LAYOUT = layout
return self.redirect("/comingEpisodes/") return self.redirectTo("/comingEpisodes/")
def toggleComingEpsDisplayPaused(self, *args, **kwargs): def toggleComingEpsDisplayPaused(self, *args, **kwargs):
sickbeard.COMING_EPS_DISPLAY_PAUSED = not sickbeard.COMING_EPS_DISPLAY_PAUSED sickbeard.COMING_EPS_DISPLAY_PAUSED = not sickbeard.COMING_EPS_DISPLAY_PAUSED
return self.redirect("/comingEpisodes/") return self.redirectTo("/comingEpisodes/")
def setComingEpsSort(self, sort): def setComingEpsSort(self, sort):
if sort not in ('date', 'network', 'show'): if sort not in ('date', 'network', 'show'):
@ -297,7 +300,7 @@ class MainHandler(RequestHandler):
sickbeard.COMING_EPS_SORT = sort sickbeard.COMING_EPS_SORT = sort
return self.redirect("/comingEpisodes/") return self.redirectTo("/comingEpisodes/")
def comingEpisodes(self, layout="None"): def comingEpisodes(self, layout="None"):
@ -502,7 +505,7 @@ class IndexerWebUI(MainHandler):
showDirList = "" showDirList = ""
for curShowDir in self.config['_showDir']: for curShowDir in self.config['_showDir']:
showDirList += "showDir=" + curShowDir + "&" showDirList += "showDir=" + curShowDir + "&"
return self.redirect("/home/addShows/addShow?" + showDirList + "seriesList=" + searchList) return self.redirectTo("/home/addShows/addShow?" + showDirList + "seriesList=" + searchList)
def _munge(string): def _munge(string):
@ -581,7 +584,7 @@ class ManageSearches(MainHandler):
logger.log(u"Backlog search forced") logger.log(u"Backlog search forced")
ui.notifications.message('Backlog search started') ui.notifications.message('Backlog search started')
return self.redirect("/manage/manageSearches/") return self.redirectTo("/manage/manageSearches/")
def forceSearch(self, *args, **kwargs): def forceSearch(self, *args, **kwargs):
@ -592,7 +595,7 @@ class ManageSearches(MainHandler):
logger.log(u"Daily search forced") logger.log(u"Daily search forced")
ui.notifications.message('Daily search started') ui.notifications.message('Daily search started')
return self.redirect("/manage/manageSearches/") return self.redirectTo("/manage/manageSearches/")
def forceFindPropers(self, *args, **kwargs): def forceFindPropers(self, *args, **kwargs):
@ -603,7 +606,7 @@ class ManageSearches(MainHandler):
logger.log(u"Find propers search forced") logger.log(u"Find propers search forced")
ui.notifications.message('Find propers search started') ui.notifications.message('Find propers search started')
return self.redirect("/manage/manageSearches/") return self.redirectTo("/manage/manageSearches/")
def pauseBacklog(self, paused=None): def pauseBacklog(self, paused=None):
@ -612,7 +615,7 @@ class ManageSearches(MainHandler):
else: else:
sickbeard.searchQueueScheduler.action.unpause_backlog() # @UndefinedVariable sickbeard.searchQueueScheduler.action.unpause_backlog() # @UndefinedVariable
return self.redirect("/manage/manageSearches/") return self.redirectTo("/manage/manageSearches/")
class Manage(MainHandler): class Manage(MainHandler):
@ -726,7 +729,7 @@ class Manage(MainHandler):
Home(self.application, self.request).setStatus(cur_indexer_id, '|'.join(to_change[cur_indexer_id]), Home(self.application, self.request).setStatus(cur_indexer_id, '|'.join(to_change[cur_indexer_id]),
newStatus, direct=True) newStatus, direct=True)
return self.redirect('/manage/episodeStatuses/') return self.redirectTo('/manage/episodeStatuses/')
def showSubtitleMissed(self, indexer_id, whichSubs): def showSubtitleMissed(self, indexer_id, whichSubs):
@ -834,7 +837,7 @@ class Manage(MainHandler):
show = sickbeard.helpers.findCertainShow(sickbeard.showList, int(cur_indexer_id)) show = sickbeard.helpers.findCertainShow(sickbeard.showList, int(cur_indexer_id))
subtitles = show.getEpisode(int(season), int(episode)).downloadSubtitles() subtitles = show.getEpisode(int(season), int(episode)).downloadSubtitles()
return self.redirect('/manage/subtitleMissed/') return self.redirectTo('/manage/subtitleMissed/')
def backlogShow(self, indexer_id): def backlogShow(self, indexer_id):
@ -844,7 +847,7 @@ class Manage(MainHandler):
if show_obj: if show_obj:
sickbeard.backlogSearchScheduler.action.searchBacklog([show_obj]) # @UndefinedVariable sickbeard.backlogSearchScheduler.action.searchBacklog([show_obj]) # @UndefinedVariable
return self.redirect("/manage/backlogOverview/") return self.redirectTo("/manage/backlogOverview/")
def backlogOverview(self, *args, **kwargs): def backlogOverview(self, *args, **kwargs):
@ -895,7 +898,7 @@ class Manage(MainHandler):
t.submenu = ManageMenu() t.submenu = ManageMenu()
if not toEdit: if not toEdit:
return self.redirect("/manage/") return self.redirectTo("/manage/")
showIDs = toEdit.split("|") showIDs = toEdit.split("|")
showList = [] showList = []
@ -1062,7 +1065,7 @@ class Manage(MainHandler):
ui.notifications.error('%d error%s while saving changes:' % (len(errors), "" if len(errors) == 1 else "s"), ui.notifications.error('%d error%s while saving changes:' % (len(errors), "" if len(errors) == 1 else "s"),
" ".join(errors)) " ".join(errors))
return self.redirect("/manage/") return self.redirectTo("/manage/")
def massUpdate(self, toUpdate=None, toRefresh=None, toRename=None, toDelete=None, toMetadata=None, toSubtitle=None): def massUpdate(self, toUpdate=None, toRefresh=None, toRename=None, toDelete=None, toMetadata=None, toSubtitle=None):
@ -1171,7 +1174,7 @@ class Manage(MainHandler):
ui.notifications.message("The following actions were queued:", ui.notifications.message("The following actions were queued:",
messageDetail) messageDetail)
return self.redirect("/manage/") return self.redirectTo("/manage/")
def manageTorrents(self, *args, **kwargs): def manageTorrents(self, *args, **kwargs):
@ -1215,7 +1218,7 @@ class Manage(MainHandler):
myDB.action('DELETE FROM failed WHERE release = ?', [release]) myDB.action('DELETE FROM failed WHERE release = ?', [release])
if toRemove: if toRemove:
raise self.redirect('/manage/failedDownloads/') raise self.redirectTo('/manage/failedDownloads/')
t = PageTemplate(file="manage_failedDownloads.tmpl") t = PageTemplate(file="manage_failedDownloads.tmpl")
t.failedResults = sqlResults t.failedResults = sqlResults
@ -1303,7 +1306,7 @@ class History(MainHandler):
myDB.action("DELETE FROM history WHERE 1=1") myDB.action("DELETE FROM history WHERE 1=1")
ui.notifications.message('History cleared') ui.notifications.message('History cleared')
return self.redirect("/history/") return self.redirectTo("/history/")
def trimHistory(self, *args, **kwargs): def trimHistory(self, *args, **kwargs):
@ -1313,7 +1316,7 @@ class History(MainHandler):
(datetime.datetime.today() - datetime.timedelta(days=30)).strftime(history.dateFormat))) (datetime.datetime.today() - datetime.timedelta(days=30)).strftime(history.dateFormat)))
ui.notifications.message('Removed history entries greater than 30 days old') ui.notifications.message('Removed history entries greater than 30 days old')
return self.redirect("/history/") return self.redirectTo("/history/")
ConfigMenu = [ ConfigMenu = [
@ -2177,7 +2180,7 @@ class ConfigNotifications(MainHandler):
use_nmjv2=None, nmjv2_host=None, nmjv2_dbloc=None, nmjv2_database=None, use_nmjv2=None, nmjv2_host=None, nmjv2_dbloc=None, nmjv2_database=None,
use_trakt=None, trakt_username=None, trakt_password=None, trakt_api=None, use_trakt=None, trakt_username=None, trakt_password=None, trakt_api=None,
trakt_remove_watchlist=None, trakt_use_watchlist=None, trakt_method_add=None, trakt_remove_watchlist=None, trakt_use_watchlist=None, trakt_method_add=None,
trakt_start_paused=None, trakt_use_recommended=None, trakt_start_paused=None, trakt_use_recommended=None, trakt_sync=None,
use_synologynotifier=None, synologynotifier_notify_onsnatch=None, use_synologynotifier=None, synologynotifier_notify_onsnatch=None,
synologynotifier_notify_ondownload=None, synologynotifier_notify_onsubtitledownload=None, synologynotifier_notify_ondownload=None, synologynotifier_notify_onsubtitledownload=None,
use_pytivo=None, pytivo_notify_onsnatch=None, pytivo_notify_ondownload=None, use_pytivo=None, pytivo_notify_onsnatch=None, pytivo_notify_ondownload=None,
@ -2289,6 +2292,7 @@ class ConfigNotifications(MainHandler):
sickbeard.TRAKT_METHOD_ADD = trakt_method_add sickbeard.TRAKT_METHOD_ADD = trakt_method_add
sickbeard.TRAKT_START_PAUSED = config.checkbox_to_value(trakt_start_paused) sickbeard.TRAKT_START_PAUSED = config.checkbox_to_value(trakt_start_paused)
sickbeard.TRAKT_USE_RECOMMENDED = config.checkbox_to_value(trakt_use_recommended) sickbeard.TRAKT_USE_RECOMMENDED = config.checkbox_to_value(trakt_use_recommended)
sickbeard.TRAKT_SYNC = config.checkbox_to_value(trakt_sync)
if sickbeard.USE_TRAKT: if sickbeard.USE_TRAKT:
sickbeard.traktCheckerScheduler.silent = False sickbeard.traktCheckerScheduler.silent = False
@ -2510,7 +2514,7 @@ class HomePostProcess(MainHandler):
if sickbeard.versionCheckScheduler.action.check_for_new_version(force=True): if sickbeard.versionCheckScheduler.action.check_for_new_version(force=True):
logger.log(u"Forcing version check") logger.log(u"Forcing version check")
return self.redirect("/home/") return self.redirectTo("/home/")
def processEpisode(self, dir=None, nzbName=None, jobName=None, quiet=None, process_method=None, force=None, def processEpisode(self, dir=None, nzbName=None, jobName=None, quiet=None, process_method=None, force=None,
is_priority=None, failed="0", type="auto"): is_priority=None, failed="0", type="auto"):
@ -2531,7 +2535,7 @@ class HomePostProcess(MainHandler):
is_priority = False is_priority = False
if not dir: if not dir:
return self.redirect("/home/postprocess/") return self.redirectTo("/home/postprocess/")
else: else:
result = processTV.processDir(dir, nzbName, process_method=process_method, force=force, result = processTV.processDir(dir, nzbName, process_method=process_method, force=force,
is_priority=is_priority, failed=failed, type=type) is_priority=is_priority, failed=failed, type=type)
@ -2761,16 +2765,13 @@ class NewHomeAddShows(MainHandler):
show_url = whichSeries.split('|')[1] show_url = whichSeries.split('|')[1]
indexer_id = whichSeries.split('|')[0] indexer_id = whichSeries.split('|')[0]
show_name = whichSeries.split('|')[2] show_name = whichSeries.split('|')[2]
first_aired = whichSeries.split('|')[4]
self.addNewShow('|'.join([indexer_name, str(indexer), show_url, indexer_id, show_name, first_aired]), return self.addNewShow('|'.join([indexer_name, str(indexer), show_url, indexer_id, show_name, ""]),
indexerLang, rootDir, indexerLang, rootDir,
defaultStatus, defaultStatus,
anyQualities, bestQualities, flatten_folders, subtitles, fullShowPath, other_shows, anyQualities, bestQualities, flatten_folders, subtitles, fullShowPath, other_shows,
skipShow, providedIndexer, anime, scene) skipShow, providedIndexer, anime, scene)
return self.redirect('/home/')
def existingShows(self, *args, **kwargs): def existingShows(self, *args, **kwargs):
""" """
Prints out the page to add existing shows from a root dir Prints out the page to add existing shows from a root dir
@ -2799,7 +2800,7 @@ class NewHomeAddShows(MainHandler):
def finishAddShow(): def finishAddShow():
# if there are no extra shows then go home # if there are no extra shows then go home
if not other_shows: if not other_shows:
return self.redirect('/home/') return self.redirectTo('/home/')
# peel off the next one # peel off the next one
next_show_dir = other_shows[0] next_show_dir = other_shows[0]
@ -2824,7 +2825,7 @@ class NewHomeAddShows(MainHandler):
logger.log("Unable to add show due to show selection. Not anough arguments: %s" % (repr(series_pieces)), logger.log("Unable to add show due to show selection. Not anough arguments: %s" % (repr(series_pieces)),
logger.ERROR) logger.ERROR)
ui.notifications.error("Unknown error. Unable to add show due to problem with show selection.") ui.notifications.error("Unknown error. Unable to add show due to problem with show selection.")
return self.redirect('/home/addShows/existingShows/') return self.redirectTo('/home/addShows/existingShows/')
indexer = int(series_pieces[1]) indexer = int(series_pieces[1])
indexer_id = int(series_pieces[3]) indexer_id = int(series_pieces[3])
show_name = series_pieces[4] show_name = series_pieces[4]
@ -2846,7 +2847,7 @@ class NewHomeAddShows(MainHandler):
# blanket policy - if the dir exists you should have used "add existing show" numbnuts # blanket policy - if the dir exists you should have used "add existing show" numbnuts
if ek.ek(os.path.isdir, show_dir) and not fullShowPath: if ek.ek(os.path.isdir, show_dir) and not fullShowPath:
ui.notifications.error("Unable to add show", "Folder " + show_dir + " exists already") ui.notifications.error("Unable to add show", "Folder " + show_dir + " exists already")
return self.redirect('/home/addShows/existingShows/') return self.redirectTo('/home/addShows/existingShows/')
# don't create show dir if config says not to # don't create show dir if config says not to
if sickbeard.ADD_SHOWS_WO_DIR: if sickbeard.ADD_SHOWS_WO_DIR:
@ -2857,7 +2858,7 @@ class NewHomeAddShows(MainHandler):
logger.log(u"Unable to create the folder " + show_dir + ", can't add the show", logger.ERROR) logger.log(u"Unable to create the folder " + show_dir + ", can't add the show", logger.ERROR)
ui.notifications.error("Unable to add show", ui.notifications.error("Unable to add show",
"Unable to create the folder " + show_dir + ", can't add the show") "Unable to create the folder " + show_dir + ", can't add the show")
return self.redirect("/home/") return self.redirectTo("/home/")
else: else:
helpers.chmodAsParent(show_dir) helpers.chmodAsParent(show_dir)
@ -2962,7 +2963,7 @@ class NewHomeAddShows(MainHandler):
# if we're done then go home # if we're done then go home
if not dirs_only: if not dirs_only:
return self.redirect('/home/') return self.redirectTo('/home/')
# for the remaining shows we need to prompt for each one, so forward this on to the newShow page # for the remaining shows we need to prompt for each one, so forward this on to the newShow page
return self.newShow(dirs_only[0], dirs_only[1:]) return self.newShow(dirs_only[0], dirs_only[1:])
@ -2985,7 +2986,7 @@ class ErrorLogs(MainHandler):
def clearerrors(self, *args, **kwargs): def clearerrors(self, *args, **kwargs):
classes.ErrorViewer.clear() classes.ErrorViewer.clear()
return self.redirect("/errorlogs/") return self.redirectTo("/errorlogs/")
def viewlog(self, minLevel=logger.MESSAGE, maxLines=500): def viewlog(self, minLevel=logger.MESSAGE, maxLines=500):
@ -3356,7 +3357,7 @@ class Home(MainHandler):
def shutdown(self, pid=None): def shutdown(self, pid=None):
if str(pid) != str(sickbeard.PID): if str(pid) != str(sickbeard.PID):
return self.redirect("/home/") return self.redirectTo("/home/")
threading.Timer(2, sickbeard.invoke_shutdown).start() threading.Timer(2, sickbeard.invoke_shutdown).start()
@ -3368,7 +3369,7 @@ class Home(MainHandler):
def restart(self, pid=None): def restart(self, pid=None):
if str(pid) != str(sickbeard.PID): if str(pid) != str(sickbeard.PID):
return self.redirect("/home/") return self.redirectTo("/home/")
t = PageTemplate(file="restart.tmpl") t = PageTemplate(file="restart.tmpl")
t.submenu = HomeMenu() t.submenu = HomeMenu()
@ -3382,7 +3383,7 @@ class Home(MainHandler):
def update(self, pid=None): def update(self, pid=None):
if str(pid) != str(sickbeard.PID): if str(pid) != str(sickbeard.PID):
return self.redirect("/home/") return self.redirectTo("/home/")
updated = sickbeard.versionCheckScheduler.action.update() # @UndefinedVariable updated = sickbeard.versionCheckScheduler.action.update() # @UndefinedVariable
if updated: if updated:
@ -3803,7 +3804,7 @@ class Home(MainHandler):
ui.notifications.error('%d error%s while saving changes:' % (len(errors), "" if len(errors) == 1 else "s"), ui.notifications.error('%d error%s while saving changes:' % (len(errors), "" if len(errors) == 1 else "s"),
'<ul>' + '\n'.join(['<li>%s</li>' % error for error in errors]) + "</ul>") '<ul>' + '\n'.join(['<li>%s</li>' % error for error in errors]) + "</ul>")
return self.redirect("/home/displayShow?show=" + show) return self.redirectTo("/home/displayShow?show=" + show)
def deleteShow(self, show=None): def deleteShow(self, show=None):
@ -3820,14 +3821,14 @@ class Home(MainHandler):
showObj) or sickbeard.showQueueScheduler.action.isBeingUpdated(showObj): # @UndefinedVariable showObj) or sickbeard.showQueueScheduler.action.isBeingUpdated(showObj): # @UndefinedVariable
return _genericMessage("Error", "Shows can't be deleted while they're being added or updated.") return _genericMessage("Error", "Shows can't be deleted while they're being added or updated.")
if sickbeard.USE_TRAKT: if sickbeard.USE_TRAKT and sickbeard.TRAKT_SYNC:
# remove show from trakt.tv library # remove show from trakt.tv library
sickbeard.traktCheckerScheduler.action.removeShowFromTraktLibrary(showObj) sickbeard.traktCheckerScheduler.action.removeShowFromTraktLibrary(showObj)
showObj.deleteShow() showObj.deleteShow()
ui.notifications.message('<b>%s</b> has been deleted' % showObj.name) ui.notifications.message('<b>%s</b> has been deleted' % showObj.name)
return self.redirect("/home/") return self.redirectTo("/home/")
def refreshShow(self, show=None): def refreshShow(self, show=None):
@ -3849,7 +3850,7 @@ class Home(MainHandler):
time.sleep(cpu_presets[sickbeard.CPU_PRESET]) time.sleep(cpu_presets[sickbeard.CPU_PRESET])
return self.redirect("/home/displayShow?show=" + str(showObj.indexerid)) return self.redirectTo("/home/displayShow?show=" + str(showObj.indexerid))
def updateShow(self, show=None, force=0): def updateShow(self, show=None, force=0):
@ -3872,7 +3873,7 @@ class Home(MainHandler):
# just give it some time # just give it some time
time.sleep(cpu_presets[sickbeard.CPU_PRESET]) time.sleep(cpu_presets[sickbeard.CPU_PRESET])
return self.redirect("/home/displayShow?show=" + str(showObj.indexerid)) return self.redirectTo("/home/displayShow?show=" + str(showObj.indexerid))
def subtitleShow(self, show=None, force=0): def subtitleShow(self, show=None, force=0):
@ -3890,7 +3891,7 @@ class Home(MainHandler):
time.sleep(cpu_presets[sickbeard.CPU_PRESET]) time.sleep(cpu_presets[sickbeard.CPU_PRESET])
return self.redirect("/home/displayShow?show=" + str(showObj.indexerid)) return self.redirectTo("/home/displayShow?show=" + str(showObj.indexerid))
def updateXBMC(self, showName=None): def updateXBMC(self, showName=None):
@ -3906,7 +3907,7 @@ class Home(MainHandler):
ui.notifications.message("Library update command sent to XBMC host(s): " + host) ui.notifications.message("Library update command sent to XBMC host(s): " + host)
else: else:
ui.notifications.error("Unable to contact one or more XBMC host(s): " + host) ui.notifications.error("Unable to contact one or more XBMC host(s): " + host)
return self.redirect('/home/') return self.redirectTo('/home/')
def updatePLEX(self, *args, **kwargs): def updatePLEX(self, *args, **kwargs):
@ -3915,7 +3916,7 @@ class Home(MainHandler):
"Library update command sent to Plex Media Server host: " + sickbeard.PLEX_SERVER_HOST) "Library update command sent to Plex Media Server host: " + sickbeard.PLEX_SERVER_HOST)
else: else:
ui.notifications.error("Unable to contact Plex Media Server host: " + sickbeard.PLEX_SERVER_HOST) ui.notifications.error("Unable to contact Plex Media Server host: " + sickbeard.PLEX_SERVER_HOST)
return self.redirect('/home/') return self.redirectTo('/home/')
def setStatus(self, show=None, eps=None, status=None, direct=False): def setStatus(self, show=None, eps=None, status=None, direct=False):
@ -4029,7 +4030,7 @@ class Home(MainHandler):
if direct: if direct:
return json.dumps({'result': 'success'}) return json.dumps({'result': 'success'})
else: else:
return self.redirect("/home/displayShow?show=" + show) return self.redirectTo("/home/displayShow?show=" + show)
def testRename(self, show=None): def testRename(self, show=None):
@ -4096,7 +4097,7 @@ class Home(MainHandler):
return _genericMessage("Error", "Can't rename episodes when the show dir is missing.") return _genericMessage("Error", "Can't rename episodes when the show dir is missing.")
if eps is None: if eps is None:
return self.redirect("/home/displayShow?show=" + show) return self.redirectTo("/home/displayShow?show=" + show)
myDB = db.DBConnection() myDB = db.DBConnection()
for curEp in eps.split('|'): for curEp in eps.split('|'):
@ -4123,7 +4124,7 @@ class Home(MainHandler):
root_ep_obj.rename() root_ep_obj.rename()
return self.redirect("/home/displayShow?show=" + show) return self.redirectTo("/home/displayShow?show=" + show)
def searchEpisode(self, show=None, season=None, episode=None): def searchEpisode(self, show=None, season=None, episode=None):

View file

@ -1558,7 +1558,7 @@ def removeslash(method):
if uri: # don't try to redirect '/' to '' if uri: # don't try to redirect '/' to ''
if self.request.query: if self.request.query:
uri += "?" + self.request.query uri += "?" + self.request.query
self.redirect(uri, permanent=True) self.redirectTo(uri, permanent=True)
return return
else: else:
raise HTTPError(404) raise HTTPError(404)
@ -1580,7 +1580,7 @@ def addslash(method):
uri = self.request.path + "/" uri = self.request.path + "/"
if self.request.query: if self.request.query:
uri += "?" + self.request.query uri += "?" + self.request.query
self.redirect(uri, permanent=True) self.redirectTo(uri, permanent=True)
return return
raise HTTPError(404) raise HTTPError(404)
return method(self, *args, **kwargs) return method(self, *args, **kwargs)
@ -2587,7 +2587,7 @@ def authenticated(method):
else: else:
next_url = self.request.uri next_url = self.request.uri
url += "?" + urlencode(dict(next=next_url)) url += "?" + urlencode(dict(next=next_url))
self.redirect(url) self.redirectTo(url)
return return
raise HTTPError(403) raise HTTPError(403)
return method(self, *args, **kwargs) return method(self, *args, **kwargs)