Merge branch 'master' into leia

This commit is contained in:
Rob Weber
2019-09-11 10:16:14 -05:00
8 changed files with 58 additions and 79 deletions

View File

@ -3,6 +3,7 @@ import time
import json
from kodi_six import xbmc, xbmcgui, xbmcvfs
from . import utils as utils
import os
from datetime import datetime
from . vfs import XBMCFileSystem,DropboxFileSystem,ZipFileSystem
from . progressbar import BackupProgressBar
@ -316,10 +317,10 @@ class XbmcBackup:
self.xbmc_vfs.rmfile(xbmc.translatePath("special://temp/" + self.restore_point))
self.xbmc_vfs.rmdir(self.remote_vfs.root_path)
if(utils.getSetting("backup_config") == "true"):
#update the guisettings information (or what we can from it)
gui_settings = GuiSettingsManager('special://home/userdata/guisettings.xml')
gui_settings.run()
#update the guisettings information (or what we can from it)
gui_settings = GuiSettingsManager()
gui_settings.run()
#call update addons to refresh everything
xbmc.executebuiltin('UpdateLocalAddons')
@ -393,13 +394,15 @@ class XbmcBackup:
dest.mkdir(dest.root_path + aFile[len(source.root_path) + 1:])
else:
self._updateProgress()
wroteFile = True
destFile = dest.root_path + aFile[len(source.root_path):]
if(isinstance(source,DropboxFileSystem)):
#if copying from cloud storage we need the file handle, use get_file
wroteFile = source.get_file(aFile,dest.root_path + aFile[len(source.root_path):])
wroteFile = source.get_file(aFile,destFile)
else:
#copy using normal method
wroteFile = dest.put(aFile,dest.root_path + aFile[len(source.root_path):])
wroteFile = dest.put(aFile,destFile)
#if result is still true but this file failed
if(not wroteFile and result):
@ -550,13 +553,13 @@ class FileManager:
if(directory[-1:] == '/' or directory[-1:] == '\\'):
directory = directory[:-1]
if(self.vfs.exists(directory + "/")):
if(self.vfs.exists(directory + os.path.sep)):
dirs,files = self.vfs.listdir(directory)
if(recurse):
#create all the subdirs first
for aDir in dirs:
dirPath = xbmc.validatePath(xbmc.translatePath(directory + "/" + aDir))
dirPath = xbmc.validatePath(xbmc.translatePath(directory + os.path.sep + aDir))
file_ext = aDir.split('.')[-1]
#check if directory is excluded
@ -576,7 +579,7 @@ class FileManager:
#copy all the files
for aFile in files:
filePath = xbmc.translatePath(directory + "/" + aFile)
filePath = xbmc.translatePath(directory + os.path.sep + aFile)
self.addFile(filePath)
def addDir(self,dirMeta):