Fix encoding and decoding

This commit is contained in:
tomkat83 2016-05-07 22:17:12 +02:00
parent 4575f1e482
commit d01a8aafa1
2 changed files with 8 additions and 7 deletions

View file

@ -432,7 +432,7 @@ class Movies(Items):
# Set plugin path and media flags using real filename # Set plugin path and media flags using real filename
path = "plugin://plugin.video.plexkodiconnect.movies/" path = "plugin://plugin.video.plexkodiconnect.movies/"
params = { params = {
'filename': utils.tryEncode(API.getKey()), 'filename': API.getKey(),
'id': itemid, 'id': itemid,
'dbid': movieid, 'dbid': movieid,
'mode': "play" 'mode': "play"
@ -1329,7 +1329,7 @@ class TVShows(Items):
else: else:
filename = playurl.rsplit('/', 1)[1] filename = playurl.rsplit('/', 1)[1]
else: else:
filename = 'file_not_found' filename = 'file_not_found.mkv'
path = "plugin://plugin.video.plexkodiconnect.tvshows/%s/" % seriesId path = "plugin://plugin.video.plexkodiconnect.tvshows/%s/" % seriesId
params = { params = {
'filename': utils.tryEncode(filename), 'filename': utils.tryEncode(filename),
@ -1337,7 +1337,8 @@ class TVShows(Items):
'dbid': episodeid, 'dbid': episodeid,
'mode': "play" 'mode': "play"
} }
filename = "%s?%s" % (path, urllib.urlencode(params)) filename = "%s?%s" % (path,
utils.tryDecode(urllib.urlencode(params)))
playurl = filename playurl = filename
parentPathId = self.kodi_db.addPath( parentPathId = self.kodi_db.addPath(
'plugin://plugin.video.plexkodiconnect.tvshows/') 'plugin://plugin.video.plexkodiconnect.tvshows/')

View file

@ -938,9 +938,9 @@ def tryEncode(uniString, encoding='utf-8'):
string.encode() string.encode()
""" """
try: try:
uniString.encode(encoding, "ignore") uniString = uniString.encode(encoding, "ignore")
except TypeError: except TypeError:
uniString.encode() uniString = uniString.encode()
return uniString return uniString
@ -951,7 +951,7 @@ def tryDecode(string, encoding='utf-8'):
string.encode() string.encode()
""" """
try: try:
string.decode(encoding, "ignore") string = string.decode(encoding, "ignore")
except TypeError: except TypeError:
string.decode() string = string.decode()
return string return string