Default to show all cards until the user disables them.

This commit is contained in:
Jonathan Wong 2015-09-19 00:42:00 -07:00
parent d61e699dc9
commit de4d8fb277
6 changed files with 18 additions and 10 deletions

View file

@ -802,6 +802,6 @@ DOCUMENTATION :: END
<div class="text-muted">No stats for selected period.</div><br>
% endif
% else:
<div class="text-muted">No cards to show. Please enable cards in the <a href="settings#tab_tabs-2">settings</a>.
<div class="text-muted">Unable to retrieve data from database. Please check your <a href="settings">settings</a>.
</div><br>
% endif

View file

@ -73,6 +73,6 @@ DOCUMENTATION :: END
% endfor
</ul>
% else:
<div class="text-muted">No cards to show. Please enable cards in the <a href="settings#tab_tabs-2">settings</a>.
<div class="text-muted">Unable to retrieve data from server. Please check your <a href="settings">settings</a>.
</div><br>
% endif

View file

@ -86,7 +86,7 @@ _CONFIG_DEFINITIONS = {
'HOME_STATS_LENGTH': (int, 'General', 30),
'HOME_STATS_TYPE': (int, 'General', 0),
'HOME_STATS_COUNT': (int, 'General', 5),
'HOME_STATS_CARDS': (str, 'General', 'watch_statistics_first'),
'HOME_STATS_CARDS': (str, 'General', 'watch_statistics, top_tv, popular_tv, top_movies, popular_movies, top_music, popular_music, top_users, top_platforms, last_watched'),
'HTTPS_CERT': (str, 'General', ''),
'HTTPS_KEY': (str, 'General', ''),
'HTTP_HOST': (str, 'General', '0.0.0.0'),

View file

@ -136,10 +136,9 @@ class DataFactory(object):
sort_type = 'total_plays' if stats_type == '0' else 'total_duration'
stats_queries = stats_cards.split(', ')
home_stats = []
for stat in stats_queries:
for stat in stats_cards:
if 'top_tv' in stat:
top_tv = []
try:

View file

@ -1277,8 +1277,6 @@ class PmsConnect(object):
def get_library_stats(self, library_cards=''):
server_libraries = self.get_server_children()
library_keys = library_cards.split(', ')
server_library_stats = []
if server_libraries['libraries_count'] != '0':
@ -1287,7 +1285,7 @@ class PmsConnect(object):
for library in libraries_list:
library_type = library['type']
section_key = library['key']
if section_key in library_keys:
if section_key in library_cards:
library_list = self.get_library_children(library_type, section_key)
else:
continue

View file

@ -127,7 +127,7 @@ class WebInterface(object):
time_range = plexpy.CONFIG.HOME_STATS_LENGTH
stats_type = plexpy.CONFIG.HOME_STATS_TYPE
stats_count = plexpy.CONFIG.HOME_STATS_COUNT
stats_cards = plexpy.CONFIG.HOME_STATS_CARDS
stats_cards = plexpy.CONFIG.HOME_STATS_CARDS.split(', ')
notify_watched_percent = plexpy.CONFIG.NOTIFY_WATCHED_PERCENT
stats_data = data_factory.get_home_stats(time_range=time_range,
@ -142,7 +142,18 @@ class WebInterface(object):
def library_stats(self, **kwargs):
pms_connect = pmsconnect.PmsConnect()
library_cards = plexpy.CONFIG.HOME_LIBRARY_CARDS
library_cards = plexpy.CONFIG.HOME_LIBRARY_CARDS.split(', ')
if library_cards == ['library_statistics_first']:
library_cards = ['library_statistics']
server_children = pms_connect.get_server_children()
server_libraries = server_children['libraries_list']
for library in server_libraries:
library_cards.append(library['key'])
plexpy.CONFIG.HOME_LIBRARY_CARDS = ', '.join(library_cards)
plexpy.CONFIG.write()
stats_data = pms_connect.get_library_stats(library_cards=library_cards)