diff --git a/plexpy/activity_processor.py b/plexpy/activity_processor.py index 93c8f160..053f2018 100644 --- a/plexpy/activity_processor.py +++ b/plexpy/activity_processor.py @@ -131,6 +131,12 @@ class ActivityProcessor(object): logger.debug(u"PlexPy ActivityProcessor :: Play duration for ratingKey %s is %s secs which is less than %s " u"seconds, so we're not logging it." % (session['rating_key'], str(real_play_time), plexpy.CONFIG.LOGGING_IGNORE_INTERVAL)) + if session['media_type'] == 'track' and not is_import: + if real_play_time < 15 and session['duration'] >= 30: + logging_enabled = False + logger.debug(u"PlexPy ActivityProcessor :: Play duration for ratingKey %s is %s secs, " + u"looks like it was skipped so we're not logging it" % + (session['rating_key'], str(real_play_time))) elif is_import and import_ignore_interval: if (session['media_type'] == 'movie' or session['media_type'] == 'episode') and \ (real_play_time < int(import_ignore_interval)): diff --git a/plexpy/web_socket.py b/plexpy/web_socket.py index 79ec4b34..c9740b9b 100644 --- a/plexpy/web_socket.py +++ b/plexpy/web_socket.py @@ -49,8 +49,8 @@ def run(): ws_connected = False reconnects = 0 - # Try an open the websocket connection - if it fails after 5 retries fallback to polling - while not ws_connected and reconnects < 15: + # Try an open the websocket connection - if it fails after 15 retries fallback to polling + 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) @@ -69,12 +69,12 @@ def run(): # successfully received data, reset reconnects counter reconnects = 0 except websocket.WebSocketConnectionClosedException: - if reconnects <= 5: + if reconnects <= 15: reconnects += 1 - # Increasing sleep interval between reconnections + # Sleep 5 between connection attempts if reconnects > 1: - time.sleep(2 * (reconnects - 1)) + time.sleep(5) logger.warn(u'PlexPy WebSocket :: Connection has closed, reconnecting...') try: @@ -91,7 +91,7 @@ def run(): plexpy.POLLING_FAILOVER = True plexpy.initialize_scheduler() - logger.debug(u'Leaving thread.') + logger.debug(u'PlexPy WebSocket :: Leaving thread.') def receive(ws):