From 10bea520a7ecddde9f1326da81e82b07e9909ee5 Mon Sep 17 00:00:00 2001 From: echel0n Date: Tue, 24 Jun 2014 16:40:13 -0700 Subject: [PATCH] Fixed backup/restore issues, uses correct data directory variable now. --- SickBeard.py | 16 ++++++++-------- sickbeard/webserve.py | 4 ++-- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/SickBeard.py b/SickBeard.py index e811e542..96c7d793 100755 --- a/SickBeard.py +++ b/SickBeard.py @@ -270,14 +270,6 @@ def main(): sickbeard.CREATEPID = False - # Check if we need to perform a restore first - restoreDir = os.path.join(sickbeard.PROG_DIR, 'restore') - if os.path.exists(restoreDir): - if restore(restoreDir, sickbeard.PROG_DIR): - logger.log(u"Restore successful...") - else: - logger.log(u"Restore FAILED!", logger.ERROR) - # If they don't specify a config file then put it in the data dir if not sickbeard.CONFIG_FILE: sickbeard.CONFIG_FILE = os.path.join(sickbeard.DATA_DIR, "config.ini") @@ -300,6 +292,14 @@ def main(): elif not os.access(os.path.dirname(sickbeard.CONFIG_FILE), os.W_OK): raise SystemExit("Config file root dir '" + os.path.dirname(sickbeard.CONFIG_FILE) + "' must be writeable.") + # Check if we need to perform a restore first + restoreDir = os.path.join(sickbeard.DATA_DIR, 'restore') + if os.path.exists(restoreDir): + if restore(restoreDir, sickbeard.DATA_DIR): + logger.log(u"Restore successful...") + else: + logger.log(u"Restore FAILED!", logger.ERROR) + os.chdir(sickbeard.DATA_DIR) if consoleLogging: diff --git a/sickbeard/webserve.py b/sickbeard/webserve.py index 261f08de..faeb1e0e 100644 --- a/sickbeard/webserve.py +++ b/sickbeard/webserve.py @@ -1483,7 +1483,7 @@ class ConfigBackupRestore(MainHandler): finalResult = '' if backupDir: - source = [os.path.join(sickbeard.PROG_DIR, 'sickbeard.db'), os.path.join(sickbeard.PROG_DIR, 'config.ini')] + source = [os.path.join(sickbeard.DATA_DIR, 'sickbeard.db'), os.path.join(sickbeard.DATA_DIR, 'config.ini')] target = os.path.join(backupDir, 'sickrage-' + time.strftime('%Y%m%d%H%M%S') + '.zip') if helpers.makeZip(source, target): @@ -1505,7 +1505,7 @@ class ConfigBackupRestore(MainHandler): if backupFile: source = backupFile - target_dir = os.path.join(sickbeard.PROG_DIR, 'restore') + target_dir = os.path.join(sickbeard.DATA_DIR, 'restore') if helpers.extractZip(source, target_dir): finalResult += "Successfully extracted restore files to " + target_dir