mirror of
https://github.com/Tautulli/Tautulli.git
synced 2025-07-16 02:02:58 -07:00
initial release for movie media type
This commit is contained in:
parent
32cf26884b
commit
0fb362d4ee
4 changed files with 47 additions and 6 deletions
|
@ -2940,6 +2940,12 @@ a .home-platforms-list-cover-face:hover
|
|||
max-width: 1750px;
|
||||
display: flow-root;
|
||||
}
|
||||
.table-card-header.spaced {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
flex-wrap: wrap;
|
||||
align-content: center;
|
||||
}
|
||||
.table-card-back td {
|
||||
font-size: 12px;
|
||||
}
|
||||
|
@ -2951,6 +2957,18 @@ a .home-platforms-list-cover-face:hover
|
|||
font-weight: bold;
|
||||
line-height: 34px;
|
||||
}
|
||||
.info-bar {
|
||||
display: inline;
|
||||
}
|
||||
.info-element {
|
||||
display: inline-block;
|
||||
border-radius: 1rem;
|
||||
border: 0.2rem solid #242424;
|
||||
padding: 0.7rem;
|
||||
background-color: #3B3B3B;
|
||||
font-style: italic;
|
||||
color: #676767;
|
||||
}
|
||||
.button-bar {
|
||||
float: right;
|
||||
}
|
||||
|
|
|
@ -271,7 +271,7 @@ DOCUMENTATION :: END
|
|||
You may leave this page and check back later.
|
||||
</div>
|
||||
% endif
|
||||
<div class='table-card-header'>
|
||||
<div class='table-card-header spaced'>
|
||||
<div class="header-bar">
|
||||
<span>
|
||||
<i class="fa fa-info-circle"></i> Media Info for <strong>
|
||||
|
@ -279,6 +279,16 @@ DOCUMENTATION :: END
|
|||
</strong>
|
||||
</span>
|
||||
</div>
|
||||
% if config['get_file_sizes'] and not data['section_id'] in config['get_file_sizes_hold']['section_ids']:
|
||||
<div class="info-bar">
|
||||
<div class="info-element">
|
||||
<span>Total File Size: <strong><span id="info-element-total-file-size" /></strong></span>
|
||||
</div>
|
||||
<div class="info-element">
|
||||
<span>Total Media Runtime: <strong><span id="info-element-total-media-runtime" /></strong></span>
|
||||
</div>
|
||||
</div>
|
||||
% endif
|
||||
<div class="button-bar">
|
||||
% if _session['user_group'] == 'admin':
|
||||
<div class="btn-group">
|
||||
|
@ -842,6 +852,10 @@ DOCUMENTATION :: END
|
|||
section_id: section_id,
|
||||
refresh: refresh_table
|
||||
};
|
||||
},
|
||||
complete: function(xhr, status) {
|
||||
$("#info-element-total-media-runtime").html(humanDuration(xhr.responseJSON.total_duration));
|
||||
$("#info-element-total-file-size").html(humanFileSize(xhr.responseJSON.total_file_size));
|
||||
}
|
||||
};
|
||||
media_info_table = $('#media_info_table-SID-${data["section_id"]}').DataTable(media_info_table_options);
|
||||
|
|
|
@ -517,8 +517,11 @@ class Libraries(object):
|
|||
# Import media info cache from json file
|
||||
cache_time, rows, library_count = self._load_media_info_cache(section_id=section_id, rating_key=rating_key)
|
||||
|
||||
# Check if duration is also included in cache else refresh cache to prevent update issues
|
||||
refresh = refresh if None not in {d.get('duration') for d in rows} else True
|
||||
|
||||
# If no cache was imported, get all library children items
|
||||
cached_items = {d['rating_key']: d['file_size'] for d in rows} if not refresh else {}
|
||||
cached_items = {d['rating_key']: [d['file_size'], d['duration']] for d in rows} if not refresh else {}
|
||||
|
||||
if refresh or not rows:
|
||||
pms_connect = pmsconnect.PmsConnect()
|
||||
|
@ -543,8 +546,10 @@ class Libraries(object):
|
|||
for item in children_list:
|
||||
## TODO: Check list of media info items, currently only grabs first item
|
||||
|
||||
cached_file_size = cached_items.get(item['rating_key'], None)
|
||||
file_size = cached_file_size if cached_file_size else item.get('file_size', '')
|
||||
cached_item_data = cached_items.get(item['rating_key'], None)
|
||||
|
||||
file_size = cached_item_data['file_size'] if cached_item_data else item.get('file_size', '')
|
||||
duration = cached_item_data['duration'] if cached_item_data else item['duration']
|
||||
|
||||
row = {'section_id': library_details['section_id'],
|
||||
'section_type': library_details['section_type'],
|
||||
|
@ -566,7 +571,8 @@ class Libraries(object):
|
|||
'video_framerate': item.get('video_framerate', ''),
|
||||
'audio_codec': item.get('audio_codec', ''),
|
||||
'audio_channels': item.get('audio_channels', ''),
|
||||
'file_size': file_size
|
||||
'file_size': file_size,
|
||||
'duration': duration
|
||||
}
|
||||
new_rows.append(row)
|
||||
|
||||
|
@ -624,6 +630,7 @@ class Libraries(object):
|
|||
results = sorted(results, key=lambda k: k[sort_key].lower(), reverse=reverse)
|
||||
|
||||
total_file_size = sum([helpers.cast_to_int(d['file_size']) for d in results])
|
||||
total_duration = sum([helpers.cast_to_int(d['duration']) for d in results])
|
||||
|
||||
# Paginate results
|
||||
results = results[json_data['start']:(json_data['start'] + json_data['length'])]
|
||||
|
@ -637,6 +644,7 @@ class Libraries(object):
|
|||
'draw': int(json_data['draw']),
|
||||
'filtered_file_size': filtered_file_size,
|
||||
'total_file_size': total_file_size,
|
||||
'total_duration': total_duration,
|
||||
'last_refreshed': cache_time
|
||||
}
|
||||
|
||||
|
|
|
@ -2805,7 +2805,8 @@ class PmsConnect(object):
|
|||
'thumb': helpers.get_xml_attr(item, 'thumb'),
|
||||
'parent_thumb': helpers.get_xml_attr(item, 'thumb'),
|
||||
'grandparent_thumb': helpers.get_xml_attr(item, 'grandparentThumb'),
|
||||
'added_at': helpers.get_xml_attr(item, 'addedAt')
|
||||
'added_at': helpers.get_xml_attr(item, 'addedAt'),
|
||||
'duration': helpers.get_xml_attr(item, 'duration')
|
||||
}
|
||||
|
||||
if get_media_info:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue