Instantiate Plex Companion after user signed on

This commit is contained in:
tomkat83 2016-04-07 16:41:27 +02:00
parent 1bec2d9ac9
commit 621fd3ad4a
2 changed files with 22 additions and 26 deletions

View file

@ -26,23 +26,22 @@ class UserClient(threading.Thread):
# Borg - multiple instances, shared state
__shared_state = {}
auth = True
retry = 0
currUser = None
currUserId = None
currServer = None
currToken = None
HasAccess = True
AdditionalUser = []
userSettings = None
def __init__(self):
self.__dict__ = self.__shared_state
self.addon = xbmcaddon.Addon()
self.auth = True
self.retry = 0
self.currUser = None
self.currUserId = None
self.currServer = None
self.currToken = None
self.HasAccess = True
self.AdditionalUser = []
self.userSettings = None
self.addon = xbmcaddon.Addon()
self.doUtils = downloadutils.DownloadUtils()
threading.Thread.__init__(self)
@ -63,15 +62,6 @@ class UserClient(threading.Thread):
return username
def getLogLevel(self):
try:
logLevel = int(utils.settings('logLevel'))
except ValueError:
logLevel = 0
return logLevel
def getServer(self, prefix=True):
settings = utils.settings

View file

@ -56,7 +56,7 @@ class Service():
window = utils.window
self.clientInfo = clientinfo.ClientInfo()
logLevel = userclient.UserClient().getLogLevel()
logLevel = self.getLogLevel()
self.monitor = xbmc.Monitor()
window('emby_logLevel', value=str(logLevel))
@ -97,6 +97,13 @@ class Service():
# Set the minimum database version
window('emby_minDBVersion', value="1.1.0")
def getLogLevel(self):
try:
logLevel = int(utils.settings('logLevel'))
except ValueError:
logLevel = 0
return logLevel
def ServiceEntryPoint(self):
log = self.logMsg
@ -123,7 +130,6 @@ class Service():
kplayer = player.Player()
xplayer = xbmc.Player()
plx = PlexAPI.PlexAPI()
plexCompanion = PlexCompanion.PlexCompanion()
# Sync and progress report
lastProgressUpdate = datetime.today()
@ -172,7 +178,6 @@ class Service():
window('emby_command', clear=True)
kplayer.reportPlayback()
lastProgressUpdate = datetime.today()
except Exception as e:
log("Exception in Playback Monitor Service: %s" % e, 1)
pass
@ -204,6 +209,7 @@ class Service():
if not self.plexCompanion_running and \
self.runPlexCompanion == "true":
self.plexCompanion_running = True
plexCompanion = PlexCompanion.PlexCompanion()
plexCompanion.start()
else:
if (user.currUser is None) and self.warn_auth: