mirror of
https://github.com/Tautulli/Tautulli.git
synced 2025-08-14 02:26:58 -07:00
Remove unicode strings
This commit is contained in:
parent
1c18e72539
commit
c279057f91
28 changed files with 834 additions and 847 deletions
|
@ -48,7 +48,7 @@ def check_active_sessions(ws_request=False):
|
|||
pms_connect = pmsconnect.PmsConnect()
|
||||
session_list = pms_connect.get_current_activity()
|
||||
|
||||
logger.debug(u"Tautulli Monitor :: Checking for active streams.")
|
||||
logger.debug("Tautulli Monitor :: Checking for active streams.")
|
||||
|
||||
if session_list:
|
||||
media_container = session_list['sessions']
|
||||
|
@ -65,12 +65,12 @@ def check_active_sessions(ws_request=False):
|
|||
# Here we can check the play states
|
||||
if session['state'] != stream['state']:
|
||||
if session['state'] == 'paused':
|
||||
logger.debug(u"Tautulli Monitor :: Session %s paused." % stream['session_key'])
|
||||
logger.debug("Tautulli Monitor :: Session %s paused." % stream['session_key'])
|
||||
|
||||
plexpy.NOTIFY_QUEUE.put({'stream_data': stream.copy(), 'notify_action': 'on_pause'})
|
||||
|
||||
if session['state'] == 'playing' and stream['state'] == 'paused':
|
||||
logger.debug(u"Tautulli Monitor :: Session %s resumed." % stream['session_key'])
|
||||
logger.debug("Tautulli Monitor :: Session %s resumed." % stream['session_key'])
|
||||
|
||||
plexpy.NOTIFY_QUEUE.put({'stream_data': stream.copy(), 'notify_action': 'on_resume'})
|
||||
|
||||
|
@ -102,7 +102,7 @@ def check_active_sessions(ws_request=False):
|
|||
# Push it on it's own thread so we don't hold up our db actions
|
||||
# Our first buffer notification
|
||||
if buffer_values[0]['buffer_count'] == plexpy.CONFIG.BUFFER_THRESHOLD:
|
||||
logger.info(u"Tautulli Monitor :: User '%s' has triggered a buffer warning."
|
||||
logger.info("Tautulli Monitor :: User '%s' has triggered a buffer warning."
|
||||
% stream['user'])
|
||||
# Set the buffer trigger time
|
||||
monitor_db.action('UPDATE sessions '
|
||||
|
@ -116,7 +116,7 @@ def check_active_sessions(ws_request=False):
|
|||
# Subsequent buffer notifications after wait time
|
||||
if int(time.time()) > buffer_values[0]['buffer_last_triggered'] + \
|
||||
plexpy.CONFIG.BUFFER_WAIT:
|
||||
logger.info(u"Tautulli Monitor :: User '%s' has triggered multiple buffer warnings."
|
||||
logger.info("Tautulli Monitor :: User '%s' has triggered multiple buffer warnings."
|
||||
% stream['user'])
|
||||
# Set the buffer trigger time
|
||||
monitor_db.action('UPDATE sessions '
|
||||
|
@ -126,7 +126,7 @@ def check_active_sessions(ws_request=False):
|
|||
|
||||
plexpy.NOTIFY_QUEUE.put({'stream_data': stream.copy(), 'notify_action': 'on_buffer'})
|
||||
|
||||
logger.debug(u"Tautulli Monitor :: Session %s is buffering. Count is now %s. Last triggered %s."
|
||||
logger.debug("Tautulli Monitor :: Session %s is buffering. Count is now %s. Last triggered %s."
|
||||
% (stream['session_key'],
|
||||
buffer_values[0]['buffer_count'],
|
||||
buffer_values[0]['buffer_last_triggered']))
|
||||
|
@ -146,7 +146,7 @@ def check_active_sessions(ws_request=False):
|
|||
else:
|
||||
# The user has stopped playing a stream
|
||||
if stream['state'] != 'stopped':
|
||||
logger.debug(u"Tautulli Monitor :: Session %s stopped." % stream['session_key'])
|
||||
logger.debug("Tautulli Monitor :: Session %s stopped." % stream['session_key'])
|
||||
|
||||
if not stream['stopped']:
|
||||
# Set the stream stop time
|
||||
|
@ -170,22 +170,22 @@ def check_active_sessions(ws_request=False):
|
|||
|
||||
if row_id:
|
||||
# If session is written to the databaase successfully, remove the session from the session table
|
||||
logger.debug(u"Tautulli Monitor :: Removing sessionKey %s ratingKey %s from session queue"
|
||||
logger.debug("Tautulli Monitor :: Removing sessionKey %s ratingKey %s from session queue"
|
||||
% (stream['session_key'], stream['rating_key']))
|
||||
monitor_process.delete_session(row_id=row_id)
|
||||
else:
|
||||
stream['write_attempts'] += 1
|
||||
|
||||
if stream['write_attempts'] < plexpy.CONFIG.SESSION_DB_WRITE_ATTEMPTS:
|
||||
logger.warn(u"Tautulli Monitor :: Failed to write sessionKey %s ratingKey %s to the database. " \
|
||||
logger.warn("Tautulli Monitor :: Failed to write sessionKey %s ratingKey %s to the database. " \
|
||||
"Will try again on the next pass. Write attempt %s."
|
||||
% (stream['session_key'], stream['rating_key'], str(stream['write_attempts'])))
|
||||
monitor_process.increment_write_attempts(session_key=stream['session_key'])
|
||||
else:
|
||||
logger.warn(u"Tautulli Monitor :: Failed to write sessionKey %s ratingKey %s to the database. " \
|
||||
logger.warn("Tautulli Monitor :: Failed to write sessionKey %s ratingKey %s to the database. " \
|
||||
"Removing session from the database. Write attempt %s."
|
||||
% (stream['session_key'], stream['rating_key'], str(stream['write_attempts'])))
|
||||
logger.debug(u"Tautulli Monitor :: Removing sessionKey %s ratingKey %s from session queue"
|
||||
logger.debug("Tautulli Monitor :: Removing sessionKey %s ratingKey %s from session queue"
|
||||
% (stream['session_key'], stream['rating_key']))
|
||||
monitor_process.delete_session(session_key=stream['session_key'])
|
||||
|
||||
|
@ -194,11 +194,11 @@ def check_active_sessions(ws_request=False):
|
|||
new_session = monitor_process.write_session(session)
|
||||
|
||||
if new_session:
|
||||
logger.debug(u"Tautulli Monitor :: Session %s started by user %s with ratingKey %s."
|
||||
logger.debug("Tautulli Monitor :: Session %s started by user %s with ratingKey %s."
|
||||
% (session['session_key'], session['user_id'], session['rating_key']))
|
||||
|
||||
else:
|
||||
logger.debug(u"Tautulli Monitor :: Unable to read session list.")
|
||||
logger.debug("Tautulli Monitor :: Unable to read session list.")
|
||||
|
||||
|
||||
def check_recently_added():
|
||||
|
@ -230,13 +230,13 @@ def check_recently_added():
|
|||
if metadata:
|
||||
metadata = [metadata]
|
||||
else:
|
||||
logger.error(u"Tautulli Monitor :: Unable to retrieve metadata for rating_key %s" \
|
||||
logger.error("Tautulli Monitor :: Unable to retrieve metadata for rating_key %s" \
|
||||
% str(item['rating_key']))
|
||||
|
||||
else:
|
||||
metadata = pms_connect.get_metadata_children_details(item['rating_key'])
|
||||
if not metadata:
|
||||
logger.error(u"Tautulli Monitor :: Unable to retrieve children metadata for rating_key %s" \
|
||||
logger.error("Tautulli Monitor :: Unable to retrieve children metadata for rating_key %s" \
|
||||
% str(item['rating_key']))
|
||||
|
||||
if metadata:
|
||||
|
@ -247,7 +247,7 @@ def check_recently_added():
|
|||
library_details = library_data.get_details(section_id=item['section_id'])
|
||||
|
||||
if 0 < time_threshold - int(item['added_at']) <= time_interval:
|
||||
logger.debug(u"Tautulli Monitor :: Library item %s added to Plex." % str(item['rating_key']))
|
||||
logger.debug("Tautulli Monitor :: Library item %s added to Plex." % str(item['rating_key']))
|
||||
|
||||
plexpy.NOTIFY_QUEUE.put({'timeline_data': item.copy(), 'notify_action': 'on_created'})
|
||||
|
||||
|
@ -261,10 +261,10 @@ def check_recently_added():
|
|||
if metadata:
|
||||
item = metadata
|
||||
else:
|
||||
logger.error(u"Tautulli Monitor :: Unable to retrieve grandparent metadata for grandparent_rating_key %s" \
|
||||
logger.error("Tautulli Monitor :: Unable to retrieve grandparent metadata for grandparent_rating_key %s" \
|
||||
% str(item['rating_key']))
|
||||
|
||||
logger.debug(u"Tautulli Monitor :: Library item %s added to Plex." % str(item['rating_key']))
|
||||
logger.debug("Tautulli Monitor :: Library item %s added to Plex." % str(item['rating_key']))
|
||||
|
||||
# Check if any notification agents have notifications enabled
|
||||
plexpy.NOTIFY_QUEUE.put({'timeline_data': item.copy(), 'notify_action': 'on_created'})
|
||||
|
@ -273,19 +273,19 @@ def check_recently_added():
|
|||
def connect_server(log=True, startup=False):
|
||||
if plexpy.CONFIG.PMS_IS_CLOUD:
|
||||
if log:
|
||||
logger.info(u"Tautulli Monitor :: Checking for Plex Cloud server status...")
|
||||
logger.info("Tautulli Monitor :: Checking for Plex Cloud server status...")
|
||||
|
||||
plex_tv = plextv.PlexTV()
|
||||
status = plex_tv.get_cloud_server_status()
|
||||
|
||||
if status is True:
|
||||
logger.info(u"Tautulli Monitor :: Plex Cloud server is active.")
|
||||
logger.info("Tautulli Monitor :: Plex Cloud server is active.")
|
||||
elif status is False:
|
||||
if log:
|
||||
logger.info(u"Tautulli Monitor :: Plex Cloud server is sleeping.")
|
||||
logger.info("Tautulli Monitor :: Plex Cloud server is sleeping.")
|
||||
else:
|
||||
if log:
|
||||
logger.error(u"Tautulli Monitor :: Failed to retrieve Plex Cloud server status.")
|
||||
logger.error("Tautulli Monitor :: Failed to retrieve Plex Cloud server status.")
|
||||
|
||||
if not status and startup:
|
||||
web_socket.on_disconnect()
|
||||
|
@ -295,12 +295,12 @@ def connect_server(log=True, startup=False):
|
|||
|
||||
if status:
|
||||
if log and not startup:
|
||||
logger.info(u"Tautulli Monitor :: Attempting to reconnect Plex server...")
|
||||
logger.info("Tautulli Monitor :: Attempting to reconnect Plex server...")
|
||||
|
||||
try:
|
||||
web_socket.start_thread()
|
||||
except Exception as e:
|
||||
logger.error(u"Websocket :: Unable to open connection: %s." % e)
|
||||
logger.error("Websocket :: Unable to open connection: %s." % e)
|
||||
|
||||
|
||||
def check_server_access():
|
||||
|
@ -319,17 +319,17 @@ def check_server_access():
|
|||
# Check if the port is mapped
|
||||
if not mapping_state == 'mapped':
|
||||
ext_ping_count += 1
|
||||
logger.warn(u"Tautulli Monitor :: Plex remote access port not mapped, ping attempt %s." \
|
||||
logger.warn("Tautulli Monitor :: Plex remote access port not mapped, ping attempt %s." \
|
||||
% str(ext_ping_count))
|
||||
# Check if the port is open
|
||||
elif mapping_error == 'unreachable':
|
||||
ext_ping_count += 1
|
||||
logger.warn(u"Tautulli Monitor :: Plex remote access port mapped, but mapping failed, ping attempt %s." \
|
||||
logger.warn("Tautulli Monitor :: Plex remote access port mapped, but mapping failed, ping attempt %s." \
|
||||
% str(ext_ping_count))
|
||||
# Reset external ping counter
|
||||
else:
|
||||
if ext_ping_count >= plexpy.CONFIG.REMOTE_ACCESS_PING_THRESHOLD:
|
||||
logger.info(u"Tautulli Monitor :: Plex remote access is back up.")
|
||||
logger.info("Tautulli Monitor :: Plex remote access is back up.")
|
||||
|
||||
plexpy.NOTIFY_QUEUE.put({'notify_action': 'on_extup'})
|
||||
|
||||
|
@ -342,18 +342,18 @@ def check_server_access():
|
|||
def check_server_updates():
|
||||
|
||||
with monitor_lock:
|
||||
logger.info(u"Tautulli Monitor :: Checking for PMS updates...")
|
||||
logger.info("Tautulli Monitor :: Checking for PMS updates...")
|
||||
|
||||
plex_tv = plextv.PlexTV()
|
||||
download_info = plex_tv.get_plex_downloads()
|
||||
|
||||
if download_info:
|
||||
logger.info(u"Tautulli Monitor :: Current PMS version: %s", plexpy.CONFIG.PMS_VERSION)
|
||||
logger.info("Tautulli Monitor :: Current PMS version: %s", plexpy.CONFIG.PMS_VERSION)
|
||||
|
||||
if download_info['update_available']:
|
||||
logger.info(u"Tautulli Monitor :: PMS update available version: %s", download_info['version'])
|
||||
logger.info("Tautulli Monitor :: PMS update available version: %s", download_info['version'])
|
||||
|
||||
plexpy.NOTIFY_QUEUE.put({'notify_action': 'on_pmsupdate', 'pms_download_info': download_info})
|
||||
|
||||
else:
|
||||
logger.info(u"Tautulli Monitor :: No PMS update available.")
|
||||
logger.info("Tautulli Monitor :: No PMS update available.")
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue