Fix UnicodeDecodeError for non-ASCII filenames

- Fixes #229
This commit is contained in:
tomkat83 2017-02-26 16:01:35 +01:00
parent 82e7530816
commit 16acca16b9

View file

@ -3,7 +3,7 @@ from urllib import quote
import plexdb_functions as plexdb import plexdb_functions as plexdb
from downloadutils import DownloadUtils as DU from downloadutils import DownloadUtils as DU
from utils import JSONRPC, tryEncode from utils import JSONRPC, tryEncode, tryDecode
from PlexAPI import API from PlexAPI import API
############################################################################### ###############################################################################
@ -36,7 +36,7 @@ class Playlist_Object_Baseclase(object):
answ += "items: %s, " % self.items answ += "items: %s, " % self.items
for key in self.__dict__: for key in self.__dict__:
if key not in ("ID", 'items'): if key not in ("ID", 'items'):
answ += '%s: %s, ' % (key, getattr(self, key)) answ += '%s: %s, ' % (key, tryDecode(str(getattr(self, key))))
return answ[:-2] + ">" return answ[:-2] + ">"
def clear(self): def clear(self):
@ -80,7 +80,7 @@ class Playlist_Item(object):
def __repr__(self): def __repr__(self):
answ = "<%s: " % (self.__class__.__name__) answ = "<%s: " % (self.__class__.__name__)
for key in self.__dict__: for key in self.__dict__:
answ += '%s: %s, ' % (key, getattr(self, key)) answ += '%s: %s, ' % (key, tryDecode(str(getattr(self, key))))
return answ[:-2] + ">" return answ[:-2] + ">"