Fix UnicodeDecodeError with file paths on sync

- Plex sometimes seems to encode in latin1 instead of utf-8. What the
heck?!?
- Fixes #20
This commit is contained in:
tomkat83 2016-05-06 22:16:56 +02:00
parent 496aa2593a
commit 47409e1535

View file

@ -46,7 +46,6 @@ import xbmcvfs
import clientinfo import clientinfo
import utils import utils
import downloadutils import downloadutils
import requests
from PlexFunctions import PlexToKodiTimefactor, PMSHttpsEnabled from PlexFunctions import PlexToKodiTimefactor, PMSHttpsEnabled
import embydb_functions as embydb import embydb_functions as embydb
@ -1238,9 +1237,9 @@ class API():
if res is not None: if res is not None:
try: try:
res = unquote(res).decode('utf-8') res = unquote(res).decode('utf-8')
except UnicodeEncodeError: except UnicodeDecodeError:
# Sometimes, unquote seems to return unicode, not string # Sometimes, Plex seems to have encoded in latin1
res = unquote(res) res = unquote(res).decode('latin1')
return res return res
def getTVShowPath(self): def getTVShowPath(self):