diff --git a/plexpy/http_handler.py b/plexpy/http_handler.py index dc75a5c9..44a2b10b 100644 --- a/plexpy/http_handler.py +++ b/plexpy/http_handler.py @@ -81,10 +81,11 @@ class HTTPHandler(object): logger.warn(u"Failed to access uri endpoint %s with error %s" % (uri, e)) return None except Exception, e: - logger.warn(u"Failed to access uri endpoint %s. Is your server maybe accepting SSL connections only?" % uri) + logger.warn(u"Failed to access uri endpoint %s. Is your server maybe accepting SSL connections only? %s" % (uri, e)) return None except: logger.warn(u"Failed to access uri endpoint %s with Uncaught exception." % uri) + return None if request_status == 200: if output_format == 'dict': diff --git a/plexpy/plexwatch_import.py b/plexpy/plexwatch_import.py index 39f48c74..7df5b355 100644 --- a/plexpy/plexwatch_import.py +++ b/plexpy/plexwatch_import.py @@ -15,7 +15,7 @@ import sqlite3 -from plexpy import logger, helpers, monitor, users, plextv +from plexpy import logger, helpers, activity_pinger, activity_processor, users, plextv from xml.dom import minidom import plexpy @@ -245,9 +245,10 @@ def import_from_plexwatch(database=None, table_name=None, import_ignore_interval logger.debug(u"PlexPy Importer :: PlexWatch data import in progress...") logger.debug(u"PlexPy Importer :: Disabling monitoring while import in progress.") - plexpy.schedule_job(monitor.check_active_sessions, 'Check for active sessions', hours=0, minutes=0, seconds=0) + plexpy.schedule_job(activity_pinger.check_active_sessions, 'Check for active sessions', + hours=0, minutes=0, seconds=0) - monitor_processing = monitor.MonitorProcessing() + ap = activity_processor.ActivityProcessor() user_data = users.Users() # Get the latest friends list so we can pull user id's @@ -373,10 +374,10 @@ def import_from_plexwatch(database=None, table_name=None, import_ignore_interval # On older versions of PMS, "clip" items were still classified as "movie" and had bad ratingKey values # Just make sure that the ratingKey is indeed an integer if session_history_metadata['rating_key'].isdigit(): - monitor_processing.write_session_history(session=session_history, - import_metadata=session_history_metadata, - is_import=True, - import_ignore_interval=import_ignore_interval) + ap.write_session_history(session=session_history, + import_metadata=session_history_metadata, + is_import=True, + import_ignore_interval=import_ignore_interval) else: logger.debug(u"PlexPy Importer :: Item has bad rating_key: %s" % session_history_metadata['rating_key']) diff --git a/plexpy/web_socket.py b/plexpy/web_socket.py index ffefc37f..79ec4b34 100644 --- a/plexpy/web_socket.py +++ b/plexpy/web_socket.py @@ -50,7 +50,7 @@ def run(): reconnects = 0 # Try an open the websocket connection - if it fails after 5 retries fallback to polling - while not ws_connected and reconnects < 5: + while not ws_connected and reconnects < 15: try: logger.info(u'PlexPy WebSocket :: Opening websocket, connection attempt %s.' % str(reconnects + 1)) ws = create_connection(uri)