Very early work on implementing websocket monitoring method.

This commit is contained in:
Tim 2015-09-20 12:21:39 +02:00
parent 9c955771c0
commit fa71beb03f
24 changed files with 7814 additions and 3 deletions

View file

@ -20,7 +20,7 @@ import sys
# Ensure lib added to path, before any other imports
sys.path.insert(0, os.path.join(os.path.dirname(__file__), 'lib/'))
from plexpy import webstart, logger
from plexpy import webstart, logger, web_socket
import locale
import time
@ -191,6 +191,16 @@ def main():
# Start the background threads
plexpy.start()
# Open connection for websocket
if plexpy.CONFIG.MONITORING_USE_WEBSOCKET:
try:
web_socket.start_thread()
except:
logger.warn(u"Websocket :: Unable to open connection.")
# Fallback to polling
plexpy.CONFIG.MONITORING_USE_WEBSOCKET = 0
plexpy.initialize_scheduler()
# Open webbrowser
if plexpy.CONFIG.LAUNCH_BROWSER and not args.nolaunch:
plexpy.launch_browser(plexpy.CONFIG.HTTP_HOST, http_port,