mirror of
https://github.com/Tautulli/Tautulli.git
synced 2025-07-12 08:16:06 -07:00
Make sure info pages are protected if source=history
This commit is contained in:
parent
e147ce9039
commit
1622b0fa29
5 changed files with 44 additions and 21 deletions
|
@ -245,7 +245,7 @@ DOCUMENTATION :: END
|
|||
% elif a['state'] == 'buffering':
|
||||
<i class="fa fa-spinner"></i>
|
||||
% endif
|
||||
% if a['title']:
|
||||
% if a['rating_key']:
|
||||
% if a['media_type'] == 'episode':
|
||||
<a href="info?rating_key=${a['rating_key']}" title="${a['grandparent_title']} - ${a['title']}">${a['grandparent_title']} - ${a['title']}</a>
|
||||
% elif a['media_type'] == 'movie':
|
||||
|
@ -260,11 +260,11 @@ DOCUMENTATION :: END
|
|||
<span title="${a['title']}">${a['title']}</span>
|
||||
% endif
|
||||
% else:
|
||||
Title
|
||||
Title
|
||||
% endif
|
||||
</div>
|
||||
<div class="dashboard-activity-metadata-subtitle">
|
||||
% if a['media_index'] or a['parent_media_index'] or a['parent_title'] or a['title'] or a['year']:
|
||||
% if a['rating_key']:
|
||||
% if a['media_type'] == 'episode':
|
||||
<span title="S${a['parent_media_index']} · E${a['media_index']}">S${a['parent_media_index']} · E${a['media_index']}</span>
|
||||
% elif a['media_type'] == 'movie':
|
||||
|
|
|
@ -809,6 +809,7 @@ class DataFactory(object):
|
|||
'session_history_metadata.tagline, session_history_metadata.rating, session_history_metadata.duration, ' \
|
||||
'session_history_metadata.guid, session_history_metadata.directors, session_history_metadata.writers, ' \
|
||||
'session_history_metadata.actors, session_history_metadata.genres, session_history_metadata.studio, ' \
|
||||
'session_history_metadata.labels, ' \
|
||||
'session_history_media_info.container, session_history_media_info.bitrate, ' \
|
||||
'session_history_media_info.video_codec, session_history_media_info.video_resolution, ' \
|
||||
'session_history_media_info.video_framerate, session_history_media_info.audio_codec, ' \
|
||||
|
@ -821,12 +822,14 @@ class DataFactory(object):
|
|||
else:
|
||||
result = []
|
||||
|
||||
metadata = {}
|
||||
metadata_list = []
|
||||
|
||||
for item in result:
|
||||
directors = item['directors'].split(';') if item['directors'] else []
|
||||
writers = item['writers'].split(';') if item['writers'] else []
|
||||
actors = item['actors'].split(';') if item['actors'] else []
|
||||
genres = item['genres'].split(';') if item['genres'] else []
|
||||
labels = item['labels'].split(';') if item['labels'] else []
|
||||
|
||||
metadata = {'media_type': item['media_type'],
|
||||
'rating_key': item['rating_key'],
|
||||
|
@ -853,10 +856,11 @@ class DataFactory(object):
|
|||
'updated_at': item['updated_at'],
|
||||
'last_viewed_at': item['last_viewed_at'],
|
||||
'guid': item['guid'],
|
||||
'writers': writers,
|
||||
'directors': directors,
|
||||
'genres': genres,
|
||||
'writers': writers,
|
||||
'actors': actors,
|
||||
'genres': genres,
|
||||
'labels': labels,
|
||||
'library_name': item['section_name'],
|
||||
'section_id': item['section_id'],
|
||||
'container': item['container'],
|
||||
|
@ -867,8 +871,14 @@ class DataFactory(object):
|
|||
'audio_codec': item['audio_codec'],
|
||||
'audio_channels': item['audio_channels']
|
||||
}
|
||||
metadata_list.append(metadata)
|
||||
|
||||
return metadata
|
||||
metadata = session.filter_session_info(metadata_list, filter_key='section_id')
|
||||
|
||||
if metadata:
|
||||
return {'metadata': session.filter_session_info(metadata_list, filter_key='section_id')[0]}
|
||||
else:
|
||||
return []
|
||||
|
||||
def get_total_duration(self, custom_where=None):
|
||||
monitor_db = database.MonitorDatabase()
|
||||
|
|
|
@ -53,7 +53,7 @@ def get_session_shared_libraries():
|
|||
"""
|
||||
from plexpy import users
|
||||
user_details = users.Users().get_details(user_id=get_session_user_id())
|
||||
return user_details['shared_libraries']
|
||||
return tuple(str(s) for s in user_details['shared_libraries'])
|
||||
|
||||
def get_session_library_filters():
|
||||
"""
|
||||
|
@ -151,14 +151,24 @@ def filter_session_info(list_of_dicts, filter_key=None):
|
|||
f_content_rating, f_labels = get_session_library_filters_type(session_library_filters,
|
||||
media_type=d['media_type'])
|
||||
|
||||
d_content_rating = d.get('content_rating', '').lower()
|
||||
d_content_rating = d.get('content_rating', '')
|
||||
d_labels = tuple(f.lower() for f in d.get('labels', ()))
|
||||
|
||||
if (not f_content_rating or set(d_content_rating).intersection(set(f_content_rating))) and \
|
||||
(not f_labels or set(d_labels).intersection(set(f_labels))):
|
||||
continue
|
||||
keep = False
|
||||
if not f_content_rating and not f_labels:
|
||||
keep = True
|
||||
elif not f_content_rating and f_labels:
|
||||
if set(d_labels).intersection(set(f_labels)):
|
||||
keep = True
|
||||
elif f_content_rating and not f_labels:
|
||||
if d_content_rating in f_content_rating:
|
||||
keep = True
|
||||
elif f_content_rating and f_labels:
|
||||
if d_content_rating in f_content_rating or set(d_labels).intersection(set(f_labels)):
|
||||
keep = True
|
||||
|
||||
new_list_of_dicts.append(d)
|
||||
if keep:
|
||||
new_list_of_dicts.append(d)
|
||||
|
||||
return new_list_of_dicts
|
||||
|
||||
|
@ -223,13 +233,12 @@ def mask_session_info(list_of_dicts, mask_metadata=True):
|
|||
f_content_rating, f_labels = get_session_library_filters_type(session_library_filters,
|
||||
media_type=d['media_type'])
|
||||
|
||||
if not f_content_rating and not f_labels:
|
||||
continue
|
||||
|
||||
d_content_rating = d.get('content_rating', '')
|
||||
d_labels = tuple(f.lower() for f in d.get('labels', ()))
|
||||
|
||||
if not f_content_rating and f_labels:
|
||||
if not f_content_rating and not f_labels:
|
||||
continue
|
||||
elif not f_content_rating and f_labels:
|
||||
if set(d_labels).intersection(set(f_labels)):
|
||||
continue
|
||||
elif f_content_rating and not f_labels:
|
||||
|
|
|
@ -321,6 +321,8 @@ class Users(object):
|
|||
else:
|
||||
user_thumb = common.DEFAULT_USER_THUMB
|
||||
|
||||
shared_libraries = tuple(item['shared_libraries'].split(';')) if item['shared_libraries'] else ()
|
||||
|
||||
user_details = {'user_id': item['user_id'],
|
||||
'username': item['username'],
|
||||
'friendly_name': friendly_name,
|
||||
|
@ -333,7 +335,7 @@ class Users(object):
|
|||
'keep_history': item['keep_history'],
|
||||
'deleted_user': item['deleted_user'],
|
||||
'allow_guest': item['allow_guest'],
|
||||
'shared_libraries': tuple(item['shared_libraries'].split(';'))
|
||||
'shared_libraries': shared_libraries
|
||||
}
|
||||
return user_details
|
||||
|
||||
|
|
|
@ -1846,9 +1846,11 @@ class WebInterface(object):
|
|||
|
||||
if source == 'history':
|
||||
data_factory = datafactory.DataFactory()
|
||||
metadata = data_factory.get_metadata_details(rating_key=rating_key)
|
||||
poster_url = data_factory.get_poster_url(metadata=metadata)
|
||||
metadata['poster_url'] = poster_url
|
||||
result = data_factory.get_metadata_details(rating_key=rating_key)
|
||||
if result:
|
||||
metadata = result['metadata']
|
||||
poster_url = data_factory.get_poster_url(metadata=metadata)
|
||||
metadata['poster_url'] = poster_url
|
||||
else:
|
||||
pms_connect = pmsconnect.PmsConnect()
|
||||
result = pms_connect.get_metadata_details(rating_key=rating_key, get_media_info=True)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue