diff --git a/CHANGELOG.md b/CHANGELOG.md index d4f734df..418c496c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,12 @@ # Changelog +## v2.0.25 (2018-03-22) + +* Monitoring: + * Fix: Websocket not reconnecting causing activity monitoring and notifications to not work. + * Fix: Error checking for synced streams without Plex Pass. + + ## v2.0.24 (2018-03-18) * Monitoring: diff --git a/data/interfaces/default/css/tautulli.css b/data/interfaces/default/css/tautulli.css index e18cefd9..bcd43c2f 100644 --- a/data/interfaces/default/css/tautulli.css +++ b/data/interfaces/default/css/tautulli.css @@ -136,9 +136,6 @@ div.form-control .selectize-input { text-transform: uppercase; font-size: 10px; } -.react-selectize.root-node .react-selectize-control .react-selectize-search-field-and-selected-values.negative-operator .value-wrapper:not(:first-child):before { - content: "and" !important; -} .react-selectize.root-node .react-selectize-control .react-selectize-search-field-and-selected-values .resizable-input { padding-top: 3px !important; padding-bottom: 3px !important; diff --git a/data/interfaces/default/notifier_config.html b/data/interfaces/default/notifier_config.html index 6215bcf1..080424c6 100644 --- a/data/interfaces/default/notifier_config.html +++ b/data/interfaces/default/notifier_config.html @@ -338,21 +338,6 @@ } }); - function setNegativeOperator(select) { - if (select.val() === 'does not contain' || select.val() === 'is not') { - select.closest('.form-group').find('.react-selectize-search-field-and-selected-values').addClass('negative-operator'); - } else { - select.closest('.form-group').find('.react-selectize-search-field-and-selected-values').removeClass('negative-operator'); - } - } - - $('#condition-widget select[name=operator]').each(function () { - setNegativeOperator($(this)); - }); - $('#condition-widget').on('change', 'select[name=operator]', function () { - setNegativeOperator($(this)); - }); - function reloadModal() { $.ajax({ url: 'get_notifier_config_modal', diff --git a/plexpy/__init__.py b/plexpy/__init__.py index 1298e841..c6eb9474 100644 --- a/plexpy/__init__.py +++ b/plexpy/__init__.py @@ -1625,13 +1625,16 @@ def dbcheck(): ) # Rename notifiers in the database - logger.debug(u"Altering database. Renaming notifiers.") - c_db.execute( - 'UPDATE notifiers SET agent_label = "Kodi" WHERE agent_label = "XBMC"' - ) - c_db.execute( - 'UPDATE notifiers SET agent_label = "macOS Notification Center" WHERE agent_label = "OSX Notify"' - ) + result = c_db.execute('SELECT agent_label FROM notifiers ' + 'WHERE agent_label = "XBMC" OR agent_label = "OSX Notify"').fetchone() + if result: + logger.debug(u"Altering database. Renaming notifiers.") + c_db.execute( + 'UPDATE notifiers SET agent_label = "Kodi" WHERE agent_label = "XBMC"' + ) + c_db.execute( + 'UPDATE notifiers SET agent_label = "macOS Notification Center" WHERE agent_label = "OSX Notify"' + ) # Add "Local" user to database as default unauthenticated user. result = c_db.execute('SELECT id FROM users WHERE username = "Local"') diff --git a/plexpy/activity_pinger.py b/plexpy/activity_pinger.py index 966158c2..a0db6f99 100644 --- a/plexpy/activity_pinger.py +++ b/plexpy/activity_pinger.py @@ -293,8 +293,8 @@ def connect_server(log=True, startup=False): try: web_socket.start_thread() - except: - logger.error(u"Websocket :: Unable to open connection.") + except Exception as e: + logger.error(u"Websocket :: Unable to open connection: %s." % e) def check_server_access(): diff --git a/plexpy/pmsconnect.py b/plexpy/pmsconnect.py index 9ec1d300..421527e7 100644 --- a/plexpy/pmsconnect.py +++ b/plexpy/pmsconnect.py @@ -1512,7 +1512,8 @@ class PmsConnect(object): if media_type not in ('photo', 'clip') \ and not session.getElementsByTagName('Session') \ and not session.getElementsByTagName('TranscodeSession') \ - and helpers.get_xml_attr(session, 'ratingKey').isdigit(): + and helpers.get_xml_attr(session, 'ratingKey').isdigit() \ + and plexpy.CONFIG.PMS_PLEXPASS: plex_tv = plextv.PlexTV() parent_rating_key = helpers.get_xml_attr(session, 'parentRatingKey') grandparent_rating_key = helpers.get_xml_attr(session, 'grandparentRatingKey') diff --git a/plexpy/version.py b/plexpy/version.py index cd47c2a9..97c5050d 100644 --- a/plexpy/version.py +++ b/plexpy/version.py @@ -1,2 +1,2 @@ PLEXPY_BRANCH = "master" -PLEXPY_RELEASE_VERSION = "v2.0.24" +PLEXPY_RELEASE_VERSION = "v2.0.25" diff --git a/plexpy/web_socket.py b/plexpy/web_socket.py index aee3a61f..e33dea73 100644 --- a/plexpy/web_socket.py +++ b/plexpy/web_socket.py @@ -25,6 +25,7 @@ import plexpy import activity_handler import activity_pinger import activity_processor +import database import logger name = 'websocket' @@ -33,8 +34,14 @@ ws_shutdown = False def start_thread(): - # Check for any existing sessions on start up - activity_pinger.check_active_sessions(ws_request=True) + try: + # Check for any existing sessions on start up + activity_pinger.check_active_sessions(ws_request=True) + except Exception as e: + logger.error(u"Tautulli WebSocket :: Failed to check for active sessions: %s." % e) + logger.warn(u"Tautulli WebSocket :: Attempt to fix by flushing temporary sessions...") + database.delete_sessions() + # Start the websocket listener on it's own thread thread = threading.Thread(target=run) thread.daemon = True @@ -67,7 +74,7 @@ def on_disconnect(): def reconnect(): - shutdown() + close() logger.info(u"Tautulli WebSocket :: Reconnecting websocket...") start_thread() @@ -75,7 +82,10 @@ def reconnect(): def shutdown(): global ws_shutdown ws_shutdown = True + close() + +def close(): logger.info(u"Tautulli WebSocket :: Disconnecting websocket...") plexpy.WEBSOCKET.close() plexpy.WS_CONNECTED = False @@ -122,7 +132,7 @@ def run(): logger.info(u"Tautulli WebSocket :: Ready") plexpy.WS_CONNECTED = True except (websocket.WebSocketException, IOError, Exception) as e: - logger.error(u"Tautulli WebSocket :: %s." % e) + logger.error("Tautulli WebSocket :: %s." % e) if plexpy.WS_CONNECTED: on_connect() @@ -155,18 +165,18 @@ def run(): logger.info(u"Tautulli WebSocket :: Ready") plexpy.WS_CONNECTED = True except (websocket.WebSocketException, IOError, Exception) as e: - logger.error(u"Tautulli WebSocket :: %s." % e) + logger.error("Tautulli WebSocket :: %s." % e) else: - shutdown() + close() break except (websocket.WebSocketException, Exception) as e: if ws_shutdown: break - logger.error(u"Tautulli WebSocket :: %s." % e) - shutdown() + logger.error("Tautulli WebSocket :: %s." % e) + close() break if not plexpy.WS_CONNECTED and not ws_shutdown: