naming, values, config und library link update

This commit is contained in:
herby2212 2021-03-07 02:54:28 +01:00
parent 9fa72c64b8
commit a772fc0bcf
4 changed files with 46 additions and 8 deletions

View file

@ -114,7 +114,7 @@ _CONFIG_DEFINITIONS = {
'HOME_SECTIONS': (list, 'General', ['current_activity', 'watch_stats', 'library_stats', 'recently_added']),
'HOME_LIBRARY_CARDS': (list, 'General', ['first_run']),
'HOME_STATS_CARDS': (list, 'General', ['top_movies', 'popular_movies', 'top_tv', 'popular_tv', 'top_music',
'popular_music', 'last_watched', 'top_users', 'top_platforms', 'most_concurrent', 'top_libraries']),
'popular_music', 'last_watched', 'top_libraries', 'top_users', 'top_platforms', 'most_concurrent']),
'HOME_REFRESH_INTERVAL': (int, 'General', 10),
'HTTPS_CREATE_CERT': (int, 'General', 1),
'HTTPS_CERT': (str, 'General', ''),
@ -546,3 +546,14 @@ class Config(object):
self.PLEXPY_AUTO_UPDATE = 0
self.CONFIG_VERSION = 17
if self.CONFIG_VERSION == 17:
home_stats_cards = self.HOME_STATS_CARDS
if 'top_users' in home_stats_cards:
top_users_index = home_stats_cards.index('top_users')
home_stats_cards.insert(top_users_index, 'top_libraries')
else:
home_stats_cards.add('top_libaries')
self.HOME_STATS_CARDS = home_stats_cards
self.CONFIG_VERSION = 18

View file

@ -894,8 +894,10 @@ class DataFactory(object):
top_libraries = []
try:
query = 'SELECT section_id, section_name, section_type ' \
'FROM library_sections'
query = 'SELECT section_id, section_name, section_type, thumb AS library_thumb, ' \
'custom_thumb_url AS custom_thumb, art AS library_art, custom_art_url AS custom_art ' \
'FROM library_sections ' \
'WHERE deleted_section = 0'
result = monitor_db.select(query)
except Exception as e:
@ -907,11 +909,27 @@ class DataFactory(object):
for item in result:
library_item = library_data.get_watch_time_stats(section_id=item['section_id'], grouping=None , query_days=time_range)
if item['custom_thumb'] and item['custom_thumb'] != item['library_thumb']:
library_thumb = item['custom_thumb']
elif item['library_thumb']:
library_thumb = item['library_thumb']
else:
library_thumb = common.DEFAULT_COVER_THUMB
if item['custom_art'] and item['custom_art'] != item['library_art']:
library_art = item['custom_art']
else:
library_art = item['library_art']
row = {
'total_plays': library_item[0]['total_plays'],
'total_duration': library_item[0]['total_time'],
'type': item['section_type'],
'library_name': item['section_name']
'section_type': item['section_type'],
'section_name': item['section_name'],
'section_id': item['section_id'],
'last_play': '',
'thumb': library_thumb,
'art': library_art
}
top_libraries.append(row)