Add user_id to session started log message

This commit is contained in:
JonnyWong16 2016-10-05 21:50:39 -07:00 committed by JonnyWong16
parent 2a2237f542
commit 438e525319
2 changed files with 12 additions and 12 deletions

View file

@ -69,11 +69,11 @@ class ActivityHandler(object):
def on_start(self): def on_start(self):
if self.is_valid_session() and self.get_live_session(): if self.is_valid_session() and self.get_live_session():
logger.debug(u"PlexPy ActivityHandler :: Session %s has started with ratingKey %s."
% (str(self.get_session_key()), str(self.get_rating_key())))
session = self.get_live_session() session = self.get_live_session()
logger.debug(u"PlexPy ActivityHandler :: Session %s started by user %s with ratingKey %s."
% (str(session['session_key']), str(session['user_id']), str(session['rating_key'])))
plexpy.NOTIFY_QUEUE.put({'stream_data': session, 'notify_action': 'on_play'}) plexpy.NOTIFY_QUEUE.put({'stream_data': session, 'notify_action': 'on_play'})
# Write the new session to our temp session table # Write the new session to our temp session table
@ -114,7 +114,7 @@ class ActivityHandler(object):
def on_pause(self): def on_pause(self):
if self.is_valid_session(): if self.is_valid_session():
logger.debug(u"PlexPy ActivityHandler :: Session %s has been paused." % str(self.get_session_key())) logger.debug(u"PlexPy ActivityHandler :: Session %s paused." % str(self.get_session_key()))
# Set the session last_paused timestamp # Set the session last_paused timestamp
ap = activity_processor.ActivityProcessor() ap = activity_processor.ActivityProcessor()
@ -132,7 +132,7 @@ class ActivityHandler(object):
def on_resume(self): def on_resume(self):
if self.is_valid_session(): if self.is_valid_session():
logger.debug(u"PlexPy ActivityHandler :: Session %s has been resumed." % str(self.get_session_key())) logger.debug(u"PlexPy ActivityHandler :: Session %s resumed." % str(self.get_session_key()))
# Set the session last_paused timestamp # Set the session last_paused timestamp
ap = activity_processor.ActivityProcessor() ap = activity_processor.ActivityProcessor()

View file

@ -67,12 +67,12 @@ def check_active_sessions(ws_request=False):
# Here we can check the play states # Here we can check the play states
if session['state'] != stream['state']: if session['state'] != stream['state']:
if session['state'] == 'paused': if session['state'] == 'paused':
logger.debug(u"PlexPy Monitor :: Session %s has been paused." % stream['session_key']) logger.debug(u"PlexPy Monitor :: Session %s paused." % stream['session_key'])
plexpy.NOTIFY_QUEUE.put({'stream_data': stream, 'notify_action': 'on_pause'}) plexpy.NOTIFY_QUEUE.put({'stream_data': stream, 'notify_action': 'on_pause'})
if session['state'] == 'playing' and stream['state'] == 'paused': if session['state'] == 'playing' and stream['state'] == 'paused':
logger.debug(u"PlexPy Monitor :: Session %s has been resumed." % stream['session_key']) logger.debug(u"PlexPy Monitor :: Session %s resumed." % stream['session_key'])
plexpy.NOTIFY_QUEUE.put({'stream_data': stream, 'notify_action': 'on_resume'}) plexpy.NOTIFY_QUEUE.put({'stream_data': stream, 'notify_action': 'on_resume'})
@ -146,7 +146,7 @@ def check_active_sessions(ws_request=False):
else: else:
# The user has stopped playing a stream # The user has stopped playing a stream
if stream['state'] != 'stopped': if stream['state'] != 'stopped':
logger.debug(u"PlexPy Monitor :: Session %s has stopped." % stream['session_key']) logger.debug(u"PlexPy Monitor :: Session %s stopped." % stream['session_key'])
if not stream['stopped']: if not stream['stopped']:
# Set the stream stop time # Set the stream stop time
@ -197,8 +197,8 @@ def check_active_sessions(ws_request=False):
new_session = monitor_process.write_session(session) new_session = monitor_process.write_session(session)
if new_session: if new_session:
logger.debug(u"PlexPy Monitor :: Session %s has started with ratingKey %s." logger.debug(u"PlexPy Monitor :: Session %s started by user %s with ratingKey %s."
% (session['session_key'], session['rating_key'])) % (session['session_key'], session['user_id'], session['rating_key']))
else: else:
logger.debug(u"PlexPy Monitor :: Unable to read session list.") logger.debug(u"PlexPy Monitor :: Unable to read session list.")
@ -264,7 +264,7 @@ def check_recently_added():
library_details = library_data.get_details(section_id=item['section_id']) library_details = library_data.get_details(section_id=item['section_id'])
if 0 < time_threshold - int(item['added_at']) <= time_interval: if 0 < time_threshold - int(item['added_at']) <= time_interval:
logger.debug(u"PlexPy Monitor :: Library item %s has been added to Plex." % str(item['rating_key'])) logger.debug(u"PlexPy Monitor :: Library item %s added to Plex." % str(item['rating_key']))
plexpy.NOTIFY_QUEUE.put({'timeline_data': item, 'notify_action': 'on_created'}) plexpy.NOTIFY_QUEUE.put({'timeline_data': item, 'notify_action': 'on_created'})
@ -281,7 +281,7 @@ def check_recently_added():
logger.error(u"PlexPy Monitor :: Unable to retrieve grandparent metadata for grandparent_rating_key %s" \ logger.error(u"PlexPy Monitor :: Unable to retrieve grandparent metadata for grandparent_rating_key %s" \
% str(item['rating_key'])) % str(item['rating_key']))
logger.debug(u"PlexPy Monitor :: Library item %s has been added to Plex." % str(item['rating_key'])) logger.debug(u"PlexPy Monitor :: Library item %s added to Plex." % str(item['rating_key']))
# Check if any notification agents have notifications enabled # Check if any notification agents have notifications enabled
plexpy.NOTIFY_QUEUE.put({'timeline_data': item, 'notify_action': 'on_created'}) plexpy.NOTIFY_QUEUE.put({'timeline_data': item, 'notify_action': 'on_created'})