fix music library fallback and update code style

This commit is contained in:
herby2212 2021-03-14 23:59:03 +01:00
parent 4c47501687
commit bd65e75cf4
3 changed files with 9 additions and 3 deletions

View file

@ -812,7 +812,7 @@
return (className.match (/(^|\s)platform-\S+/g) || []).join(' '); return (className.match (/(^|\s)platform-\S+/g) || []).join(' ');
}).addClass('platform-' + $(elem).data('platform') + '-rgba'); }).addClass('platform-' + $(elem).data('platform') + '-rgba');
} else if (stat_id === 'top_libraries') { } else if (stat_id === 'top_libraries') {
$('#stats-background-' + stat_id).css('background-image', 'url(' + page('pms_image_proxy', art, null, 500, 280, 40, '282828', 3, 'art') + ')'); $('#stats-background-' + stat_id).css('background-image', 'url(' + page('pms_image_proxy', art, null, 500, 280, 40, '282828', 3, fallback_art) + ')');
$('#stats-thumb-' + stat_id).removeClass(function (index, className) { $('#stats-thumb-' + stat_id).removeClass(function (index, className) {
return (className.match (/(^|\s)svg-icon library-\S+/g) || []).join(' ')}); return (className.match (/(^|\s)svg-icon library-\S+/g) || []).join(' ')});
if (thumb.startsWith('http')) { if (thumb.startsWith('http')) {

View file

@ -556,4 +556,5 @@ class Config(object):
home_stats_cards.add('top_libaries') home_stats_cards.add('top_libaries')
self.HOME_STATS_CARDS = home_stats_cards self.HOME_STATS_CARDS = home_stats_cards
self.CONFIG_VERSION = 18 self.CONFIG_VERSION = 18

View file

@ -909,6 +909,9 @@ class DataFactory(object):
for item in result: for item in result:
library_item = library_data.get_watch_time_stats(section_id=item['section_id'], grouping=None , query_days=time_range) library_item = library_data.get_watch_time_stats(section_id=item['section_id'], grouping=None , query_days=time_range)
if library_item[0]['total_plays'] == 0 and library_item[0]['total_time'] == 0:
continue
if item['custom_thumb'] and item['custom_thumb'] != item['library_thumb']: if item['custom_thumb'] and item['custom_thumb'] != item['library_thumb']:
library_thumb = item['custom_thumb'] library_thumb = item['custom_thumb']
elif item['library_thumb']: elif item['library_thumb']:
@ -938,7 +941,9 @@ class DataFactory(object):
'stat_id': stat, 'stat_id': stat,
'stat_type': sort_type, 'stat_type': sort_type,
'stat_title': 'Most Active Libraries', 'stat_title': 'Most Active Libraries',
'rows': session.mask_session_info(sorted(top_libraries, key=lambda k: k[sort_type], reverse=True), mask_metadata=False) 'rows': session.mask_session_info(
sorted(top_libraries, key=lambda k: k[sort_type], reverse=True),
mask_metadata=False)
}) })
if stat_id and home_stats: if stat_id and home_stats: