mirror of
https://github.com/Tautulli/Tautulli.git
synced 2025-07-06 21:21:15 -07:00
Add air date to tables for non-episodic Live TV
This commit is contained in:
parent
7ecc075c7e
commit
441e39d776
13 changed files with 73 additions and 23 deletions
|
@ -471,7 +471,7 @@ DOCUMENTATION :: END
|
|||
<a href="${href}" title="Season ${data['parent_media_index']}" class="sub-heading">S${data['parent_media_index']}</a>
|
||||
· <a href="${href}" title="Episode ${data['media_index']}" class="sub-heading">E${data['media_index']}</a>
|
||||
% else:
|
||||
<span title="Live TV" class="sub-heading">Live TV</span>
|
||||
<a href="${href}" title="${data['originally_available_at']}" class="sub-heading">${data['originally_available_at']}</a>
|
||||
% endif
|
||||
% else:
|
||||
<span title="Live TV" class="sub-heading">Live TV</span>
|
||||
|
|
|
@ -174,6 +174,7 @@ history_table_options = {
|
|||
icon = (rowData['live']) ? 'fa-broadcast-tower' : 'fa-television';
|
||||
icon_title = (rowData['live']) ? 'Live TV' : 'Movie';
|
||||
if (!isNaN(parseInt(rowData['parent_media_index'])) && !isNaN(parseInt(rowData['media_index']))) { parent_info = ' (S' + rowData['parent_media_index'] + ' · E' + rowData['media_index'] + ')'; }
|
||||
else if (rowData['live'] && rowData['originally_available_at']) { parent_info = ' (' + rowData['originally_available_at'] + ')'; }
|
||||
media_type = '<span class="media-type-tooltip" data-toggle="tooltip" title="' + icon_title + '"><i class="fa ' + icon + ' fa-fw"></i></span>';
|
||||
thumb_popover = '<span class="thumb-tooltip" data-toggle="popover" data-img="pms_image_proxy?img=' + rowData['thumb'] + '&rating_key=' + rowData['rating_key'] + '&width=300&height=450&fallback=' + fallback + '" data-height="120" data-width="80">' + cellData + parent_info + '</span>'
|
||||
$(td).html('<div class="history-title"><a href="info?' + source + 'rating_key=' + rowData['rating_key'] + '"><div style="float: left;" >' + media_type + ' ' + thumb_popover + '</div></a></div>');
|
||||
|
|
|
@ -115,6 +115,7 @@ history_table_modal_options = {
|
|||
icon = (rowData['live']) ? 'fa-broadcast-tower' : 'fa-television';
|
||||
icon_title = (rowData['live']) ? 'Live TV' : 'Movie';
|
||||
if (!isNaN(parseInt(rowData['parent_media_index'])) && !isNaN(parseInt(rowData['media_index']))) { parent_info = ' (S' + rowData['parent_media_index'] + ' · E' + rowData['media_index'] + ')'; }
|
||||
else if (rowData['live'] && rowData['originally_available_at']) { parent_info = ' (' + rowData['originally_available_at'] + ')'; }
|
||||
media_type = '<span class="media-type-tooltip" data-toggle="tooltip" title="' + icon_title + '"><i class="fa ' + icon + ' fa-fw"></i></span>';
|
||||
thumb_popover = '<span class="thumb-tooltip" data-toggle="popover" data-img="pms_image_proxy?img=' + rowData['thumb'] + '&rating_key=' + rowData['rating_key'] + '&width=300&height=450&fallback=' + fallback + '" data-height="120" data-width="80">' + cellData + parent_info + '</span>'
|
||||
$(td).html('<div class="history-title"><a href="info?source=history&rating_key=' + rowData['rating_key'] + '"><div style="float: left;" >' + media_type + ' ' + thumb_popover + '</div></a></div>');
|
||||
|
|
|
@ -154,6 +154,7 @@ libraries_list_table_options = {
|
|||
icon = (rowData['live']) ? 'fa-broadcast-tower' : 'fa-television';
|
||||
icon_title = (rowData['live']) ? 'Live TV' : 'Movie';
|
||||
if (!isNaN(parseInt(rowData['parent_media_index'])) && !isNaN(parseInt(rowData['media_index']))) { parent_info = ' (S' + rowData['parent_media_index'] + ' · E' + rowData['media_index'] + ')'; }
|
||||
else if (rowData['live'] && rowData['originally_available_at']) { parent_info = ' (' + rowData['originally_available_at'] + ')'; }
|
||||
media_type = '<span class="media-type-tooltip" data-toggle="tooltip" title="' + icon_title + '"><i class="fa ' + icon + ' fa-fw"></i></span>';
|
||||
thumb_popover = '<span class="thumb-tooltip" data-toggle="popover" data-img="pms_image_proxy?img=' + rowData['thumb'] + '&rating_key=' + rowData['rating_key'] + '&width=300&height=450&fallback=' + fallback + '" data-height="120" data-width="80">' + cellData + parent_info + '</span>'
|
||||
$(td).html('<div class="history-title"><a href="info?source=history&rating_key=' + rowData['rating_key'] + '"><div style="float: left;" >' + media_type + ' ' + thumb_popover + '</div></a></div>');
|
||||
|
|
|
@ -99,6 +99,7 @@ user_ip_table_options = {
|
|||
icon = (rowData['live']) ? 'fa-broadcast-tower' : 'fa-television';
|
||||
icon_title = (rowData['live']) ? 'Live TV' : 'Movie';
|
||||
if (!isNaN(parseInt(rowData['parent_media_index'])) && !isNaN(parseInt(rowData['media_index']))) { parent_info = ' (S' + rowData['parent_media_index'] + ' · E' + rowData['media_index'] + ')'; }
|
||||
else if (rowData['live'] && rowData['originally_available_at']) { parent_info = ' (' + rowData['originally_available_at'] + ')'; }
|
||||
media_type = '<span class="media-type-tooltip" data-toggle="tooltip" title="' + icon_title + '"><i class="fa ' + icon + ' fa-fw"></i></span>';
|
||||
thumb_popover = '<span class="thumb-tooltip" data-toggle="popover" data-img="pms_image_proxy?img=' + rowData['thumb'] + '&rating_key=' + rowData['rating_key'] + '&width=300&height=450&fallback=' + fallback + '" data-height="120" data-width="80">' + cellData + parent_info + '</span>'
|
||||
$(td).html('<div class="history-title"><a href="info?source=history&rating_key=' + rowData['rating_key'] + '"><div style="float: left;" >' + media_type + ' ' + thumb_popover + '</div></a></div>');
|
||||
|
|
|
@ -174,6 +174,7 @@ users_list_table_options = {
|
|||
icon = (rowData['live']) ? 'fa-broadcast-tower' : 'fa-television';
|
||||
icon_title = (rowData['live']) ? 'Live TV' : 'Movie';
|
||||
if (!isNaN(parseInt(rowData['parent_media_index'])) && !isNaN(parseInt(rowData['media_index']))) { parent_info = ' (S' + rowData['parent_media_index'] + ' · E' + rowData['media_index'] + ')'; }
|
||||
else if (rowData['live'] && rowData['originally_available_at']) { parent_info = ' (' + rowData['originally_available_at'] + ')'; }
|
||||
media_type = '<span class="media-type-tooltip" data-toggle="tooltip" title="' + icon_title + '"><i class="fa ' + icon + ' fa-fw"></i></span>';
|
||||
thumb_popover = '<span class="thumb-tooltip" data-toggle="popover" data-img="pms_image_proxy?img=' + rowData['thumb'] + '&rating_key=' + rowData['rating_key'] + '&width=300&height=450&fallback=' + fallback + '" data-height="120" data-width="80">' + cellData + parent_info + '</span>'
|
||||
$(td).html('<div class="history-title"><a href="info?source=history&rating_key=' + rowData['rating_key'] + '"><div style="float: left;" >' + media_type + ' ' + thumb_popover + '</div></a></div>');
|
||||
|
|
|
@ -585,6 +585,7 @@ def dbcheck():
|
|||
'media_index INTEGER, parent_media_index INTEGER, '
|
||||
'thumb TEXT, parent_thumb TEXT, grandparent_thumb TEXT, year INTEGER, '
|
||||
'parent_rating_key INTEGER, grandparent_rating_key INTEGER, '
|
||||
'originally_available_at TEXT, added_at INTEGER, '
|
||||
'view_offset INTEGER DEFAULT 0, duration INTEGER, video_decision TEXT, audio_decision TEXT, '
|
||||
'transcode_decision TEXT, container TEXT, bitrate INTEGER, width INTEGER, height INTEGER, '
|
||||
'video_codec TEXT, video_bitrate INTEGER, video_resolution TEXT, video_width INTEGER, video_height INTEGER, '
|
||||
|
@ -1236,6 +1237,18 @@ def dbcheck():
|
|||
'ALTER TABLE sessions ADD COLUMN channel_thumb TEXT'
|
||||
)
|
||||
|
||||
# Upgrade sessions table from earlier versions
|
||||
try:
|
||||
c_db.execute('SELECT originally_available_at FROM sessions')
|
||||
except sqlite3.OperationalError:
|
||||
logger.debug(u"Altering database. Updating database table sessions.")
|
||||
c_db.execute(
|
||||
'ALTER TABLE sessions ADD COLUMN originally_available_at TEXT'
|
||||
)
|
||||
c_db.execute(
|
||||
'ALTER TABLE sessions ADD COLUMN added_at INTEGER'
|
||||
)
|
||||
|
||||
# Upgrade session_history table from earlier versions
|
||||
try:
|
||||
c_db.execute('SELECT reference_id FROM session_history')
|
||||
|
|
|
@ -61,6 +61,8 @@ class ActivityProcessor(object):
|
|||
'platform': session.get('platform', ''),
|
||||
'parent_rating_key': session.get('parent_rating_key', ''),
|
||||
'grandparent_rating_key': session.get('grandparent_rating_key', ''),
|
||||
'originally_available_at': session.get('originally_available_at', ''),
|
||||
'added_at': session.get('added_at', ''),
|
||||
'view_offset': session.get('view_offset', ''),
|
||||
'duration': session.get('duration', ''),
|
||||
'video_decision': session.get('video_decision', ''),
|
||||
|
|
|
@ -13,7 +13,6 @@
|
|||
# You should have received a copy of the GNU General Public License
|
||||
# along with Tautulli. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
import arrow
|
||||
import json
|
||||
from itertools import groupby
|
||||
|
||||
|
@ -97,6 +96,8 @@ class DataFactory(object):
|
|||
'session_history_metadata.parent_thumb',
|
||||
'session_history_metadata.grandparent_thumb',
|
||||
'session_history_metadata.live',
|
||||
'session_history_metadata.added_at',
|
||||
'session_history_metadata.originally_available_at',
|
||||
'MAX((CASE WHEN (view_offset IS NULL OR view_offset = "") THEN 0.1 ELSE view_offset * 1.0 END) / \
|
||||
(CASE WHEN (session_history_metadata.duration IS NULL OR session_history_metadata.duration = "") \
|
||||
THEN 1.0 ELSE session_history_metadata.duration * 1.0 END) * 100) AS percent_complete',
|
||||
|
@ -146,6 +147,8 @@ class DataFactory(object):
|
|||
'parent_thumb',
|
||||
'grandparent_thumb',
|
||||
'live',
|
||||
'originally_available_at',
|
||||
'added_at',
|
||||
'MAX((CASE WHEN (view_offset IS NULL OR view_offset = "") THEN 0.1 ELSE view_offset * 1.0 END) / \
|
||||
(CASE WHEN (duration IS NULL OR duration = "") \
|
||||
THEN 1.0 ELSE duration * 1.0 END) * 100) AS percent_complete',
|
||||
|
@ -220,6 +223,10 @@ class DataFactory(object):
|
|||
else:
|
||||
watched_status = 0
|
||||
|
||||
# Fake Live TV air date using added_at timestamp
|
||||
if item['live'] and not item['originally_available_at']:
|
||||
item['originally_available_at'] = helpers.timestamp_to_iso_date(item['added_at'])
|
||||
|
||||
# Rename Mystery platform names
|
||||
platform = common.PLATFORM_NAME_OVERRIDES.get(item['platform'], item['platform'])
|
||||
|
||||
|
@ -251,6 +258,7 @@ class DataFactory(object):
|
|||
'media_index': item['media_index'],
|
||||
'parent_media_index': item['parent_media_index'],
|
||||
'thumb': thumb,
|
||||
'originally_available_at': item['originally_available_at'],
|
||||
'transcode_decision': item['transcode_decision'],
|
||||
'percent_complete': int(round(item['percent_complete'])),
|
||||
'watched_status': watched_status,
|
||||
|
@ -1052,11 +1060,9 @@ class DataFactory(object):
|
|||
else:
|
||||
section_name = ''
|
||||
|
||||
if item['live']:
|
||||
# Fake Live TV air date using added_at timestamp
|
||||
originally_available_at = item['originally_available_at'] or arrow.get(item['added_at']).format('YYYY-MM-DD')
|
||||
else:
|
||||
originally_available_at = item['originally_available_at']
|
||||
if item['live'] and not item['originally_available_at']:
|
||||
item['originally_available_at'] = helpers.timestamp_to_iso_date(item['added_at'])
|
||||
|
||||
directors = item['directors'].split(';') if item['directors'] else []
|
||||
writers = item['writers'].split(';') if item['writers'] else []
|
||||
|
@ -1098,7 +1104,7 @@ class DataFactory(object):
|
|||
'parent_thumb': item['parent_thumb'],
|
||||
'grandparent_thumb': item['grandparent_thumb'],
|
||||
'art': item['art'],
|
||||
'originally_available_at': originally_available_at,
|
||||
'originally_available_at': item['originally_available_at'],
|
||||
'added_at': item['added_at'],
|
||||
'updated_at': item['updated_at'],
|
||||
'last_viewed_at': item['last_viewed_at'],
|
||||
|
|
|
@ -221,6 +221,10 @@ def utc_now_iso():
|
|||
return utcnow.isoformat()
|
||||
|
||||
|
||||
def timestamp_to_iso_date(timestamp):
|
||||
return datetime.datetime.fromtimestamp(cast_to_int(timestamp)).strftime("%Y-%m-%d")
|
||||
|
||||
|
||||
def human_duration(s, sig='dhms'):
|
||||
|
||||
hd = ''
|
||||
|
|
|
@ -13,7 +13,6 @@
|
|||
# You should have received a copy of the GNU General Public License
|
||||
# along with Tautulli. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
import arrow
|
||||
import json
|
||||
import os
|
||||
|
||||
|
@ -286,6 +285,9 @@ class Libraries(object):
|
|||
'session_history_metadata.parent_media_index',
|
||||
'session_history_metadata.content_rating',
|
||||
'session_history_metadata.labels',
|
||||
'session_history_metadata.live',
|
||||
'session_history_metadata.added_at',
|
||||
'session_history_metadata.originally_available_at',
|
||||
'library_sections.do_notify',
|
||||
'library_sections.do_notify_created',
|
||||
'library_sections.keep_history'
|
||||
|
@ -327,6 +329,10 @@ class Libraries(object):
|
|||
else:
|
||||
library_thumb = common.DEFAULT_COVER_THUMB
|
||||
|
||||
# Fake Live TV air date using added_at timestamp
|
||||
if item['live'] and not item['originally_available_at']:
|
||||
item['originally_available_at'] = helpers.timestamp_to_iso_date(item['added_at'])
|
||||
|
||||
row = {'section_id': item['section_id'],
|
||||
'section_name': item['section_name'],
|
||||
'section_type': item['section_type'],
|
||||
|
@ -349,6 +355,8 @@ class Libraries(object):
|
|||
'parent_media_index': item['parent_media_index'],
|
||||
'content_rating': item['content_rating'],
|
||||
'labels': item['labels'].split(';') if item['labels'] else (),
|
||||
'live': item['live'],
|
||||
'originally_available_at': item['originally_available_at'],
|
||||
'do_notify': helpers.checked(item['do_notify']),
|
||||
'do_notify_created': helpers.checked(item['do_notify_created']),
|
||||
'keep_history': helpers.checked(item['keep_history'])
|
||||
|
@ -905,12 +913,9 @@ class Libraries(object):
|
|||
else:
|
||||
thumb = row['thumb']
|
||||
|
||||
if row['live']:
|
||||
# Fake Live TV air date using added_at timestamp
|
||||
originally_available_at = row['originally_available_at'] or arrow.get(row['added_at']).format(
|
||||
'YYYY-MM-DD')
|
||||
else:
|
||||
originally_available_at = row['originally_available_at']
|
||||
if row['live'] and not row['originally_available_at']:
|
||||
row['originally_available_at'] = helpers.timestamp_to_iso_date(row['added_at'])
|
||||
|
||||
recent_output = {'row_id': row['id'],
|
||||
'media_type': row['media_type'],
|
||||
|
@ -925,7 +930,7 @@ class Libraries(object):
|
|||
'media_index': row['media_index'],
|
||||
'parent_media_index': row['parent_media_index'],
|
||||
'year': row['year'],
|
||||
'originally_available_at': originally_available_at,
|
||||
'originally_available_at': row['originally_available_at'],
|
||||
'live': row['live'],
|
||||
'time': row['started'],
|
||||
'user': row['user'],
|
||||
|
|
|
@ -1961,6 +1961,10 @@ class PmsConnect(object):
|
|||
source_subtitle_details = next((p for p in source_media_part_streams if p['id'] == subtitle_id),
|
||||
next((p for p in source_media_part_streams if p['type'] == '3'), source_subtitle_details))
|
||||
|
||||
# Fake Live TV air date using added_at timestamp
|
||||
if stream_details['live'] and not metadata_details['originally_available_at']:
|
||||
metadata_details['originally_available_at'] = helpers.timestamp_to_iso_date(metadata_details['added_at'])
|
||||
|
||||
# Overrides for live sessions
|
||||
if stream_details['live'] and transcode_session:
|
||||
stream_details['stream_container_decision'] = 'transcode'
|
||||
|
|
|
@ -13,7 +13,6 @@
|
|||
# You should have received a copy of the GNU General Public License
|
||||
# along with Tautulli. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
import arrow
|
||||
import httpagentparser
|
||||
import time
|
||||
|
||||
|
@ -118,6 +117,8 @@ class Users(object):
|
|||
'session_history_metadata.media_index',
|
||||
'session_history_metadata.parent_media_index',
|
||||
'session_history_metadata.live',
|
||||
'session_history_metadata.added_at',
|
||||
'session_history_metadata.originally_available_at',
|
||||
'session_history_media_info.transcode_decision',
|
||||
'users.do_notify as do_notify',
|
||||
'users.keep_history as keep_history',
|
||||
|
@ -160,6 +161,10 @@ class Users(object):
|
|||
else:
|
||||
user_thumb = common.DEFAULT_USER_THUMB
|
||||
|
||||
# Fake Live TV air date using added_at timestamp
|
||||
if item['live'] and not item['originally_available_at']:
|
||||
item['originally_available_at'] = helpers.timestamp_to_iso_date(item['added_at'])
|
||||
|
||||
# Rename Mystery platform names
|
||||
platform = common.PLATFORM_NAME_OVERRIDES.get(item['platform'], item['platform'])
|
||||
|
||||
|
@ -182,6 +187,7 @@ class Users(object):
|
|||
'media_index': item['media_index'],
|
||||
'parent_media_index': item['parent_media_index'],
|
||||
'live': item['live'],
|
||||
'originally_available_at': item['originally_available_at'],
|
||||
'transcode_decision': item['transcode_decision'],
|
||||
'do_notify': helpers.checked(item['do_notify']),
|
||||
'keep_history': helpers.checked(item['keep_history']),
|
||||
|
@ -229,6 +235,8 @@ class Users(object):
|
|||
'session_history_metadata.media_index',
|
||||
'session_history_metadata.parent_media_index',
|
||||
'session_history_metadata.live',
|
||||
'session_history_metadata.added_at',
|
||||
'session_history_metadata.originally_available_at',
|
||||
'session_history_media_info.transcode_decision',
|
||||
'session_history.user',
|
||||
'session_history.user_id as custom_user_id',
|
||||
|
@ -266,6 +274,10 @@ class Users(object):
|
|||
else:
|
||||
thumb = item["thumb"]
|
||||
|
||||
# Fake Live TV air date using added_at timestamp
|
||||
if item['live'] and not item['originally_available_at']:
|
||||
item['originally_available_at'] = helpers.timestamp_to_iso_date(item['added_at'])
|
||||
|
||||
# Rename Mystery platform names
|
||||
platform = common.PLATFORM_NAME_OVERRIDES.get(item["platform"], item["platform"])
|
||||
|
||||
|
@ -284,6 +296,7 @@ class Users(object):
|
|||
'media_index': item['media_index'],
|
||||
'parent_media_index': item['parent_media_index'],
|
||||
'live': item['live'],
|
||||
'originally_available_at': item['originally_available_at'],
|
||||
'transcode_decision': item['transcode_decision'],
|
||||
'friendly_name': item['friendly_name'],
|
||||
'user_id': item['custom_user_id']
|
||||
|
@ -565,11 +578,9 @@ class Users(object):
|
|||
else:
|
||||
thumb = row['thumb']
|
||||
|
||||
if row['live']:
|
||||
# Fake Live TV air date using added_at timestamp
|
||||
originally_available_at = row['originally_available_at'] or arrow.get(row['added_at']).format('YYYY-MM-DD')
|
||||
else:
|
||||
originally_available_at = row['originally_available_at']
|
||||
if row['live'] and not row['originally_available_at']:
|
||||
row['originally_available_at'] = helpers.timestamp_to_iso_date(row['added_at'])
|
||||
|
||||
recent_output = {'row_id': row['id'],
|
||||
'media_type': row['media_type'],
|
||||
|
@ -584,7 +595,7 @@ class Users(object):
|
|||
'media_index': row['media_index'],
|
||||
'parent_media_index': row['parent_media_index'],
|
||||
'year': row['year'],
|
||||
'originally_available_at': originally_available_at,
|
||||
'originally_available_at': item['originally_available_at'],
|
||||
'live': row['live'],
|
||||
'time': row['started'],
|
||||
'user': row['user']
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue