Fix UnicodeDecodeError on user switch

- Partially fixes #285
This commit is contained in:
tomkat83 2017-05-01 20:45:02 +02:00
parent 65c31b1eaa
commit f4ad85cfeb
2 changed files with 5 additions and 4 deletions

View file

@ -27,7 +27,7 @@ ADDON_VERSION = _ADDON.getAddonInfo('version')
KODILANGUAGE = xbmc.getLanguage(xbmc.ISO_639_1) KODILANGUAGE = xbmc.getLanguage(xbmc.ISO_639_1)
KODIVERSION = int(xbmc.getInfoLabel("System.BuildVersion")[:2]) KODIVERSION = int(xbmc.getInfoLabel("System.BuildVersion")[:2])
KODILONGVERSION = xbmc.getInfoLabel('System.BuildVersion') KODILONGVERSION = xbmc.getInfoLabel('System.BuildVersion')
KODI_PROFILE = xbmc.translatePath("special://profile") KODI_PROFILE = tryDecode(xbmc.translatePath("special://profile"))
if xbmc.getCondVisibility('system.platform.osx'): if xbmc.getCondVisibility('system.platform.osx'):
PLATFORM = "MacOSX" PLATFORM = "MacOSX"

View file

@ -30,7 +30,7 @@ sys_path.append(_base_resource)
############################################################################### ###############################################################################
from utils import settings, window, language as lang, dialog from utils import settings, window, language as lang, dialog, tryDecode
from userclient import UserClient from userclient import UserClient
import initialsetup import initialsetup
from kodimonitor import KodiMonitor from kodimonitor import KodiMonitor
@ -164,11 +164,12 @@ class Service():
counter = 0 counter = 0
while not monitor.abortRequested(): while not monitor.abortRequested():
if window('plex_kodiProfile') != kodiProfile: if tryDecode(window('plex_kodiProfile')) != kodiProfile:
# Profile change happened, terminate this thread and others # Profile change happened, terminate this thread and others
log.warn("Kodi profile was: %s and changed to: %s. " log.warn("Kodi profile was: %s and changed to: %s. "
"Terminating old PlexKodiConnect thread." "Terminating old PlexKodiConnect thread."
% (kodiProfile, window('plex_kodiProfile'))) % (kodiProfile,
tryDecode(window('plex_kodiProfile'))))
break break
# Before proceeding, need to make sure: # Before proceeding, need to make sure: