Add playback error notification trigger

This commit is contained in:
JonnyWong16 2020-09-21 18:31:19 -07:00
parent 7ce92d5f17
commit 93997c11dc
No known key found for this signature in database
GPG key ID: B1F1F9807184697A
4 changed files with 50 additions and 6 deletions

View file

@ -264,6 +264,19 @@ class ActivityHandler(object):
plexpy.NOTIFY_QUEUE.put({'stream_data': db_session.copy(), 'notify_action': 'on_buffer'})
def on_error(self):
if self.is_valid_session():
logger.debug("Tautulli ActivityHandler :: Session %s encountered an error." % str(self.get_session_key()))
# Update the session state and viewOffset
self.update_db_session()
# Retrieve the session data from our temp table
ap = activity_processor.ActivityProcessor()
db_session = ap.get_session_by_key(session_key=self.get_session_key())
plexpy.NOTIFY_QUEUE.put({'stream_data': db_session.copy(), 'notify_action': 'on_error'})
# This function receives events from our websocket connection
def process(self):
if self.is_valid_session():
@ -321,6 +334,8 @@ class ActivityHandler(object):
self.on_resume()
elif this_state == 'stopped':
self.on_stop()
elif this_state == 'error':
self.on_error()
elif this_state == 'paused':
# Update the session last_paused timestamp