mirror of
https://github.com/robweber/xbmcbackup.git
synced 2024-11-14 20:35:48 +01:00
added multiple encoding try/except block
This commit is contained in:
parent
a036cde5a8
commit
018a1a1e82
@ -1,6 +1,6 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
||||||
<addon id="script.xbmcbackup"
|
<addon id="script.xbmcbackup"
|
||||||
name="XBMC Backup" version="0.3.0" provider-name="robweber">
|
name="XBMC Backup" version="0.3.1" provider-name="robweber">
|
||||||
<requires>
|
<requires>
|
||||||
<import addon="xbmc.python" version="2.0"/>
|
<import addon="xbmc.python" version="2.0"/>
|
||||||
</requires>
|
</requires>
|
||||||
|
@ -1,3 +1,7 @@
|
|||||||
|
Version 0.3.1
|
||||||
|
|
||||||
|
added try/except for multiple character encodings
|
||||||
|
|
||||||
Version 0.3.0
|
Version 0.3.0
|
||||||
|
|
||||||
major vfs rewrite
|
major vfs rewrite
|
||||||
|
@ -62,8 +62,7 @@ class FileManager:
|
|||||||
for aDir in dirs:
|
for aDir in dirs:
|
||||||
dirPath = xbmc.translatePath(directory + "/" + aDir)
|
dirPath = xbmc.translatePath(directory + "/" + aDir)
|
||||||
file_ext = aDir.split('.')[-1]
|
file_ext = aDir.split('.')[-1]
|
||||||
|
self.addFile("-" + dirPath[len(self.vfs.root_path):])
|
||||||
self.addFile("-" + dirPath[len(self.vfs.root_path):].decode("UTF-8"))
|
|
||||||
#catch for "non directory" type files
|
#catch for "non directory" type files
|
||||||
if (not any(file_ext in s for s in self.not_dir)):
|
if (not any(file_ext in s for s in self.not_dir)):
|
||||||
self.walkTree(dirPath)
|
self.walkTree(dirPath)
|
||||||
@ -71,9 +70,14 @@ class FileManager:
|
|||||||
#copy all the files
|
#copy all the files
|
||||||
for aFile in files:
|
for aFile in files:
|
||||||
filePath = xbmc.translatePath(directory + "/" + aFile)
|
filePath = xbmc.translatePath(directory + "/" + aFile)
|
||||||
self.addFile(filePath[len(self.vfs.root_path):].decode("UTF-8"))
|
self.addFile(filePath[len(self.vfs.root_path):])
|
||||||
|
|
||||||
def addFile(self,filename):
|
def addFile(self,filename):
|
||||||
|
try:
|
||||||
|
filename = filename.decode('UTF-8')
|
||||||
|
except UnicodeDecodeError:
|
||||||
|
filename = filename.decode('ISO-8859-2')
|
||||||
|
|
||||||
#write the full remote path name of this file
|
#write the full remote path name of this file
|
||||||
utils.log("Add File: " + filename,xbmc.LOGDEBUG)
|
utils.log("Add File: " + filename,xbmc.LOGDEBUG)
|
||||||
self.fileArray.append(filename)
|
self.fileArray.append(filename)
|
||||||
|
Loading…
Reference in New Issue
Block a user