mirror of
https://github.com/Tautulli/Tautulli.git
synced 2025-07-11 07:46:07 -07:00
Add {transcode_key} and {username} notification options
This commit is contained in:
parent
71d023ab77
commit
74a232630a
7 changed files with 35 additions and 5 deletions
|
@ -1484,6 +1484,10 @@ available_notification_agents = sorted(notifiers.available_notification_agents()
|
|||
</tr>
|
||||
<tr>
|
||||
<td><strong>{user}</strong></td>
|
||||
<td>The friendly name of the person streaming.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><strong>{username}</strong></td>
|
||||
<td>The username of the person streaming.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
|
@ -1604,7 +1608,11 @@ available_notification_agents = sorted(notifiers.available_notification_agents()
|
|||
</tr>
|
||||
<tr>
|
||||
<td><strong>{session_key}</strong></td>
|
||||
<td>The unique identifier for the session.</td>
|
||||
<td>The unique identifier for the stream session.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><strong>{transcode_key}</strong></td>
|
||||
<td>The unique identifier for the transcode session.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><strong>{user_id}</strong></td>
|
||||
|
|
|
@ -396,8 +396,8 @@ def dbcheck():
|
|||
|
||||
# sessions table :: This is a temp table that logs currently active sessions
|
||||
c_db.execute(
|
||||
'CREATE TABLE IF NOT EXISTS sessions (id INTEGER PRIMARY KEY AUTOINCREMENT, '
|
||||
'session_key INTEGER, rating_key INTEGER, section_id INTEGER, media_type TEXT, started INTEGER, stopped INTEGER, '
|
||||
'CREATE TABLE IF NOT EXISTS sessions (id INTEGER PRIMARY KEY AUTOINCREMENT, session_key INTEGER, '
|
||||
'transcode_key TEXT, rating_key INTEGER, section_id INTEGER, media_type TEXT, started INTEGER, stopped INTEGER, '
|
||||
'paused_counter INTEGER DEFAULT 0, state TEXT, user_id INTEGER, user TEXT, friendly_name TEXT, '
|
||||
'ip_address TEXT, machine_id TEXT, player TEXT, platform TEXT, title TEXT, parent_title TEXT, '
|
||||
'grandparent_title TEXT, parent_rating_key INTEGER, grandparent_rating_key INTEGER, '
|
||||
|
@ -630,6 +630,15 @@ def dbcheck():
|
|||
'ALTER TABLE sessions ADD COLUMN stopped INTEGER'
|
||||
)
|
||||
|
||||
# Upgrade sessions table from earlier versions
|
||||
try:
|
||||
c_db.execute('SELECT transcode_key FROM sessions')
|
||||
except sqlite3.OperationalError:
|
||||
logger.debug(u"Altering database. Updating database table sessions.")
|
||||
c_db.execute(
|
||||
'ALTER TABLE sessions ADD COLUMN transcode_key TEXT'
|
||||
)
|
||||
|
||||
# Upgrade session_history table from earlier versions
|
||||
try:
|
||||
c_db.execute('SELECT reference_id FROM session_history')
|
||||
|
|
|
@ -29,6 +29,7 @@ class ActivityProcessor(object):
|
|||
def write_session(self, session=None, notify=True):
|
||||
if session:
|
||||
values = {'session_key': session['session_key'],
|
||||
'transcode_key': session['transcode_key'],
|
||||
'section_id': session['section_id'],
|
||||
'rating_key': session['rating_key'],
|
||||
'media_type': session['media_type'],
|
||||
|
|
|
@ -660,6 +660,7 @@ def build_notify_text(session=None, timeline=None, notify_action=None, agent_id=
|
|||
# Stream parameters
|
||||
'streams': stream_count,
|
||||
'user': session.get('friendly_name',''),
|
||||
'username': session.get('user',''),
|
||||
'platform': session.get('platform',''),
|
||||
'player': session.get('player',''),
|
||||
'ip_address': session.get('ip_address','N/A'),
|
||||
|
@ -690,6 +691,7 @@ def build_notify_text(session=None, timeline=None, notify_action=None, agent_id=
|
|||
'transcode_audio_codec': session.get('transcode_audio_codec',''),
|
||||
'transcode_audio_channels': session.get('transcode_audio_channels',''),
|
||||
'session_key': session.get('session_key',''),
|
||||
'transcode_key': session.get('transcode_key',''),
|
||||
'user_id': session.get('user_id',''),
|
||||
'machine_id': session.get('machine_id',''),
|
||||
# Metadata parameters
|
||||
|
|
|
@ -1884,7 +1884,7 @@ class Scripts(object):
|
|||
script_args(list): ["python2", '-p', '-zomg']
|
||||
"""
|
||||
logger.debug(u"PlexPy Notifiers :: Trying to run notify script, action: %s, arguments: %s" %
|
||||
(notify_action if notify_action else None, script_args if script_args else None))
|
||||
(notify_action or None, script_args or None))
|
||||
|
||||
if script_args is None:
|
||||
script_args = []
|
||||
|
|
|
@ -1001,6 +1001,7 @@ class PmsConnect(object):
|
|||
|
||||
if session.getElementsByTagName('TranscodeSession'):
|
||||
transcode_session = session.getElementsByTagName('TranscodeSession')[0]
|
||||
transcode_key = helpers.get_xml_attr(transcode_session, 'key')
|
||||
throttled = helpers.get_xml_attr(transcode_session, 'throttled')
|
||||
transcode_progress = helpers.get_xml_attr(transcode_session, 'progress')
|
||||
transcode_speed = helpers.get_xml_attr(transcode_session, 'speed')
|
||||
|
@ -1011,6 +1012,7 @@ class PmsConnect(object):
|
|||
transcode_protocol = helpers.get_xml_attr(transcode_session, 'protocol')
|
||||
duration = helpers.get_xml_attr(transcode_session, 'duration')
|
||||
else:
|
||||
transcode_key = ''
|
||||
throttled = '0'
|
||||
transcode_progress = '0'
|
||||
transcode_speed = ''
|
||||
|
@ -1051,6 +1053,7 @@ class PmsConnect(object):
|
|||
'rating_key': helpers.get_xml_attr(session, 'ratingKey'),
|
||||
'parent_rating_key': helpers.get_xml_attr(session, 'parentRatingKey'),
|
||||
'grandparent_rating_key': helpers.get_xml_attr(session, 'grandparentRatingKey'),
|
||||
'transcode_key': transcode_key,
|
||||
'throttled': throttled,
|
||||
'transcode_progress': int(round(helpers.cast_to_float(transcode_progress), 0)),
|
||||
'transcode_speed': str(round(helpers.cast_to_float(transcode_speed), 1)),
|
||||
|
@ -1099,6 +1102,7 @@ class PmsConnect(object):
|
|||
|
||||
if session.getElementsByTagName('TranscodeSession'):
|
||||
transcode_session = session.getElementsByTagName('TranscodeSession')[0]
|
||||
transcode_key = helpers.get_xml_attr(transcode_session, 'key')
|
||||
throttled = helpers.get_xml_attr(transcode_session, 'throttled')
|
||||
transcode_progress = helpers.get_xml_attr(transcode_session, 'progress')
|
||||
transcode_speed = helpers.get_xml_attr(transcode_session, 'speed')
|
||||
|
@ -1112,6 +1116,7 @@ class PmsConnect(object):
|
|||
transcode_container = helpers.get_xml_attr(transcode_session, 'container')
|
||||
transcode_protocol = helpers.get_xml_attr(transcode_session, 'protocol')
|
||||
else:
|
||||
transcode_key = ''
|
||||
throttled = '0'
|
||||
transcode_progress = '0'
|
||||
transcode_speed = ''
|
||||
|
@ -1174,6 +1179,7 @@ class PmsConnect(object):
|
|||
'rating_key': helpers.get_xml_attr(session, 'ratingKey'),
|
||||
'parent_rating_key': helpers.get_xml_attr(session, 'parentRatingKey'),
|
||||
'grandparent_rating_key': helpers.get_xml_attr(session, 'grandparentRatingKey'),
|
||||
'transcode_key': transcode_key,
|
||||
'throttled': throttled,
|
||||
'transcode_progress': int(round(helpers.cast_to_float(transcode_progress), 0)),
|
||||
'transcode_speed': str(round(helpers.cast_to_float(transcode_speed), 1)),
|
||||
|
@ -1232,6 +1238,7 @@ class PmsConnect(object):
|
|||
'rating_key': helpers.get_xml_attr(session, 'ratingKey'),
|
||||
'parent_rating_key': helpers.get_xml_attr(session, 'parentRatingKey'),
|
||||
'grandparent_rating_key': helpers.get_xml_attr(session, 'grandparentRatingKey'),
|
||||
'transcode_key': transcode_key,
|
||||
'throttled': throttled,
|
||||
'transcode_progress': int(round(helpers.cast_to_float(transcode_progress), 0)),
|
||||
'transcode_speed': str(round(helpers.cast_to_float(transcode_speed), 1)),
|
||||
|
@ -1290,6 +1297,7 @@ class PmsConnect(object):
|
|||
'rating_key': helpers.get_xml_attr(session, 'ratingKey'),
|
||||
'parent_rating_key': helpers.get_xml_attr(session, 'parentRatingKey'),
|
||||
'grandparent_rating_key': helpers.get_xml_attr(session, 'grandparentRatingKey'),
|
||||
'transcode_key': transcode_key,
|
||||
'throttled': throttled,
|
||||
'transcode_progress': int(round(helpers.cast_to_float(transcode_progress), 0)),
|
||||
'transcode_speed': str(round(helpers.cast_to_float(transcode_speed), 1)),
|
||||
|
@ -1329,6 +1337,7 @@ class PmsConnect(object):
|
|||
|
||||
if session.getElementsByTagName('TranscodeSession'):
|
||||
transcode_session = session.getElementsByTagName('TranscodeSession')[0]
|
||||
transcode_key = helpers.get_xml_attr(transcode_session, 'key')
|
||||
throttled = helpers.get_xml_attr(transcode_session, 'throttled')
|
||||
transcode_progress = helpers.get_xml_attr(transcode_session, 'progress')
|
||||
transcode_speed = helpers.get_xml_attr(transcode_session, 'speed')
|
||||
|
@ -1381,6 +1390,7 @@ class PmsConnect(object):
|
|||
'rating_key': helpers.get_xml_attr(session, 'ratingKey'),
|
||||
'parent_rating_key': helpers.get_xml_attr(session, 'parentRatingKey'),
|
||||
'grandparent_rating_key': helpers.get_xml_attr(session, 'grandparentRatingKey'),
|
||||
'transcode_key': transcode_key,
|
||||
'throttled': throttled,
|
||||
'transcode_progress': int(round(helpers.cast_to_float(transcode_progress), 0)),
|
||||
'transcode_speed': str(round(helpers.cast_to_float(transcode_speed), 1)),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue