Cleanup plexsettings.py and change websocket.py log
This commit is contained in:
parent
3f16991ba3
commit
1230932af4
2 changed files with 23 additions and 14 deletions
|
@ -1,6 +1,13 @@
|
|||
from utils import guisettingsXML, settings, logMsg
|
||||
import logging
|
||||
from utils import guisettingsXML, settings
|
||||
import clientinfo
|
||||
|
||||
###############################################################################
|
||||
|
||||
log = logging.getLogger("PLEX."+__name__)
|
||||
|
||||
###############################################################################
|
||||
|
||||
|
||||
def getGUI(name):
|
||||
xml = guisettingsXML()
|
||||
|
@ -16,7 +23,6 @@ def getGUI(name):
|
|||
def getSettings():
|
||||
client = clientinfo.ClientInfo()
|
||||
options = {}
|
||||
title = 'PlexCompanion Settings'
|
||||
|
||||
options['gdm_debug'] = settings('companionGDMDebugging')
|
||||
options['gdm_debug'] = True if options['gdm_debug'] == 'true' else False
|
||||
|
@ -25,21 +31,21 @@ def getSettings():
|
|||
|
||||
# XBMC web server options
|
||||
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')
|
||||
try:
|
||||
webserverport = int(webserverport)
|
||||
logMsg(title, 'Using webserver port %s' % str(webserverport), 0)
|
||||
log.info('Using webserver port %s' % str(webserverport))
|
||||
except:
|
||||
logMsg(title, 'No setting for webserver port found in guisettings.xml.'
|
||||
'Using default fallback port 8080', 0)
|
||||
log.info('No setting for webserver port found in guisettings.xml.'
|
||||
'Using default fallback port 8080')
|
||||
webserverport = 8080
|
||||
options['port'] = webserverport
|
||||
|
||||
options['user'] = getGUI('webserverusername')
|
||||
options['passwd'] = getGUI('webserverpassword')
|
||||
logMsg(title, 'Webserver username: %s, password: %s'
|
||||
% (options['user'], options['passwd']), 1)
|
||||
log.info('Webserver username: %s, password: %s'
|
||||
% (options['user'], options['passwd']), 1)
|
||||
|
||||
options['addonName'] = client.getAddonName()
|
||||
options['uuid'] = settings('plex_client_Id')
|
||||
|
@ -49,10 +55,9 @@ def getSettings():
|
|||
options['myplex_user'] = settings('username')
|
||||
try:
|
||||
options['myport'] = int(settings('companionPort'))
|
||||
logMsg(title, 'Using Plex Companion Port %s'
|
||||
% str(options['myport']), 0)
|
||||
log.info('Using Plex Companion Port %s' % str(options['myport']))
|
||||
except:
|
||||
logMsg(title, 'Error getting Plex Companion Port from file settings. '
|
||||
'Using fallback port 39005', -1)
|
||||
log.error('Error getting Plex Companion Port from file settings. '
|
||||
'Using fallback port 39005')
|
||||
options['myport'] = 39005
|
||||
return options
|
||||
|
|
|
@ -48,6 +48,12 @@ import sys
|
|||
|
||||
import utils
|
||||
|
||||
###############################################################################
|
||||
|
||||
log = logging.getLogger("PLEX."+__name__)
|
||||
|
||||
###############################################################################
|
||||
|
||||
"""
|
||||
websocket python client.
|
||||
=========================
|
||||
|
@ -74,8 +80,6 @@ STATUS_INVALID_EXTENSION = 1010
|
|||
STATUS_UNEXPECTED_CONDITION = 1011
|
||||
STATUS_TLS_HANDSHAKE_ERROR = 1015
|
||||
|
||||
log = logging.getlog("PLEX."+__name__)
|
||||
|
||||
|
||||
class WebSocketException(Exception):
|
||||
"""
|
||||
|
|
Loading…
Reference in a new issue