mirror of
https://github.com/Tautulli/Tautulli.git
synced 2025-07-16 02:02:58 -07:00
Merge branch 'nightly' into v2-newsletter
This commit is contained in:
commit
d3f6812178
8 changed files with 40 additions and 37 deletions
|
@ -1625,13 +1625,16 @@ def dbcheck():
|
|||
)
|
||||
|
||||
# Rename notifiers in the database
|
||||
logger.debug(u"Altering database. Renaming notifiers.")
|
||||
c_db.execute(
|
||||
'UPDATE notifiers SET agent_label = "Kodi" WHERE agent_label = "XBMC"'
|
||||
)
|
||||
c_db.execute(
|
||||
'UPDATE notifiers SET agent_label = "macOS Notification Center" WHERE agent_label = "OSX Notify"'
|
||||
)
|
||||
result = c_db.execute('SELECT agent_label FROM notifiers '
|
||||
'WHERE agent_label = "XBMC" OR agent_label = "OSX Notify"').fetchone()
|
||||
if result:
|
||||
logger.debug(u"Altering database. Renaming notifiers.")
|
||||
c_db.execute(
|
||||
'UPDATE notifiers SET agent_label = "Kodi" WHERE agent_label = "XBMC"'
|
||||
)
|
||||
c_db.execute(
|
||||
'UPDATE notifiers SET agent_label = "macOS Notification Center" WHERE agent_label = "OSX Notify"'
|
||||
)
|
||||
|
||||
# Add "Local" user to database as default unauthenticated user.
|
||||
result = c_db.execute('SELECT id FROM users WHERE username = "Local"')
|
||||
|
|
|
@ -293,8 +293,8 @@ def connect_server(log=True, startup=False):
|
|||
|
||||
try:
|
||||
web_socket.start_thread()
|
||||
except:
|
||||
logger.error(u"Websocket :: Unable to open connection.")
|
||||
except Exception as e:
|
||||
logger.error(u"Websocket :: Unable to open connection: %s." % e)
|
||||
|
||||
|
||||
def check_server_access():
|
||||
|
|
|
@ -1512,7 +1512,8 @@ class PmsConnect(object):
|
|||
if media_type not in ('photo', 'clip') \
|
||||
and not session.getElementsByTagName('Session') \
|
||||
and not session.getElementsByTagName('TranscodeSession') \
|
||||
and helpers.get_xml_attr(session, 'ratingKey').isdigit():
|
||||
and helpers.get_xml_attr(session, 'ratingKey').isdigit() \
|
||||
and plexpy.CONFIG.PMS_PLEXPASS:
|
||||
plex_tv = plextv.PlexTV()
|
||||
parent_rating_key = helpers.get_xml_attr(session, 'parentRatingKey')
|
||||
grandparent_rating_key = helpers.get_xml_attr(session, 'grandparentRatingKey')
|
||||
|
|
|
@ -1,2 +1,2 @@
|
|||
PLEXPY_BRANCH = "master"
|
||||
PLEXPY_RELEASE_VERSION = "v2.0.24"
|
||||
PLEXPY_RELEASE_VERSION = "v2.0.25"
|
||||
|
|
|
@ -25,6 +25,7 @@ import plexpy
|
|||
import activity_handler
|
||||
import activity_pinger
|
||||
import activity_processor
|
||||
import database
|
||||
import logger
|
||||
|
||||
name = 'websocket'
|
||||
|
@ -33,8 +34,14 @@ ws_shutdown = False
|
|||
|
||||
|
||||
def start_thread():
|
||||
# Check for any existing sessions on start up
|
||||
activity_pinger.check_active_sessions(ws_request=True)
|
||||
try:
|
||||
# Check for any existing sessions on start up
|
||||
activity_pinger.check_active_sessions(ws_request=True)
|
||||
except Exception as e:
|
||||
logger.error(u"Tautulli WebSocket :: Failed to check for active sessions: %s." % e)
|
||||
logger.warn(u"Tautulli WebSocket :: Attempt to fix by flushing temporary sessions...")
|
||||
database.delete_sessions()
|
||||
|
||||
# Start the websocket listener on it's own thread
|
||||
thread = threading.Thread(target=run)
|
||||
thread.daemon = True
|
||||
|
@ -67,7 +74,7 @@ def on_disconnect():
|
|||
|
||||
|
||||
def reconnect():
|
||||
shutdown()
|
||||
close()
|
||||
logger.info(u"Tautulli WebSocket :: Reconnecting websocket...")
|
||||
start_thread()
|
||||
|
||||
|
@ -75,7 +82,10 @@ def reconnect():
|
|||
def shutdown():
|
||||
global ws_shutdown
|
||||
ws_shutdown = True
|
||||
close()
|
||||
|
||||
|
||||
def close():
|
||||
logger.info(u"Tautulli WebSocket :: Disconnecting websocket...")
|
||||
plexpy.WEBSOCKET.close()
|
||||
plexpy.WS_CONNECTED = False
|
||||
|
@ -122,7 +132,7 @@ def run():
|
|||
logger.info(u"Tautulli WebSocket :: Ready")
|
||||
plexpy.WS_CONNECTED = True
|
||||
except (websocket.WebSocketException, IOError, Exception) as e:
|
||||
logger.error(u"Tautulli WebSocket :: %s." % e)
|
||||
logger.error("Tautulli WebSocket :: %s." % e)
|
||||
|
||||
if plexpy.WS_CONNECTED:
|
||||
on_connect()
|
||||
|
@ -155,18 +165,18 @@ def run():
|
|||
logger.info(u"Tautulli WebSocket :: Ready")
|
||||
plexpy.WS_CONNECTED = True
|
||||
except (websocket.WebSocketException, IOError, Exception) as e:
|
||||
logger.error(u"Tautulli WebSocket :: %s." % e)
|
||||
logger.error("Tautulli WebSocket :: %s." % e)
|
||||
|
||||
else:
|
||||
shutdown()
|
||||
close()
|
||||
break
|
||||
|
||||
except (websocket.WebSocketException, Exception) as e:
|
||||
if ws_shutdown:
|
||||
break
|
||||
|
||||
logger.error(u"Tautulli WebSocket :: %s." % e)
|
||||
shutdown()
|
||||
logger.error("Tautulli WebSocket :: %s." % e)
|
||||
close()
|
||||
break
|
||||
|
||||
if not plexpy.WS_CONNECTED and not ws_shutdown:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue