mirror of
https://github.com/Tautulli/Tautulli.git
synced 2025-07-10 15:32:38 -07:00
Rename continued session to initial stream
This commit is contained in:
parent
4ece976dc8
commit
22bc0b3f9a
5 changed files with 13 additions and 13 deletions
|
@ -976,7 +976,7 @@
|
||||||
<p class="help-block">
|
<p class="help-block">
|
||||||
The number of seconds between stopping and starting a new stream to be considered as a continued session. Set to 0 to consider all streams as new sessions.
|
The number of seconds between stopping and starting a new stream to be considered as a continued session. Set to 0 to consider all streams as new sessions.
|
||||||
<br>
|
<br>
|
||||||
Note: The threshold is only used for the continued session notification parameter.
|
Note: The threshold is only used by the "Initial Stream" notification parameter to determine if a stream is the first stream of a continuous streaming session.
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
|
@ -610,7 +610,7 @@ def dbcheck():
|
||||||
'live INTEGER, live_uuid TEXT, channel_call_sign TEXT, channel_identifier TEXT, channel_thumb TEXT, '
|
'live INTEGER, live_uuid TEXT, channel_call_sign TEXT, channel_identifier TEXT, channel_thumb TEXT, '
|
||||||
'secure INTEGER, relayed INTEGER, '
|
'secure INTEGER, relayed INTEGER, '
|
||||||
'buffer_count INTEGER DEFAULT 0, buffer_last_triggered INTEGER, last_paused INTEGER, watched INTEGER DEFAULT 0, '
|
'buffer_count INTEGER DEFAULT 0, buffer_last_triggered INTEGER, last_paused INTEGER, watched INTEGER DEFAULT 0, '
|
||||||
'continued_session INTEGER DEFAULT 0, write_attempts INTEGER DEFAULT 0, raw_stream_info TEXT)'
|
'initial_stream INTEGER DEFAULT 1, write_attempts INTEGER DEFAULT 0, raw_stream_info TEXT)'
|
||||||
)
|
)
|
||||||
|
|
||||||
# sessions_continued table :: This is a temp table that keeps track of continued streaming sessions
|
# sessions_continued table :: This is a temp table that keeps track of continued streaming sessions
|
||||||
|
@ -1284,11 +1284,11 @@ def dbcheck():
|
||||||
|
|
||||||
# Upgrade sessions table from earlier versions
|
# Upgrade sessions table from earlier versions
|
||||||
try:
|
try:
|
||||||
c_db.execute('SELECT continued_session FROM sessions')
|
c_db.execute('SELECT initial_stream FROM sessions')
|
||||||
except sqlite3.OperationalError:
|
except sqlite3.OperationalError:
|
||||||
logger.debug(u"Altering database. Updating database table sessions.")
|
logger.debug(u"Altering database. Updating database table sessions.")
|
||||||
c_db.execute(
|
c_db.execute(
|
||||||
'ALTER TABLE sessions ADD COLUMN continued_session INTEGER DEFAULT 0'
|
'ALTER TABLE sessions ADD COLUMN initial_stream INTEGER DEFAULT 1'
|
||||||
)
|
)
|
||||||
|
|
||||||
# Upgrade session_history table from earlier versions
|
# Upgrade session_history table from earlier versions
|
||||||
|
|
|
@ -144,11 +144,11 @@ class ActivityProcessor(object):
|
||||||
if result == 'insert':
|
if result == 'insert':
|
||||||
# If it's our first write then time stamp it.
|
# If it's our first write then time stamp it.
|
||||||
started = int(time.time())
|
started = int(time.time())
|
||||||
continued_session = self.is_continued_session(user_id=values['user_id'],
|
initial_stream = self.is_initial_stream(user_id=values['user_id'],
|
||||||
machine_id=values['machine_id'],
|
machine_id=values['machine_id'],
|
||||||
media_type=values['media_type'],
|
media_type=values['media_type'],
|
||||||
started=started)
|
started=started)
|
||||||
timestamp = {'started': started, 'continued_session': continued_session}
|
timestamp = {'started': started, 'initial_stream': initial_stream}
|
||||||
self.db.upsert('sessions', timestamp, keys)
|
self.db.upsert('sessions', timestamp, keys)
|
||||||
|
|
||||||
# Check if any notification agents have notifications enabled
|
# Check if any notification agents have notifications enabled
|
||||||
|
@ -647,10 +647,10 @@ class ActivityProcessor(object):
|
||||||
values = {'stopped': stopped}
|
values = {'stopped': stopped}
|
||||||
self.db.upsert(table_name='sessions_continued', key_dict=keys, value_dict=values)
|
self.db.upsert(table_name='sessions_continued', key_dict=keys, value_dict=values)
|
||||||
|
|
||||||
def is_continued_session(self, user_id=None, machine_id=None, media_type=None, started=None):
|
def is_initial_stream(self, user_id=None, machine_id=None, media_type=None, started=None):
|
||||||
last_session = self.db.select_single('SELECT stopped '
|
last_session = self.db.select_single('SELECT stopped '
|
||||||
'FROM sessions_continued '
|
'FROM sessions_continued '
|
||||||
'WHERE user_id = ? AND machine_id = ? AND media_type = ? '
|
'WHERE user_id = ? AND machine_id = ? AND media_type = ? '
|
||||||
'ORDER BY stopped DESC',
|
'ORDER BY stopped DESC',
|
||||||
[user_id, machine_id, media_type])
|
[user_id, machine_id, media_type])
|
||||||
return int(started - last_session.get('stopped', 0) < plexpy.CONFIG.NOTIFY_CONTINUED_SESSION_THRESHOLD)
|
return int(started - last_session.get('stopped', 0) > plexpy.CONFIG.NOTIFY_CONTINUED_SESSION_THRESHOLD)
|
||||||
|
|
|
@ -359,6 +359,7 @@ NOTIFICATION_PARAMETERS = [
|
||||||
{'name': 'Platform', 'type': 'str', 'value': 'platform', 'description': 'The type of client platform being used for playback.'},
|
{'name': 'Platform', 'type': 'str', 'value': 'platform', 'description': 'The type of client platform being used for playback.'},
|
||||||
{'name': 'Product', 'type': 'str', 'value': 'product', 'description': 'The type of client product being used for playback.'},
|
{'name': 'Product', 'type': 'str', 'value': 'product', 'description': 'The type of client product being used for playback.'},
|
||||||
{'name': 'Player', 'type': 'str', 'value': 'player', 'description': 'The name of the player being used for playback.'},
|
{'name': 'Player', 'type': 'str', 'value': 'player', 'description': 'The name of the player being used for playback.'},
|
||||||
|
{'name': 'Initial Stream', 'type': 'int', 'value': 'initial_stream', 'description': 'If the stream is the initial stream of a continuous streaming session.', 'example': '0 or 1'},
|
||||||
{'name': 'IP Address', 'type': 'str', 'value': 'ip_address', 'description': 'The IP address of the device being used for playback.'},
|
{'name': 'IP Address', 'type': 'str', 'value': 'ip_address', 'description': 'The IP address of the device being used for playback.'},
|
||||||
{'name': 'Stream Duration', 'type': 'int', 'value': 'stream_duration', 'description': 'The duration (in minutes) for the stream.'},
|
{'name': 'Stream Duration', 'type': 'int', 'value': 'stream_duration', 'description': 'The duration (in minutes) for the stream.'},
|
||||||
{'name': 'Stream Time', 'type': 'str', 'value': 'stream_time', 'description': 'The duration (in time format) of the stream.'},
|
{'name': 'Stream Time', 'type': 'str', 'value': 'stream_time', 'description': 'The duration (in time format) of the stream.'},
|
||||||
|
@ -367,7 +368,6 @@ NOTIFICATION_PARAMETERS = [
|
||||||
{'name': 'Progress Duration', 'type': 'int', 'value': 'progress_duration', 'description': 'The last reported offset (in minutes) of the stream.'},
|
{'name': 'Progress Duration', 'type': 'int', 'value': 'progress_duration', 'description': 'The last reported offset (in minutes) of the stream.'},
|
||||||
{'name': 'Progress Time', 'type': 'str', 'value': 'progress_time', 'description': 'The last reported offset (in time format) of the stream.'},
|
{'name': 'Progress Time', 'type': 'str', 'value': 'progress_time', 'description': 'The last reported offset (in time format) of the stream.'},
|
||||||
{'name': 'Progress Percent', 'type': 'int', 'value': 'progress_percent', 'description': 'The last reported progress percent of the stream.'},
|
{'name': 'Progress Percent', 'type': 'int', 'value': 'progress_percent', 'description': 'The last reported progress percent of the stream.'},
|
||||||
{'name': 'Continued Session', 'type': 'int', 'value': 'continued_session', 'description': 'If the stream is continued from the previous streaming session.', 'example': '0 or 1'},
|
|
||||||
{'name': 'Transcode Decision', 'type': 'str', 'value': 'transcode_decision', 'description': 'The transcode decisions of the stream.'},
|
{'name': 'Transcode Decision', 'type': 'str', 'value': 'transcode_decision', 'description': 'The transcode decisions of the stream.'},
|
||||||
{'name': 'Video Decision', 'type': 'str', 'value': 'video_decision', 'description': 'The video transcode decisions of the stream.'},
|
{'name': 'Video Decision', 'type': 'str', 'value': 'video_decision', 'description': 'The video transcode decisions of the stream.'},
|
||||||
{'name': 'Audio Decision', 'type': 'str', 'value': 'audio_decision', 'description': 'The audio transcode decisions of the stream.'},
|
{'name': 'Audio Decision', 'type': 'str', 'value': 'audio_decision', 'description': 'The audio transcode decisions of the stream.'},
|
||||||
|
|
|
@ -843,7 +843,7 @@ def build_media_notify_params(notify_action=None, session=None, timeline=None, m
|
||||||
'progress_duration': view_offset,
|
'progress_duration': view_offset,
|
||||||
'progress_time': arrow.get(view_offset * 60).format(duration_format),
|
'progress_time': arrow.get(view_offset * 60).format(duration_format),
|
||||||
'progress_percent': helpers.get_percent(view_offset, duration),
|
'progress_percent': helpers.get_percent(view_offset, duration),
|
||||||
'continued_session': notify_params['continued_session'],
|
'initial_stream': notify_params['initial_stream'],
|
||||||
'transcode_decision': transcode_decision,
|
'transcode_decision': transcode_decision,
|
||||||
'video_decision': notify_params['video_decision'],
|
'video_decision': notify_params['video_decision'],
|
||||||
'audio_decision': notify_params['audio_decision'],
|
'audio_decision': notify_params['audio_decision'],
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue