mirror of
https://github.com/Tautulli/Tautulli.git
synced 2025-07-11 07:46:07 -07:00
Address the repetitive notify/logging issue when multiple streams are active.
This commit is contained in:
parent
9152fa01af
commit
d7c5046569
1 changed files with 9 additions and 14 deletions
|
@ -92,29 +92,24 @@ def check_active_sessions():
|
|||
'transcode_height': result[37]
|
||||
}
|
||||
|
||||
if any(d['session_key'] == str(stream['session_key']) for d in media_container):
|
||||
if any(d['session_key'] == str(stream['session_key']) and d['rating_key'] == str(stream['rating_key'])
|
||||
for d in media_container):
|
||||
# The user's session is still active
|
||||
for session in media_container:
|
||||
if session['rating_key'] == str(stream['rating_key']):
|
||||
if session['session_key'] == str(stream['session_key']) and \
|
||||
session['rating_key'] == str(stream['rating_key']):
|
||||
# The user is still playing the same media item
|
||||
# Here we can check the play states
|
||||
if session['state'] != stream['state']:
|
||||
if session['state'] == 'paused':
|
||||
# Push any notifications
|
||||
notify(stream_data=stream, notify_action='pause')
|
||||
else:
|
||||
# The user has stopped playing a stream
|
||||
logger.debug(u"Removing sessionKey %s ratingKey %s from session queue"
|
||||
% (stream['session_key'], stream['rating_key']))
|
||||
monitor_db.action('DELETE FROM sessions WHERE session_key = ? AND rating_key = ?',
|
||||
[stream['session_key'], stream['rating_key']])
|
||||
# Push any notifications
|
||||
notify(stream_data=stream, notify_action='stop')
|
||||
monitor_process.write_session_history(session=stream)
|
||||
else:
|
||||
# The user's session is no longer active
|
||||
logger.debug(u"Removing sessionKey %s from session queue" % stream['session_key'])
|
||||
monitor_db.action('DELETE FROM sessions WHERE session_key = ?', [stream['session_key']])
|
||||
# The user has stopped playing a stream
|
||||
logger.debug(u"Removing sessionKey %s ratingKey %s from session queue"
|
||||
% (stream['session_key'], stream['rating_key']))
|
||||
monitor_db.action('DELETE FROM sessions WHERE session_key = ? AND rating_key = ?',
|
||||
[stream['session_key'], stream['rating_key']])
|
||||
# Push any notifications
|
||||
notify(stream_data=stream, notify_action='stop')
|
||||
monitor_process.write_session_history(session=stream)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue