mirror of
https://github.com/Tautulli/Tautulli.git
synced 2025-07-11 15:56:07 -07:00
Fix bugs with media info table
This commit is contained in:
parent
002cb93187
commit
6152a1e913
10 changed files with 55 additions and 60 deletions
|
@ -35,7 +35,7 @@
|
||||||
$('#date-header').html(moment('${data}','YYYY-MM-DD').format('ddd MMM Do YYYY'));
|
$('#date-header').html(moment('${data}','YYYY-MM-DD').format('ddd MMM Do YYYY'));
|
||||||
history_table_modal_options.ajax = {
|
history_table_modal_options.ajax = {
|
||||||
url: 'get_history',
|
url: 'get_history',
|
||||||
type: "post",
|
type: 'post',
|
||||||
data: function ( d ) {
|
data: function ( d ) {
|
||||||
return {
|
return {
|
||||||
json_data: JSON.stringify(d),
|
json_data: JSON.stringify(d),
|
||||||
|
|
|
@ -25,6 +25,7 @@ history_table_modal_options = {
|
||||||
"serverSide": true,
|
"serverSide": true,
|
||||||
"pageLength": 10,
|
"pageLength": 10,
|
||||||
"lengthChange": false,
|
"lengthChange": false,
|
||||||
|
"autoWidth": false,
|
||||||
"order": [ 0, 'desc'],
|
"order": [ 0, 'desc'],
|
||||||
"columnDefs": [
|
"columnDefs": [
|
||||||
{
|
{
|
||||||
|
@ -37,9 +38,9 @@ history_table_modal_options = {
|
||||||
$(td).html(moment(cellData,"X").format(time_format));
|
$(td).html(moment(cellData,"X").format(time_format));
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"searchable": false,
|
"width": "10%",
|
||||||
"className": "no-wrap",
|
"className": "no-wrap",
|
||||||
"width": "10%"
|
"searchable": false
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"targets": [1],
|
"targets": [1],
|
||||||
|
@ -51,9 +52,9 @@ history_table_modal_options = {
|
||||||
$(td).html(moment(cellData,"X").format(time_format));
|
$(td).html(moment(cellData,"X").format(time_format));
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"searchable": false,
|
"width": "10%",
|
||||||
"className": "no-wrap",
|
"className": "no-wrap",
|
||||||
"width": "10%"
|
"searchable": false
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"targets": [2],
|
"targets": [2],
|
||||||
|
@ -69,8 +70,8 @@ history_table_modal_options = {
|
||||||
$(td).html(cellData);
|
$(td).html(cellData);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"className": "no-wrap hidden-xs",
|
"width": "15%",
|
||||||
"width": "15%"
|
"className": "no-wrap hidden-xs"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"targets": [3],
|
"targets": [3],
|
||||||
|
@ -88,8 +89,8 @@ history_table_modal_options = {
|
||||||
$(td).html('<div><a href="#" data-target="#info-modal" data-toggle="modal"><div style="float: left;">' + transcode_dec + ' ' + cellData + '</div></a></div>');
|
$(td).html('<div><a href="#" data-target="#info-modal" data-toggle="modal"><div style="float: left;">' + transcode_dec + ' ' + cellData + '</div></a></div>');
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"className": "no-wrap hidden-sm hidden-xs modal-control",
|
"width": "25%",
|
||||||
"width": "20%"
|
"className": "no-wrap hidden-sm hidden-xs modal-control"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"targets": [4],
|
"targets": [4],
|
||||||
|
@ -116,7 +117,7 @@ history_table_modal_options = {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"width": "30%"
|
"width": "40%"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"drawCallback": function (settings) {
|
"drawCallback": function (settings) {
|
||||||
|
|
|
@ -397,7 +397,7 @@ function createChildTableMedia(row, rowData) {
|
||||||
});
|
});
|
||||||
|
|
||||||
// Child table expand detailed media info
|
// Child table expand detailed media info
|
||||||
$('table[id^=media_info_child]').on('click', '> tbody > tr > td.expand-media-info a', function () {
|
$('table[id^=media_info_child-' + rowData['rating_key'] + ']').on('click', '> tbody > tr > td.expand-media-info a', function () {
|
||||||
var table_id = $(this).closest('table').data('id');
|
var table_id = $(this).closest('table').data('id');
|
||||||
var tr = $(this).closest('tr');
|
var tr = $(this).closest('tr');
|
||||||
var row = media_info_child_table[table_id].row(tr);
|
var row = media_info_child_table[table_id].row(tr);
|
||||||
|
|
|
@ -441,13 +441,13 @@ DOCUMENTATION :: END
|
||||||
});
|
});
|
||||||
|
|
||||||
function recentlyWatched() {
|
function recentlyWatched() {
|
||||||
var widthVal = $('body').find("#library-recently-watched").width();
|
var widthVal = $("#library-recently-watched").width();
|
||||||
var tmp = (widthVal-32) / 180;
|
var tmp = (widthVal-25) / 175;
|
||||||
|
|
||||||
if (tmp > 0) {
|
if (tmp > 0) {
|
||||||
containerSize = parseInt(tmp);
|
var containerSize = parseInt(tmp);
|
||||||
} else {
|
} else {
|
||||||
containerSize = 1;
|
var containerSize = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Populate recently watched
|
// Populate recently watched
|
||||||
|
@ -465,13 +465,13 @@ DOCUMENTATION :: END
|
||||||
}
|
}
|
||||||
|
|
||||||
function recentlyAdded() {
|
function recentlyAdded() {
|
||||||
var widthVal = $('body').find("#library-recently-added").width();
|
var widthVal = $("#library-recently-added").width();
|
||||||
var tmp = (widthVal-32) / 180;
|
var tmp = (widthVal-25) / 175;
|
||||||
|
|
||||||
if (tmp > 0) {
|
if (tmp > 0) {
|
||||||
containerSize = parseInt(tmp);
|
var containerSize = parseInt(tmp);
|
||||||
} else {
|
} else {
|
||||||
containerSize = 1;
|
var containerSize = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Populate recently added
|
// Populate recently added
|
||||||
|
|
|
@ -22,7 +22,7 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class='table-card-back'>
|
<div class='table-card-back'>
|
||||||
<table class="display" id="sync_table" width="100%">
|
<table class="display no-fixed" id="sync_table" width="100%">
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
<th align='left' id="state">State</th>
|
<th align='left' id="state">State</th>
|
||||||
|
@ -54,7 +54,7 @@
|
||||||
<script>
|
<script>
|
||||||
$(document).ready(function() {
|
$(document).ready(function() {
|
||||||
sync_table_options.ajax = {
|
sync_table_options.ajax = {
|
||||||
"url": "get_sync"
|
url: 'get_sync'
|
||||||
}
|
}
|
||||||
sync_table = $('#sync_table').DataTable(sync_table_options);
|
sync_table = $('#sync_table').DataTable(sync_table_options);
|
||||||
var colvis = new $.fn.dataTable.ColVis( sync_table, { buttonText: '<i class="fa fa-columns"></i> Select columns', buttonClass: 'btn btn-dark' } );
|
var colvis = new $.fn.dataTable.ColVis( sync_table, { buttonText: '<i class="fa fa-columns"></i> Select columns', buttonClass: 'btn btn-dark' } );
|
||||||
|
|
|
@ -218,7 +218,7 @@ from plexpy import helpers
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="table-card-back">
|
<div class="table-card-back">
|
||||||
<table class="display" id="sync_table" width="100%">
|
<table class="display no-fixed" id="sync_table" width="100%">
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
<th align="left" id="state">State</th>
|
<th align="left" id="state">State</th>
|
||||||
|
@ -471,13 +471,13 @@ from plexpy import helpers
|
||||||
});
|
});
|
||||||
|
|
||||||
function recentlyWatched() {
|
function recentlyWatched() {
|
||||||
var widthVal = $('body').find("#user-recently-watched").width();
|
var widthVal = $("#user-recently-watched").width();
|
||||||
var tmp = (widthVal-32) / 180;
|
var tmp = (widthVal-25) / 175;
|
||||||
|
|
||||||
if (tmp > 0) {
|
if (tmp > 0) {
|
||||||
containerSize = parseInt(tmp);
|
var containerSize = parseInt(tmp);
|
||||||
} else {
|
} else {
|
||||||
containerSize = 1;
|
var containerSize = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Populate recently watched
|
// Populate recently watched
|
||||||
|
|
|
@ -242,8 +242,9 @@ class Libraries(object):
|
||||||
rows = json.load(inFile)
|
rows = json.load(inFile)
|
||||||
library_count = len(rows)
|
library_count = len(rows)
|
||||||
except IOError as e:
|
except IOError as e:
|
||||||
logger.debug(u"PlexPy Libraries :: No JSON file for rating_key %s." % rating_key)
|
#logger.debug(u"PlexPy Libraries :: No JSON file for rating_key %s." % rating_key)
|
||||||
logger.debug(u"PlexPy Libraries :: Refreshing data and creating new JSON file for rating_key %s." % rating_key)
|
#logger.debug(u"PlexPy Libraries :: Refreshing data and creating new JSON file for rating_key %s." % rating_key)
|
||||||
|
pass
|
||||||
elif section_id:
|
elif section_id:
|
||||||
try:
|
try:
|
||||||
inFilePath = os.path.join(plexpy.CONFIG.CACHE_DIR,'media_info-%s.json' % section_id)
|
inFilePath = os.path.join(plexpy.CONFIG.CACHE_DIR,'media_info-%s.json' % section_id)
|
||||||
|
@ -251,8 +252,9 @@ class Libraries(object):
|
||||||
rows = json.load(inFile)
|
rows = json.load(inFile)
|
||||||
library_count = len(rows)
|
library_count = len(rows)
|
||||||
except IOError as e:
|
except IOError as e:
|
||||||
logger.debug(u"PlexPy Libraries :: No JSON file for library section_id %s." % section_id)
|
#logger.debug(u"PlexPy Libraries :: No JSON file for library section_id %s." % section_id)
|
||||||
logger.debug(u"PlexPy Libraries :: Refreshing data and creating new JSON file for section_id %s." % section_id)
|
#logger.debug(u"PlexPy Libraries :: Refreshing data and creating new JSON file for section_id %s." % section_id)
|
||||||
|
pass
|
||||||
|
|
||||||
if not rows:
|
if not rows:
|
||||||
# Get the library details
|
# Get the library details
|
||||||
|
@ -312,13 +314,6 @@ class Libraries(object):
|
||||||
|
|
||||||
rows = []
|
rows = []
|
||||||
for item in children_list:
|
for item in children_list:
|
||||||
thumb = item['thumb']
|
|
||||||
|
|
||||||
if item['media_type'] == 'episode' or item['media_type'] == 'track':
|
|
||||||
full_title = 'E%s - %s' % (item['media_index'], item['title'])
|
|
||||||
else:
|
|
||||||
full_title = item['title']
|
|
||||||
|
|
||||||
watched_item = watched_list.get(item['rating_key'], None)
|
watched_item = watched_list.get(item['rating_key'], None)
|
||||||
if watched_item:
|
if watched_item:
|
||||||
last_watched = watched_item['last_watched']
|
last_watched = watched_item['last_watched']
|
||||||
|
@ -329,18 +324,16 @@ class Libraries(object):
|
||||||
|
|
||||||
row = {'section_id': library_details['section_id'],
|
row = {'section_id': library_details['section_id'],
|
||||||
'section_type': library_details['section_type'],
|
'section_type': library_details['section_type'],
|
||||||
'last_watched': last_watched,
|
|
||||||
'added_at': item['added_at'],
|
'added_at': item['added_at'],
|
||||||
'media_type': item['media_type'],
|
'media_type': item['media_type'],
|
||||||
'rating_key': item['rating_key'],
|
'rating_key': item['rating_key'],
|
||||||
'parent_rating_key': item['parent_rating_key'],
|
'parent_rating_key': item['parent_rating_key'],
|
||||||
'grandparent_rating_key': item['grandparent_rating_key'],
|
'grandparent_rating_key': item['grandparent_rating_key'],
|
||||||
'full_title': full_title,
|
|
||||||
'title': item['title'],
|
'title': item['title'],
|
||||||
'year': item['year'],
|
'year': item['year'],
|
||||||
'media_index': item['media_index'],
|
'media_index': item['media_index'],
|
||||||
'parent_media_index': item['parent_media_index'],
|
'parent_media_index': item['parent_media_index'],
|
||||||
'thumb': thumb,
|
'thumb': item['thumb'],
|
||||||
'container': item.get('container', ''),
|
'container': item.get('container', ''),
|
||||||
'bitrate': item.get('bitrate', ''),
|
'bitrate': item.get('bitrate', ''),
|
||||||
'video_codec': item.get('video_codec', ''),
|
'video_codec': item.get('video_codec', ''),
|
||||||
|
@ -349,6 +342,7 @@ class Libraries(object):
|
||||||
'audio_codec': item.get('audio_codec', ''),
|
'audio_codec': item.get('audio_codec', ''),
|
||||||
'audio_channels': item.get('audio_channels', ''),
|
'audio_channels': item.get('audio_channels', ''),
|
||||||
'file_size': item.get('file_size', ''),
|
'file_size': item.get('file_size', ''),
|
||||||
|
'last_watched': last_watched,
|
||||||
'play_count': play_count
|
'play_count': play_count
|
||||||
}
|
}
|
||||||
rows.append(row)
|
rows.append(row)
|
||||||
|
@ -384,25 +378,29 @@ class Libraries(object):
|
||||||
filtered_count = len(results)
|
filtered_count = len(results)
|
||||||
|
|
||||||
# Sort results
|
# Sort results
|
||||||
|
results = sorted(results, key=lambda k: k['title'])
|
||||||
sort_order = json_data['order']
|
sort_order = json_data['order']
|
||||||
for order in reversed(sort_order):
|
for order in reversed(sort_order):
|
||||||
sort_key = json_data['columns'][int(order['column'])]['data']
|
sort_key = json_data['columns'][int(order['column'])]['data']
|
||||||
reverse = True if order['dir'] == 'desc' else False
|
reverse = True if order['dir'] == 'desc' else False
|
||||||
if rating_key and sort_key == 'title':
|
if rating_key and sort_key == 'title':
|
||||||
results = sorted(results, key=lambda k: int(k['media_index']), reverse=reverse)
|
results = sorted(results, key=lambda k: int(k['media_index']), reverse=reverse)
|
||||||
|
elif sort_key == 'file_size' or sort_key == 'bitrate':
|
||||||
|
results = sorted(results, key=lambda k: int(k[sort_key]), reverse=reverse)
|
||||||
else:
|
else:
|
||||||
results = sorted(results, key=lambda k: k[sort_key], reverse=reverse)
|
results = sorted(results, key=lambda k: k[sort_key], reverse=reverse)
|
||||||
|
|
||||||
# Paginate results
|
# Paginate results
|
||||||
results = results[json_data['start']:(json_data['start'] + json_data['length'])]
|
results = results[json_data['start']:(json_data['start'] + json_data['length'])]
|
||||||
|
|
||||||
|
## Find some way to add total disk space used?
|
||||||
|
|
||||||
dict = {'recordsFiltered': filtered_count,
|
dict = {'recordsFiltered': filtered_count,
|
||||||
'recordsTotal': library_count,
|
'recordsTotal': library_count,
|
||||||
'data': results,
|
'data': results,
|
||||||
'draw': int(json_data['draw'])
|
'draw': int(json_data['draw'])
|
||||||
}
|
}
|
||||||
|
|
||||||
## Add total disk space used
|
|
||||||
return dict
|
return dict
|
||||||
|
|
||||||
def set_config(self, section_id=None, custom_thumb='', do_notify=1, keep_history=1, do_notify_created=1):
|
def set_config(self, section_id=None, custom_thumb='', do_notify=1, keep_history=1, do_notify_created=1):
|
||||||
|
|
|
@ -292,8 +292,8 @@ class PlexTV(object):
|
||||||
for device in sync_device:
|
for device in sync_device:
|
||||||
device_user_id = helpers.get_xml_attr(device, 'userID')
|
device_user_id = helpers.get_xml_attr(device, 'userID')
|
||||||
try:
|
try:
|
||||||
device_username = user_data.get_user_details(user_id=device_user_id)['username']
|
device_username = user_data.get_details(user_id=device_user_id)['username']
|
||||||
device_friendly_name = user_data.get_user_details(user_id=device_user_id)['friendly_name']
|
device_friendly_name = user_data.get_details(user_id=device_user_id)['friendly_name']
|
||||||
except:
|
except:
|
||||||
device_username = ''
|
device_username = ''
|
||||||
device_friendly_name = ''
|
device_friendly_name = ''
|
||||||
|
|
|
@ -1632,21 +1632,20 @@ class PmsConnect(object):
|
||||||
item_main = []
|
item_main = []
|
||||||
|
|
||||||
for item in item_main:
|
for item in item_main:
|
||||||
item_info = {'section_id': helpers.get_xml_attr(item, 'key'),
|
item_info = {'section_id': helpers.get_xml_attr(a, 'librarySectionID'),
|
||||||
'section_type': helpers.get_xml_attr(item, 'type'),
|
|
||||||
'media_type': helpers.get_xml_attr(item, 'type'),
|
'media_type': helpers.get_xml_attr(item, 'type'),
|
||||||
'rating_key': helpers.get_xml_attr(item, 'ratingKey'),
|
'rating_key': helpers.get_xml_attr(item, 'ratingKey'),
|
||||||
'parent_rating_key': helpers.get_xml_attr(item, 'parentRatingKey'),
|
'parent_rating_key': helpers.get_xml_attr(item, 'parentRatingKey'),
|
||||||
'grandparent_rating_key': helpers.get_xml_attr(item, 'grandparentRatingKey'),
|
'grandparent_rating_key': helpers.get_xml_attr(a, 'grandparentRatingKey'),
|
||||||
'title': helpers.get_xml_attr(item, 'title'),
|
'title': helpers.get_xml_attr(item, 'title'),
|
||||||
'parent_title': helpers.get_xml_attr(item, 'parentTitle'),
|
'parent_title': helpers.get_xml_attr(a, 'parentTitle'),
|
||||||
'grandparent_title': helpers.get_xml_attr(item, 'grandparentTitle'),
|
'grandparent_title': helpers.get_xml_attr(a, 'grandparentTitle'),
|
||||||
'media_index': helpers.get_xml_attr(item, 'index'),
|
'media_index': helpers.get_xml_attr(item, 'index'),
|
||||||
'parent_media_index': helpers.get_xml_attr(item, 'parentIndex'),
|
'parent_media_index': helpers.get_xml_attr(a, 'parentIndex'),
|
||||||
'year': helpers.get_xml_attr(item, 'year'),
|
'year': helpers.get_xml_attr(item, 'year'),
|
||||||
'thumb': helpers.get_xml_attr(item, 'thumb'),
|
'thumb': helpers.get_xml_attr(item, 'thumb'),
|
||||||
'parent_thumb': helpers.get_xml_attr(item, 'parentThumb'),
|
'parent_thumb': helpers.get_xml_attr(a, 'thumb'),
|
||||||
'grandparent_thumb': helpers.get_xml_attr(item, 'grandparentThumb'),
|
'grandparent_thumb': helpers.get_xml_attr(a, 'grandparentThumb'),
|
||||||
'added_at': helpers.get_xml_attr(item, 'addedAt')
|
'added_at': helpers.get_xml_attr(item, 'addedAt')
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -883,13 +883,10 @@ class WebInterface(object):
|
||||||
@cherrypy.expose
|
@cherrypy.expose
|
||||||
def get_sync(self, machine_id=None, user_id=None, **kwargs):
|
def get_sync(self, machine_id=None, user_id=None, **kwargs):
|
||||||
|
|
||||||
pms_connect = pmsconnect.PmsConnect()
|
if not machine_id:
|
||||||
server_id = pms_connect.get_server_identity()
|
machine_id = plexpy.CONFIG.PMS_IDENTIFIER
|
||||||
|
|
||||||
plex_tv = plextv.PlexTV()
|
plex_tv = plextv.PlexTV()
|
||||||
if not machine_id:
|
|
||||||
result = plex_tv.get_synced_items(machine_id=server_id['machine_identifier'], user_id=user_id)
|
|
||||||
else:
|
|
||||||
result = plex_tv.get_synced_items(machine_id=machine_id, user_id=user_id)
|
result = plex_tv.get_synced_items(machine_id=machine_id, user_id=user_id)
|
||||||
|
|
||||||
if result:
|
if result:
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue