mirror of
https://github.com/Tautulli/Tautulli.git
synced 2025-07-11 15:56:07 -07:00
Improved caching and fixed tables
This commit is contained in:
parent
908941fb82
commit
0d7e261bd1
8 changed files with 36 additions and 47 deletions
|
@ -71,20 +71,9 @@ img {
|
|||
-moz-box-shadow: 0 0 0 3px rgba(0,0,0,.2);
|
||||
box-shadow: 0 0 0 3px rgba(0,0,0,.2);
|
||||
}
|
||||
.navbar-header {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 15px;
|
||||
width: 100%;
|
||||
}
|
||||
.navbar-brand {
|
||||
padding: 5px 5px;
|
||||
}
|
||||
.navbar-right {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
right: 15px;
|
||||
}
|
||||
.nav > li > a {
|
||||
color: #999;
|
||||
-webkit-transition: all 0.3s ease;
|
||||
|
@ -2575,9 +2564,6 @@ table.display,
|
|||
table.display tr.shown + tr table[id^='history_child'],
|
||||
table.display tr.shown + tr table[id^='media_info_child'],
|
||||
table.display tr.shown + tr table[id^='media_info_child'] tr.shown + tr table[id^='media_info_child'] {
|
||||
table-layout: fixed;
|
||||
}
|
||||
table.display.no-fixed {
|
||||
table-layout: auto;
|
||||
}
|
||||
table.display tr.shown + tr div.slider {
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
</h4>
|
||||
</div>
|
||||
<div class="modal-body" id="modal-text">
|
||||
<table class="display no-fixed" id="history_table" width="100%">
|
||||
<table class="display" id="history_table" width="100%">
|
||||
<thead>
|
||||
<tr>
|
||||
<th align="left" id="started">Started</th>
|
||||
|
|
|
@ -31,11 +31,11 @@
|
|||
<button class="btn btn-danger btn-edit" data-toggle="button" aria-pressed="false" autocomplete="off" id="row-edit-mode">
|
||||
<i class="fa fa-pencil"></i> Edit mode
|
||||
</button> 
|
||||
<div class="alert alert-danger alert-edit" role="alert" id="row-edit-mode-alert"><i class="fa fa-exclamation-triangle"></i> Select library history to purge. Data is purged upon exiting edit mode.</div>
|
||||
<div class="alert alert-danger alert-edit" role="alert" id="row-edit-mode-alert"><i class="fa fa-exclamation-triangle"></i> Select libraries to delete/purge. Data is deleted/purged upon exiting edit mode.</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class='table-card-back'>
|
||||
<table id="libraries_list_table" class="display no-fixed" width="100%">
|
||||
<table id="libraries_list_table" class="display" width="100%">
|
||||
<thead>
|
||||
<tr>
|
||||
<th align="left" id="edit_row">Edit</th>
|
||||
|
|
|
@ -201,7 +201,7 @@ DOCUMENTATION :: END
|
|||
% else:
|
||||
<div id="get_file_sizes_message" style="text-align: center; margin-top: 20px; display: none;">
|
||||
% endif
|
||||
<i class="fa fa-refresh fa-spin"></i> PlexPy is getting the file sizes for the library's media info. This could take a few minutes depending on the size of your library.
|
||||
<i class="fa fa-refresh fa-spin"></i> PlexPy is calculating the file sizes for the library's media info. This could take a few minutes depending on the size of your library.
|
||||
<br />
|
||||
You may leave this page and come back later.
|
||||
</div>
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
</div>
|
||||
</div>
|
||||
<div class='table-card-back'>
|
||||
<table class="display no-fixed" id="sync_table" width="100%">
|
||||
<table class="display" id="sync_table" width="100%">
|
||||
<thead>
|
||||
<tr>
|
||||
<th align='left' id="state">State</th>
|
||||
|
|
|
@ -218,7 +218,7 @@ from plexpy import helpers
|
|||
</div>
|
||||
</div>
|
||||
<div class="table-card-back">
|
||||
<table class="display no-fixed" id="sync_table" width="100%">
|
||||
<table class="display" id="sync_table" width="100%">
|
||||
<thead>
|
||||
<tr>
|
||||
<th align="left" id="state">State</th>
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
</div>
|
||||
</div>
|
||||
<div class='table-card-back'>
|
||||
<table id="users_list_table" class="display no-fixed" width="100%">
|
||||
<table id="users_list_table" class="display" width="100%">
|
||||
<thead>
|
||||
<tr>
|
||||
<th align="left" id="edit_row">Edit</th>
|
||||
|
|
|
@ -262,7 +262,8 @@ class Libraries(object):
|
|||
pass
|
||||
|
||||
# If no cache was imported, get all library children items
|
||||
cached_rating_keys = [d['rating_key'] for d in rows]
|
||||
cached_items = {d['rating_key']: d['file_size'] for d in rows}
|
||||
|
||||
if refresh or not rows:
|
||||
pms_connect = pmsconnect.PmsConnect()
|
||||
|
||||
|
@ -280,31 +281,33 @@ class Libraries(object):
|
|||
else:
|
||||
logger.warn(u"PlexPy Libraries :: Unable to get a list of library items.")
|
||||
return default_return
|
||||
|
||||
|
||||
for item in children_list:
|
||||
if item['rating_key'] not in cached_rating_keys:
|
||||
row = {'section_id': library_details['section_id'],
|
||||
'section_type': library_details['section_type'],
|
||||
'added_at': item['added_at'],
|
||||
'media_type': item['media_type'],
|
||||
'rating_key': item['rating_key'],
|
||||
'parent_rating_key': item['parent_rating_key'],
|
||||
'grandparent_rating_key': item['grandparent_rating_key'],
|
||||
'title': item['title'],
|
||||
'year': item['year'],
|
||||
'media_index': item['media_index'],
|
||||
'parent_media_index': item['parent_media_index'],
|
||||
'thumb': item['thumb'],
|
||||
'container': item.get('container', ''),
|
||||
'bitrate': item.get('bitrate', ''),
|
||||
'video_codec': item.get('video_codec', ''),
|
||||
'video_resolution': item.get('video_resolution', ''),
|
||||
'video_framerate': item.get('video_framerate', ''),
|
||||
'audio_codec': item.get('audio_codec', ''),
|
||||
'audio_channels': item.get('audio_channels', ''),
|
||||
'file_size': item.get('file_size', '')
|
||||
}
|
||||
rows.append(row)
|
||||
cached_file_size = cached_items.get(item['rating_key'], None)
|
||||
file_size = cached_file_size if cached_file_size else item.get('file_size', '')
|
||||
|
||||
row = {'section_id': library_details['section_id'],
|
||||
'section_type': library_details['section_type'],
|
||||
'added_at': item['added_at'],
|
||||
'media_type': item['media_type'],
|
||||
'rating_key': item['rating_key'],
|
||||
'parent_rating_key': item['parent_rating_key'],
|
||||
'grandparent_rating_key': item['grandparent_rating_key'],
|
||||
'title': item['title'],
|
||||
'year': item['year'],
|
||||
'media_index': item['media_index'],
|
||||
'parent_media_index': item['parent_media_index'],
|
||||
'thumb': item['thumb'],
|
||||
'container': item.get('container', ''),
|
||||
'bitrate': item.get('bitrate', ''),
|
||||
'video_codec': item.get('video_codec', ''),
|
||||
'video_resolution': item.get('video_resolution', ''),
|
||||
'video_framerate': item.get('video_framerate', ''),
|
||||
'audio_codec': item.get('audio_codec', ''),
|
||||
'audio_channels': item.get('audio_channels', ''),
|
||||
'file_size': file_size
|
||||
}
|
||||
rows.append(row)
|
||||
|
||||
if not rows:
|
||||
return default_return
|
||||
|
@ -434,7 +437,7 @@ class Libraries(object):
|
|||
metadata_list = child_metadata['metadata']
|
||||
|
||||
for child_metadata in metadata_list:
|
||||
child_file_size = helpers.cast_to_int(child_metadata['file_size'])
|
||||
child_file_size = helpers.cast_to_int(child_metadata.get('file_size', 0))
|
||||
if child_file_size > 0:
|
||||
file_size += child_file_size
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue