Cleanup plexsettings.py and change websocket.py log

This commit is contained in:
tomkat83 2016-09-04 16:46:44 +02:00
parent 3f16991ba3
commit 1230932af4
2 changed files with 23 additions and 14 deletions

View file

@ -1,6 +1,13 @@
from utils import guisettingsXML, settings, logMsg import logging
from utils import guisettingsXML, settings
import clientinfo import clientinfo
###############################################################################
log = logging.getLogger("PLEX."+__name__)
###############################################################################
def getGUI(name): def getGUI(name):
xml = guisettingsXML() xml = guisettingsXML()
@ -16,7 +23,6 @@ def getGUI(name):
def getSettings(): def getSettings():
client = clientinfo.ClientInfo() client = clientinfo.ClientInfo()
options = {} options = {}
title = 'PlexCompanion Settings'
options['gdm_debug'] = settings('companionGDMDebugging') options['gdm_debug'] = settings('companionGDMDebugging')
options['gdm_debug'] = True if options['gdm_debug'] == 'true' else False options['gdm_debug'] = True if options['gdm_debug'] == 'true' else False
@ -25,21 +31,21 @@ def getSettings():
# XBMC web server options # XBMC web server options
options['webserver_enabled'] = (getGUI('webserver') == "true") options['webserver_enabled'] = (getGUI('webserver') == "true")
logMsg(title, 'Webserver is set to %s' % options['webserver_enabled'], 0) log.info('Webserver is set to %s' % options['webserver_enabled'])
webserverport = getGUI('webserverport') webserverport = getGUI('webserverport')
try: try:
webserverport = int(webserverport) webserverport = int(webserverport)
logMsg(title, 'Using webserver port %s' % str(webserverport), 0) log.info('Using webserver port %s' % str(webserverport))
except: except:
logMsg(title, 'No setting for webserver port found in guisettings.xml.' log.info('No setting for webserver port found in guisettings.xml.'
'Using default fallback port 8080', 0) 'Using default fallback port 8080')
webserverport = 8080 webserverport = 8080
options['port'] = webserverport options['port'] = webserverport
options['user'] = getGUI('webserverusername') options['user'] = getGUI('webserverusername')
options['passwd'] = getGUI('webserverpassword') options['passwd'] = getGUI('webserverpassword')
logMsg(title, 'Webserver username: %s, password: %s' log.info('Webserver username: %s, password: %s'
% (options['user'], options['passwd']), 1) % (options['user'], options['passwd']), 1)
options['addonName'] = client.getAddonName() options['addonName'] = client.getAddonName()
options['uuid'] = settings('plex_client_Id') options['uuid'] = settings('plex_client_Id')
@ -49,10 +55,9 @@ def getSettings():
options['myplex_user'] = settings('username') options['myplex_user'] = settings('username')
try: try:
options['myport'] = int(settings('companionPort')) options['myport'] = int(settings('companionPort'))
logMsg(title, 'Using Plex Companion Port %s' log.info('Using Plex Companion Port %s' % str(options['myport']))
% str(options['myport']), 0)
except: except:
logMsg(title, 'Error getting Plex Companion Port from file settings. ' log.error('Error getting Plex Companion Port from file settings. '
'Using fallback port 39005', -1) 'Using fallback port 39005')
options['myport'] = 39005 options['myport'] = 39005
return options return options

View file

@ -48,6 +48,12 @@ import sys
import utils import utils
###############################################################################
log = logging.getLogger("PLEX."+__name__)
###############################################################################
""" """
websocket python client. websocket python client.
========================= =========================
@ -74,8 +80,6 @@ STATUS_INVALID_EXTENSION = 1010
STATUS_UNEXPECTED_CONDITION = 1011 STATUS_UNEXPECTED_CONDITION = 1011
STATUS_TLS_HANDSHAKE_ERROR = 1015 STATUS_TLS_HANDSHAKE_ERROR = 1015
log = logging.getlog("PLEX."+__name__)
class WebSocketException(Exception): class WebSocketException(Exception):
""" """