Permalink
Browse files

added multiple encoding try/except block

  • Loading branch information...
1 parent a036cde commit 018a1a1e82043991ce2922946784cbfd1e614fba @robweber committed Dec 11, 2012
Showing with 12 additions and 4 deletions.
  1. +1 −1 addon.xml
  2. +4 −0 changelog.txt
  3. +7 −3 resources/lib/backup.py
View
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<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>
<import addon="xbmc.python" version="2.0"/>
</requires>
View
@@ -1,3 +1,7 @@
+Version 0.3.1
+
+added try/except for multiple character encodings
+
Version 0.3.0
major vfs rewrite
View
@@ -62,18 +62,22 @@ def walkTree(self,directory):
for aDir in dirs:
dirPath = xbmc.translatePath(directory + "/" + aDir)
file_ext = aDir.split('.')[-1]
-
- self.addFile("-" + dirPath[len(self.vfs.root_path):].decode("UTF-8"))
+ self.addFile("-" + dirPath[len(self.vfs.root_path):])
#catch for "non directory" type files
if (not any(file_ext in s for s in self.not_dir)):
self.walkTree(dirPath)
#copy all the files
for aFile in files:
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):
+ try:
+ filename = filename.decode('UTF-8')
+ except UnicodeDecodeError:
+ filename = filename.decode('ISO-8859-2')
+
#write the full remote path name of this file
utils.log("Add File: " + filename,xbmc.LOGDEBUG)
self.fileArray.append(filename)

0 comments on commit 018a1a1

Please sign in to comment.