mirror of
https://github.com/SickGear/SickGear.git
synced 2024-12-01 08:53:37 +00:00
Merge remote-tracking branch 'origin/dev'
This commit is contained in:
commit
78b0a07e7d
3 changed files with 14 additions and 12 deletions
16
SickBeard.py
16
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:
|
||||
|
|
|
@ -1170,7 +1170,8 @@ def makeZip(fileList, archive):
|
|||
a.write(f)
|
||||
a.close()
|
||||
return True
|
||||
except:
|
||||
except Exception as e:
|
||||
logger.log(u"Zip creation error: " + str(e), logger.ERROR)
|
||||
return False
|
||||
|
||||
|
||||
|
@ -1198,5 +1199,6 @@ def extractZip(archive, targetDir):
|
|||
target.close()
|
||||
zip_file.close()
|
||||
return True
|
||||
except:
|
||||
except Exception as e:
|
||||
logger.log(u"Zip extraction error: " + str(e), logger.ERROR)
|
||||
return False
|
|
@ -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'), sickbeard.CONFIG_FILE]
|
||||
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
|
||||
|
|
Loading…
Reference in a new issue