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
path = "plugin://plugin.video.plexkodiconnect.movies/"
params = {
'filename': utils.tryEncode(API.getKey()),
'filename': API.getKey(),
'id': itemid,
'dbid': movieid,
'mode': "play"
@ -1329,7 +1329,7 @@ class TVShows(Items):
else:
filename = playurl.rsplit('/', 1)[1]
else:
filename = 'file_not_found'
filename = 'file_not_found.mkv'
path = "plugin://plugin.video.plexkodiconnect.tvshows/%s/" % seriesId
params = {
'filename': utils.tryEncode(filename),
@ -1337,7 +1337,8 @@ class TVShows(Items):
'dbid': episodeid,
'mode': "play"
}
filename = "%s?%s" % (path, urllib.urlencode(params))
filename = "%s?%s" % (path,
utils.tryDecode(urllib.urlencode(params)))
playurl = filename
parentPathId = self.kodi_db.addPath(
'plugin://plugin.video.plexkodiconnect.tvshows/')

View file

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