mirror of
https://github.com/Tautulli/Tautulli.git
synced 2025-07-10 23:42:37 -07:00
Temporarily set stopped time when connection is lost
This commit is contained in:
parent
62d05e5e08
commit
5dd04cb8ab
2 changed files with 13 additions and 6 deletions
|
@ -173,6 +173,7 @@ def check_active_sessions(ws_request=False):
|
||||||
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 has stopped." % stream['session_key'])
|
||||||
|
|
||||||
|
if not stream['stopped']:
|
||||||
# Set the stream stop time
|
# Set the stream stop time
|
||||||
stream['stopped'] = int(time.time())
|
stream['stopped'] = int(time.time())
|
||||||
monitor_db.action('UPDATE sessions SET stopped = ?, state = ? '
|
monitor_db.action('UPDATE sessions SET stopped = ?, state = ? '
|
||||||
|
@ -236,6 +237,11 @@ def check_active_sessions(ws_request=False):
|
||||||
else:
|
else:
|
||||||
logger.debug(u"PlexPy Monitor :: Unable to read session list.")
|
logger.debug(u"PlexPy Monitor :: Unable to read session list.")
|
||||||
|
|
||||||
|
if int_ping_count == 0:
|
||||||
|
# Temporarily set the stopped time for all sessions
|
||||||
|
stopped_time = int(time.time())
|
||||||
|
monitor_db.action('UPDATE sessions SET stopped = ?', [stopped_time])
|
||||||
|
|
||||||
int_ping_count += 1
|
int_ping_count += 1
|
||||||
logger.warn(u"PlexPy Monitor :: Unable to get an internal response from the server, ping attempt %s." \
|
logger.warn(u"PlexPy Monitor :: Unable to get an internal response from the server, ping attempt %s." \
|
||||||
% str(int_ping_count))
|
% str(int_ping_count))
|
||||||
|
|
|
@ -82,7 +82,8 @@ class ActivityProcessor(object):
|
||||||
'transcode_audio_codec': session['transcode_audio_codec'],
|
'transcode_audio_codec': session['transcode_audio_codec'],
|
||||||
'transcode_audio_channels': session['transcode_audio_channels'],
|
'transcode_audio_channels': session['transcode_audio_channels'],
|
||||||
'transcode_width': session['transcode_width'],
|
'transcode_width': session['transcode_width'],
|
||||||
'transcode_height': session['transcode_height']
|
'transcode_height': session['transcode_height'],
|
||||||
|
'stopped': None
|
||||||
}
|
}
|
||||||
|
|
||||||
# Add ip_address back into values
|
# Add ip_address back into values
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue