Improved caching and fixed tables

This commit is contained in:
JonnyWong16 2016-01-17 12:34:23 -08:00
parent 908941fb82
commit 0d7e261bd1
8 changed files with 36 additions and 47 deletions

View file

@ -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 {

View file

@ -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>

View file

@ -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>&nbsp
<div class="alert alert-danger alert-edit" role="alert" id="row-edit-mode-alert"><i class="fa fa-exclamation-triangle"></i>&nbspSelect 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>&nbspSelect 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>

View file

@ -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>

View file

@ -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>

View file

@ -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>

View file

@ -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>

View file

@ -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()
@ -282,7 +283,9 @@ class Libraries(object):
return default_return
for item in children_list:
if item['rating_key'] not in cached_rating_keys:
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'],
@ -302,7 +305,7 @@ class Libraries(object):
'video_framerate': item.get('video_framerate', ''),
'audio_codec': item.get('audio_codec', ''),
'audio_channels': item.get('audio_channels', ''),
'file_size': item.get('file_size', '')
'file_size': file_size
}
rows.append(row)
@ -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