Merge branch 'nightly' into v2-newsletter

This commit is contained in:
JonnyWong16 2018-03-24 23:35:21 -07:00
commit d3f6812178
8 changed files with 40 additions and 37 deletions

View file

@ -1,5 +1,12 @@
# Changelog # 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) ## v2.0.24 (2018-03-18)
* Monitoring: * Monitoring:

View file

@ -136,9 +136,6 @@ div.form-control .selectize-input {
text-transform: uppercase; text-transform: uppercase;
font-size: 10px; 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 { .react-selectize.root-node .react-selectize-control .react-selectize-search-field-and-selected-values .resizable-input {
padding-top: 3px !important; padding-top: 3px !important;
padding-bottom: 3px !important; padding-bottom: 3px !important;

View file

@ -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() { function reloadModal() {
$.ajax({ $.ajax({
url: 'get_notifier_config_modal', url: 'get_notifier_config_modal',

View file

@ -1625,13 +1625,16 @@ def dbcheck():
) )
# Rename notifiers in the database # Rename notifiers in the database
logger.debug(u"Altering database. Renaming notifiers.") result = c_db.execute('SELECT agent_label FROM notifiers '
c_db.execute( 'WHERE agent_label = "XBMC" OR agent_label = "OSX Notify"').fetchone()
'UPDATE notifiers SET agent_label = "Kodi" WHERE agent_label = "XBMC"' if result:
) logger.debug(u"Altering database. Renaming notifiers.")
c_db.execute( c_db.execute(
'UPDATE notifiers SET agent_label = "macOS Notification Center" WHERE agent_label = "OSX Notify"' '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. # Add "Local" user to database as default unauthenticated user.
result = c_db.execute('SELECT id FROM users WHERE username = "Local"') result = c_db.execute('SELECT id FROM users WHERE username = "Local"')

View file

@ -293,8 +293,8 @@ def connect_server(log=True, startup=False):
try: try:
web_socket.start_thread() web_socket.start_thread()
except: except Exception as e:
logger.error(u"Websocket :: Unable to open connection.") logger.error(u"Websocket :: Unable to open connection: %s." % e)
def check_server_access(): def check_server_access():

View file

@ -1512,7 +1512,8 @@ class PmsConnect(object):
if media_type not in ('photo', 'clip') \ if media_type not in ('photo', 'clip') \
and not session.getElementsByTagName('Session') \ and not session.getElementsByTagName('Session') \
and not session.getElementsByTagName('TranscodeSession') \ 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() plex_tv = plextv.PlexTV()
parent_rating_key = helpers.get_xml_attr(session, 'parentRatingKey') parent_rating_key = helpers.get_xml_attr(session, 'parentRatingKey')
grandparent_rating_key = helpers.get_xml_attr(session, 'grandparentRatingKey') grandparent_rating_key = helpers.get_xml_attr(session, 'grandparentRatingKey')

View file

@ -1,2 +1,2 @@
PLEXPY_BRANCH = "master" PLEXPY_BRANCH = "master"
PLEXPY_RELEASE_VERSION = "v2.0.24" PLEXPY_RELEASE_VERSION = "v2.0.25"

View file

@ -25,6 +25,7 @@ import plexpy
import activity_handler import activity_handler
import activity_pinger import activity_pinger
import activity_processor import activity_processor
import database
import logger import logger
name = 'websocket' name = 'websocket'
@ -33,8 +34,14 @@ ws_shutdown = False
def start_thread(): def start_thread():
# Check for any existing sessions on start up try:
activity_pinger.check_active_sessions(ws_request=True) # 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 # Start the websocket listener on it's own thread
thread = threading.Thread(target=run) thread = threading.Thread(target=run)
thread.daemon = True thread.daemon = True
@ -67,7 +74,7 @@ def on_disconnect():
def reconnect(): def reconnect():
shutdown() close()
logger.info(u"Tautulli WebSocket :: Reconnecting websocket...") logger.info(u"Tautulli WebSocket :: Reconnecting websocket...")
start_thread() start_thread()
@ -75,7 +82,10 @@ def reconnect():
def shutdown(): def shutdown():
global ws_shutdown global ws_shutdown
ws_shutdown = True ws_shutdown = True
close()
def close():
logger.info(u"Tautulli WebSocket :: Disconnecting websocket...") logger.info(u"Tautulli WebSocket :: Disconnecting websocket...")
plexpy.WEBSOCKET.close() plexpy.WEBSOCKET.close()
plexpy.WS_CONNECTED = False plexpy.WS_CONNECTED = False
@ -122,7 +132,7 @@ def run():
logger.info(u"Tautulli WebSocket :: Ready") logger.info(u"Tautulli WebSocket :: Ready")
plexpy.WS_CONNECTED = True plexpy.WS_CONNECTED = True
except (websocket.WebSocketException, IOError, Exception) as e: except (websocket.WebSocketException, IOError, Exception) as e:
logger.error(u"Tautulli WebSocket :: %s." % e) logger.error("Tautulli WebSocket :: %s." % e)
if plexpy.WS_CONNECTED: if plexpy.WS_CONNECTED:
on_connect() on_connect()
@ -155,18 +165,18 @@ def run():
logger.info(u"Tautulli WebSocket :: Ready") logger.info(u"Tautulli WebSocket :: Ready")
plexpy.WS_CONNECTED = True plexpy.WS_CONNECTED = True
except (websocket.WebSocketException, IOError, Exception) as e: except (websocket.WebSocketException, IOError, Exception) as e:
logger.error(u"Tautulli WebSocket :: %s." % e) logger.error("Tautulli WebSocket :: %s." % e)
else: else:
shutdown() close()
break break
except (websocket.WebSocketException, Exception) as e: except (websocket.WebSocketException, Exception) as e:
if ws_shutdown: if ws_shutdown:
break break
logger.error(u"Tautulli WebSocket :: %s." % e) logger.error("Tautulli WebSocket :: %s." % e)
shutdown() close()
break break
if not plexpy.WS_CONNECTED and not ws_shutdown: if not plexpy.WS_CONNECTED and not ws_shutdown: