mirror of
https://github.com/Tautulli/Tautulli.git
synced 2025-07-06 13:11:15 -07:00
Save credits markers offsets to session history
This commit is contained in:
parent
6807cebe51
commit
c2abfce8e1
2 changed files with 25 additions and 2 deletions
|
@ -715,7 +715,8 @@ def dbcheck():
|
|||
'art TEXT, media_type TEXT, year INTEGER, originally_available_at TEXT, added_at INTEGER, updated_at INTEGER, '
|
||||
'last_viewed_at INTEGER, content_rating TEXT, summary TEXT, tagline TEXT, rating TEXT, '
|
||||
'duration INTEGER DEFAULT 0, guid TEXT, directors TEXT, writers TEXT, actors TEXT, genres TEXT, studio TEXT, '
|
||||
'labels TEXT, live INTEGER DEFAULT 0, channel_call_sign TEXT, channel_identifier TEXT, channel_thumb TEXT)'
|
||||
'labels TEXT, live INTEGER DEFAULT 0, channel_call_sign TEXT, channel_identifier TEXT, channel_thumb TEXT, '
|
||||
'marker_credits_first INTEGER DEFAULT NULL, marker_credits_final INTEGER DEFAULT NULL)'
|
||||
)
|
||||
|
||||
# users table :: This table keeps record of the friends list
|
||||
|
@ -1564,6 +1565,18 @@ def dbcheck():
|
|||
'ALTER TABLE session_history_metadata ADD COLUMN channel_thumb TEXT'
|
||||
)
|
||||
|
||||
# Upgrade session_history_metadata table from earlier versions
|
||||
try:
|
||||
c_db.execute('SELECT marker_credits_first FROM session_history_metadata')
|
||||
except sqlite3.OperationalError:
|
||||
logger.debug("Altering database. Updating database table session_history_metadata.")
|
||||
c_db.execute(
|
||||
'ALTER TABLE session_history_metadata ADD COLUMN marker_credits_first INTEGER DEFAULT NULL'
|
||||
)
|
||||
c_db.execute(
|
||||
'ALTER TABLE session_history_metadata ADD COLUMN marker_credits_final INTEGER DEFAULT NULL'
|
||||
)
|
||||
|
||||
# Upgrade session_history_media_info table from earlier versions
|
||||
try:
|
||||
c_db.execute('SELECT transcode_decision FROM session_history_media_info')
|
||||
|
|
|
@ -490,6 +490,14 @@ class ActivityProcessor(object):
|
|||
genres = ";".join(metadata['genres'])
|
||||
labels = ";".join(metadata['labels'])
|
||||
|
||||
marker_credits_first = None
|
||||
marker_credits_final = None
|
||||
for marker in metadata['markers']:
|
||||
if marker['first']:
|
||||
marker_credits_first = marker['start_time_offset']
|
||||
if marker['final']:
|
||||
marker_credits_final = marker['start_time_offset']
|
||||
|
||||
# logger.debug("Tautulli ActivityProcessor :: Attempting to write to sessionKey %s session_history_metadata table..."
|
||||
# % session['session_key'])
|
||||
keys = {'id': last_id}
|
||||
|
@ -528,7 +536,9 @@ class ActivityProcessor(object):
|
|||
'live': session['live'],
|
||||
'channel_call_sign': media_info.get('channel_call_sign', ''),
|
||||
'channel_identifier': media_info.get('channel_identifier', ''),
|
||||
'channel_thumb': media_info.get('channel_thumb', '')
|
||||
'channel_thumb': media_info.get('channel_thumb', ''),
|
||||
'marker_credits_first': marker_credits_first,
|
||||
'marker_credits_final': marker_credits_final
|
||||
}
|
||||
|
||||
# logger.debug("Tautulli ActivityProcessor :: Writing sessionKey %s session_history_metadata transaction..."
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue