mirror of
https://github.com/Tautulli/Tautulli.git
synced 2025-07-06 13:11:15 -07:00
Check cloud status on startup before connecting websocket
This commit is contained in:
parent
a5d2467bfe
commit
a53afe05a2
3 changed files with 13 additions and 3 deletions
|
@ -196,7 +196,7 @@ def main():
|
||||||
|
|
||||||
# Open connection for websocket
|
# Open connection for websocket
|
||||||
try:
|
try:
|
||||||
web_socket.start_thread()
|
web_socket.start_thread(startup=True)
|
||||||
except:
|
except:
|
||||||
logger.warn(u"Websocket :: Unable to open connection.")
|
logger.warn(u"Websocket :: Unable to open connection.")
|
||||||
plexpy.initialize_scheduler()
|
plexpy.initialize_scheduler()
|
||||||
|
|
|
@ -328,7 +328,7 @@ def check_server_updates():
|
||||||
logger.info(u"Tautulli Monitor :: No PMS update available.")
|
logger.info(u"Tautulli Monitor :: No PMS update available.")
|
||||||
|
|
||||||
|
|
||||||
def check_cloud_status(log=False):
|
def check_cloud_status(log=False, return_status=False):
|
||||||
if log:
|
if log:
|
||||||
logger.info(u"Tautulli Monitor :: Checking for Plex Cloud server status...")
|
logger.info(u"Tautulli Monitor :: Checking for Plex Cloud server status...")
|
||||||
|
|
||||||
|
@ -337,7 +337,11 @@ def check_cloud_status(log=False):
|
||||||
|
|
||||||
if cloud_status:
|
if cloud_status:
|
||||||
logger.info(u"Tautulli Monitor :: Plex Cloud server is active.")
|
logger.info(u"Tautulli Monitor :: Plex Cloud server is active.")
|
||||||
|
if return_status:
|
||||||
|
return cloud_status
|
||||||
check_server_response()
|
check_server_response()
|
||||||
else:
|
else:
|
||||||
if log:
|
if log:
|
||||||
logger.info(u"Tautulli Monitor :: Plex Cloud server is sleeping.")
|
logger.info(u"Tautulli Monitor :: Plex Cloud server is sleeping.")
|
||||||
|
if return_status:
|
||||||
|
return cloud_status
|
||||||
|
|
|
@ -32,7 +32,13 @@ opcode_data = (websocket.ABNF.OPCODE_TEXT, websocket.ABNF.OPCODE_BINARY)
|
||||||
ws_reconnect = False
|
ws_reconnect = False
|
||||||
|
|
||||||
|
|
||||||
def start_thread():
|
def start_thread(startup=False):
|
||||||
|
if startup and plexpy.CONFIG.PMS_IS_CLOUD and plexpy.PLEX_SERVER_UP is None:
|
||||||
|
plexpy.PLEX_SERVER_UP = activity_pinger.check_cloud_status(log=True, return_status=True)
|
||||||
|
if not plexpy.PLEX_SERVER_UP:
|
||||||
|
on_disconnect()
|
||||||
|
return
|
||||||
|
|
||||||
if plexpy.CONFIG.FIRST_RUN_COMPLETE:
|
if plexpy.CONFIG.FIRST_RUN_COMPLETE:
|
||||||
# Check for any existing sessions on start up
|
# Check for any existing sessions on start up
|
||||||
activity_pinger.check_active_sessions(ws_request=True)
|
activity_pinger.check_active_sessions(ws_request=True)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue