From 65be0b6262f58bed985959989c0877a37998162f Mon Sep 17 00:00:00 2001 From: angelblue05 Date: Thu, 21 Jan 2016 14:35:24 -0600 Subject: [PATCH] Fixing unicode bug for device name Removing decode to unicode, because we use it for the downloadutils. We need it in utf-8, not unicode. --- resources/lib/clientinfo.py | 2 +- resources/lib/downloadutils.py | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/resources/lib/clientinfo.py b/resources/lib/clientinfo.py index 44ed98f2..94f7d207 100644 --- a/resources/lib/clientinfo.py +++ b/resources/lib/clientinfo.py @@ -44,7 +44,7 @@ class ClientInfo(): if utils.settings('deviceNameOpt') == "false": # Use Kodi's deviceName - deviceName = xbmc.getInfoLabel('System.FriendlyName').decode('utf-8') + deviceName = xbmc.getInfoLabel('System.FriendlyName') else: deviceName = utils.settings('deviceName') deviceName = deviceName.replace("\"", "_") diff --git a/resources/lib/downloadutils.py b/resources/lib/downloadutils.py index 578c932c..e68d1951 100644 --- a/resources/lib/downloadutils.py +++ b/resources/lib/downloadutils.py @@ -189,7 +189,7 @@ class DownloadUtils(): # If user is not authenticated auth = ( 'MediaBrowser Client="Kodi", Device="%s", DeviceId="%s", Version="%s"' - % (deviceName, deviceId, version)) + % (deviceName, deviceId.encode('utf-8'), version.encode('utf-8'))) header = { 'Content-type': 'application/json', @@ -205,7 +205,8 @@ class DownloadUtils(): # Attached to the requests session auth = ( 'MediaBrowser UserId="%s", Client="Kodi", Device="%s", DeviceId="%s", Version="%s"' - % (userId, deviceName, deviceId, version)) + % (userId.encode('utf-8'), deviceName, deviceId.encode('utf-8'), + version.encode('utf-8'))) header = { 'Content-type': 'application/json', @@ -274,7 +275,6 @@ class DownloadUtils(): verify=verifyssl) elif type == "POST": - print url r = requests.post(url, json=postBody, headers=header,