Less logging

This commit is contained in:
tomkat83 2016-12-17 13:58:00 +01:00
parent ce3435ac73
commit 0ff7d81ab3

View file

@ -91,7 +91,7 @@ class UserClient(threading.Thread):
if self.machineIdentifier is None: if self.machineIdentifier is None:
self.machineIdentifier = '' self.machineIdentifier = ''
settings('plex_machineIdentifier', value=self.machineIdentifier) settings('plex_machineIdentifier', value=self.machineIdentifier)
log.info('Returning active server: %s' % server) log.debug('Returning active server: %s' % server)
return server return server
def getSSLverify(self): def getSSLverify(self):
@ -104,7 +104,7 @@ class UserClient(threading.Thread):
else settings('sslcert') else settings('sslcert')
def setUserPref(self): def setUserPref(self):
log.info('Setting user preferences') log.debug('Setting user preferences')
# Only try to get user avatar if there is a token # Only try to get user avatar if there is a token
if self.currToken: if self.currToken:
url = PlexAPI.PlexAPI().GetUserArtworkURL(self.currUser) url = PlexAPI.PlexAPI().GetUserArtworkURL(self.currUser)
@ -138,7 +138,7 @@ class UserClient(threading.Thread):
lang(33007)) lang(33007))
def loadCurrUser(self, username, userId, usertoken, authenticated=False): def loadCurrUser(self, username, userId, usertoken, authenticated=False):
log.info('Loading current user') log.debug('Loading current user')
doUtils = self.doUtils doUtils = self.doUtils
self.currUserId = userId self.currUserId = userId
@ -148,15 +148,15 @@ class UserClient(threading.Thread):
self.sslcert = self.getSSL() self.sslcert = self.getSSL()
if authenticated is False: if authenticated is False:
log.info('Testing validity of current token') log.debug('Testing validity of current token')
res = PlexAPI.PlexAPI().CheckConnection(self.currServer, res = PlexAPI.PlexAPI().CheckConnection(self.currServer,
token=self.currToken, token=self.currToken,
verifySSL=self.ssl) verifySSL=self.ssl)
if res is False: if res is False:
log.error('Answer from PMS is not as expected. Retrying') # PMS probably offline
return False return False
elif res == 401: elif res == 401:
log.warn('Token is no longer valid') log.error('Token is no longer valid')
return 401 return 401
elif res >= 400: elif res >= 400:
log.error('Answer from PMS is not as expected. Retrying') log.error('Answer from PMS is not as expected. Retrying')
@ -206,7 +206,7 @@ class UserClient(threading.Thread):
return True return True
def authenticate(self): def authenticate(self):
log.info('Authenticating user') log.debug('Authenticating user')
dialog = xbmcgui.Dialog() dialog = xbmcgui.Dialog()
# Give attempts at entering password / selecting user # Give attempts at entering password / selecting user
@ -243,7 +243,7 @@ class UserClient(threading.Thread):
enforceLogin = settings('enforceUserLogin') enforceLogin = settings('enforceUserLogin')
# Found a user in the settings, try to authenticate # Found a user in the settings, try to authenticate
if username and enforceLogin == 'false': if username and enforceLogin == 'false':
log.info('Trying to authenticate with old settings') log.debug('Trying to authenticate with old settings')
answ = self.loadCurrUser(username, answ = self.loadCurrUser(username,
userId, userId,
usertoken, usertoken,
@ -252,12 +252,12 @@ class UserClient(threading.Thread):
# SUCCESS: loaded a user from the settings # SUCCESS: loaded a user from the settings
return True return True
elif answ == 401: elif answ == 401:
log.info("User token no longer valid. Sign user out") log.error("User token no longer valid. Sign user out")
settings('username', value='') settings('username', value='')
settings('userid', value='') settings('userid', value='')
settings('accessToken', value='') settings('accessToken', value='')
else: else:
log.info("Could not yet authenticate user") log.debug("Could not yet authenticate user")
return False return False
plx = PlexAPI.PlexAPI() plx = PlexAPI.PlexAPI()
@ -291,7 +291,7 @@ class UserClient(threading.Thread):
return False return False
def resetClient(self): def resetClient(self):
log.info("Reset UserClient authentication.") log.debug("Reset UserClient authentication.")
self.doUtils.stopSession() self.doUtils.stopSession()
window('plex_authenticated', clear=True) window('plex_authenticated', clear=True)
@ -368,7 +368,7 @@ class UserClient(threading.Thread):
# Or retried too many times # Or retried too many times
if server and status != "Stop": if server and status != "Stop":
# Only if there's information found to login # Only if there's information found to login
log.info("Server found: %s" % server) log.debug("Server found: %s" % server)
self.auth = True self.auth = True
# Minimize CPU load # Minimize CPU load