mirror of
https://github.com/robweber/xbmcbackup.git
synced 2024-11-15 04:45:49 +01:00
pep8 styling round 2
This commit is contained in:
parent
3e9de429dd
commit
95649c2b3f
@ -4,6 +4,7 @@ import xbmcgui
|
|||||||
import xbmcvfs
|
import xbmcvfs
|
||||||
from . import utils as utils
|
from . import utils as utils
|
||||||
|
|
||||||
|
|
||||||
class BackupSetManager:
|
class BackupSetManager:
|
||||||
jsonFile = xbmc.translatePath(utils.data_dir() + "custom_paths.json")
|
jsonFile = xbmc.translatePath(utils.data_dir() + "custom_paths.json")
|
||||||
paths = None
|
paths = None
|
||||||
@ -44,7 +45,7 @@ class BackupSetManager:
|
|||||||
return keys
|
return keys
|
||||||
|
|
||||||
def getSet(self, index):
|
def getSet(self, index):
|
||||||
keys = self.getSets();
|
keys = self.getSets()
|
||||||
|
|
||||||
# return the set at this index
|
# return the set at this index
|
||||||
return {'name': keys[index], 'set': self.paths[keys[index]]}
|
return {'name': keys[index], 'set': self.paths[keys[index]]}
|
||||||
@ -89,7 +90,7 @@ class AdvancedBackupEditor:
|
|||||||
|
|
||||||
name = self.dialog.input(utils.getString(30110), defaultt='Backup Set')
|
name = self.dialog.input(utils.getString(30110), defaultt='Backup Set')
|
||||||
|
|
||||||
if(name != None):
|
if(name is not None):
|
||||||
|
|
||||||
# give a choice to start in home or enter a root path
|
# give a choice to start in home or enter a root path
|
||||||
enterHome = self.dialog.yesno(utils.getString(30111), line1=utils.getString(30112) + " - " + utils.getString(30114), line2=utils.getString(30113) + " - " + utils.getString(30115), nolabel=utils.getString(30112), yeslabel=utils.getString(30113))
|
enterHome = self.dialog.yesno(utils.getString(30111), line1=utils.getString(30112) + " - " + utils.getString(30114), line2=utils.getString(30113) + " - " + utils.getString(30115), nolabel=utils.getString(30112), yeslabel=utils.getString(30113))
|
||||||
@ -223,5 +224,3 @@ class AdvancedBackupEditor:
|
|||||||
dest = xbmc.translatePath(utils.data_dir() + "/custom_paths.json")
|
dest = xbmc.translatePath(utils.data_dir() + "/custom_paths.json")
|
||||||
|
|
||||||
xbmcvfs.copy(source, dest)
|
xbmcvfs.copy(source, dest)
|
||||||
|
|
||||||
|
|
||||||
|
@ -10,6 +10,7 @@ try:
|
|||||||
except ImportError:
|
except ImportError:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
class DropboxAuthorizer:
|
class DropboxAuthorizer:
|
||||||
APP_KEY = ""
|
APP_KEY = ""
|
||||||
APP_SECRET = ""
|
APP_SECRET = ""
|
||||||
|
@ -19,6 +19,7 @@ def folderSort(aKey):
|
|||||||
|
|
||||||
return result
|
return result
|
||||||
|
|
||||||
|
|
||||||
class XbmcBackup:
|
class XbmcBackup:
|
||||||
# constants for initiating a back or restore
|
# constants for initiating a back or restore
|
||||||
Backup = 0
|
Backup = 0
|
||||||
@ -51,7 +52,7 @@ class XbmcBackup:
|
|||||||
|
|
||||||
def configureRemote(self):
|
def configureRemote(self):
|
||||||
if(utils.getSetting('remote_selection') == '1'):
|
if(utils.getSetting('remote_selection') == '1'):
|
||||||
self.remote_base_path = utils.getSetting('remote_path_2');
|
self.remote_base_path = utils.getSetting('remote_path_2')
|
||||||
self.remote_vfs = XBMCFileSystem(utils.getSetting('remote_path_2'))
|
self.remote_vfs = XBMCFileSystem(utils.getSetting('remote_path_2'))
|
||||||
utils.setSetting("remote_path", "")
|
utils.setSetting("remote_path", "")
|
||||||
elif(utils.getSetting('remote_selection') == '0'):
|
elif(utils.getSetting('remote_selection') == '0'):
|
||||||
@ -280,12 +281,12 @@ class XbmcBackup:
|
|||||||
restoreSets = [n['name'] for n in valFile['directories']]
|
restoreSets = [n['name'] for n in valFile['directories']]
|
||||||
|
|
||||||
# if passed in list, skip selection
|
# if passed in list, skip selection
|
||||||
if(selectedSets == None):
|
if(selectedSets is None):
|
||||||
selectedSets = xbmcgui.Dialog().multiselect(utils.getString(30131), restoreSets)
|
selectedSets = xbmcgui.Dialog().multiselect(utils.getString(30131), restoreSets)
|
||||||
else:
|
else:
|
||||||
selectedSets = [restoreSets.index(n) for n in selectedSets if n in restoreSets] # if set name not found just skip it
|
selectedSets = [restoreSets.index(n) for n in selectedSets if n in restoreSets] # if set name not found just skip it
|
||||||
|
|
||||||
if(selectedSets != None):
|
if(selectedSets is not None):
|
||||||
# go through each of the directories in the backup and write them to the correct location
|
# go through each of the directories in the backup and write them to the correct location
|
||||||
for index in selectedSets:
|
for index in selectedSets:
|
||||||
|
|
||||||
@ -357,7 +358,6 @@ class XbmcBackup:
|
|||||||
utils.log(utils.getString(30047) + ": " + self.xbmc_vfs.root_path)
|
utils.log(utils.getString(30047) + ": " + self.xbmc_vfs.root_path)
|
||||||
utils.log(utils.getString(30048) + ": " + self.remote_vfs.root_path)
|
utils.log(utils.getString(30048) + ": " + self.remote_vfs.root_path)
|
||||||
|
|
||||||
|
|
||||||
# setup the progress bar
|
# setup the progress bar
|
||||||
self.progressBar = BackupProgressBar(progressOverride)
|
self.progressBar = BackupProgressBar(progressOverride)
|
||||||
self.progressBar.create(progressBarTitle, utils.getString(30049) + "......")
|
self.progressBar.create(progressBarTitle, utils.getString(30049) + "......")
|
||||||
@ -531,6 +531,7 @@ class XbmcBackup:
|
|||||||
jFile.close()
|
jFile.close()
|
||||||
return json.loads(jsonString)
|
return json.loads(jsonString)
|
||||||
|
|
||||||
|
|
||||||
class FileManager:
|
class FileManager:
|
||||||
not_dir = ['.zip', '.xsp', '.rar']
|
not_dir = ['.zip', '.xsp', '.rar']
|
||||||
exclude_dir = []
|
exclude_dir = []
|
||||||
|
@ -48,7 +48,7 @@ class GuiSettingsManager:
|
|||||||
|
|
||||||
for node in nodeList:
|
for node in nodeList:
|
||||||
nodeValue = ''
|
nodeValue = ''
|
||||||
if(node.firstChild != None):
|
if(node.firstChild is not None):
|
||||||
nodeValue = node.firstChild.nodeValue
|
nodeValue = node.firstChild.nodeValue
|
||||||
|
|
||||||
# check for numbers and booleans
|
# check for numbers and booleans
|
||||||
@ -70,4 +70,3 @@ class GuiSettingsManager:
|
|||||||
self.doc = minidom.parse(fileLoc)
|
self.doc = minidom.parse(fileLoc)
|
||||||
except ExpatError:
|
except ExpatError:
|
||||||
utils.log("Can't read " + fileLoc)
|
utils.log("Can't read " + fileLoc)
|
||||||
|
|
||||||
|
@ -45,4 +45,3 @@ def getRegionalTimestamp(date_time, dateformat=['dateshort']):
|
|||||||
result = result + ("%s " % date_time.strftime(xbmc.getRegion(aFormat)))
|
result = result + ("%s " % date_time.strftime(xbmc.getRegion(aFormat)))
|
||||||
|
|
||||||
return result.strip()
|
return result.strip()
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user