mirror of
https://github.com/Tautulli/Tautulli.git
synced 2025-07-11 07:46:07 -07:00
Set temporary session stop times on websocket disconnect
This commit is contained in:
parent
fd35295093
commit
d8cc76c7d7
2 changed files with 11 additions and 1 deletions
|
@ -467,3 +467,7 @@ class ActivityProcessor(object):
|
||||||
'WHERE user_id = ? %s' % ip,
|
'WHERE user_id = ? %s' % ip,
|
||||||
[user_id])
|
[user_id])
|
||||||
return sessions
|
return sessions
|
||||||
|
|
||||||
|
def set_temp_stopped(self):
|
||||||
|
stopped_time = int(time.time())
|
||||||
|
monitor_db.action('UPDATE sessions SET stopped = ?', [stopped_time])
|
|
@ -24,6 +24,7 @@ import websocket
|
||||||
import plexpy
|
import plexpy
|
||||||
import activity_handler
|
import activity_handler
|
||||||
import activity_pinger
|
import activity_pinger
|
||||||
|
import activity_processor
|
||||||
import logger
|
import logger
|
||||||
|
|
||||||
name = 'websocket'
|
name = 'websocket'
|
||||||
|
@ -38,6 +39,10 @@ def start_thread():
|
||||||
threading.Thread(target=run).start()
|
threading.Thread(target=run).start()
|
||||||
|
|
||||||
|
|
||||||
|
def on_disconnect():
|
||||||
|
activity_processor.ActivityProcessor().set_temp_stopped()
|
||||||
|
|
||||||
|
|
||||||
def reconnect():
|
def reconnect():
|
||||||
global ws_reconnect
|
global ws_reconnect
|
||||||
ws_reconnect = True
|
ws_reconnect = True
|
||||||
|
@ -126,6 +131,7 @@ def run():
|
||||||
logger.info(u"PlexPy WebSocket :: Unable to get an internal response from the server, Plex server is down.")
|
logger.info(u"PlexPy WebSocket :: Unable to get an internal response from the server, Plex server is down.")
|
||||||
plexpy.NOTIFY_QUEUE.put({'notify_action': 'on_intdown'})
|
plexpy.NOTIFY_QUEUE.put({'notify_action': 'on_intdown'})
|
||||||
plexpy.PLEX_SERVER_UP = False
|
plexpy.PLEX_SERVER_UP = False
|
||||||
|
on_disconnect()
|
||||||
|
|
||||||
plexpy.initialize_scheduler()
|
plexpy.initialize_scheduler()
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue