No cards to show. Please enable cards in the
Unable to retrieve data from database. Please check your
settings.
% endif
\ No newline at end of file
diff --git a/data/interfaces/default/library_stats.html b/data/interfaces/default/library_stats.html
index aef22736..12e7135c 100644
--- a/data/interfaces/default/library_stats.html
+++ b/data/interfaces/default/library_stats.html
@@ -73,6 +73,6 @@ DOCUMENTATION :: END
% endfor
% else:
-
No cards to show. Please enable cards in the
settings.
+
Unable to retrieve data from server. Please check your
settings.
% endif
\ No newline at end of file
diff --git a/plexpy/config.py b/plexpy/config.py
index c48a1858..73034be2 100644
--- a/plexpy/config.py
+++ b/plexpy/config.py
@@ -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'),
diff --git a/plexpy/datafactory.py b/plexpy/datafactory.py
index 83698d6e..52d21e42 100644
--- a/plexpy/datafactory.py
+++ b/plexpy/datafactory.py
@@ -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:
diff --git a/plexpy/pmsconnect.py b/plexpy/pmsconnect.py
index 97b159e2..0fa2e061 100644
--- a/plexpy/pmsconnect.py
+++ b/plexpy/pmsconnect.py
@@ -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
diff --git a/plexpy/webserve.py b/plexpy/webserve.py
index be877bd9..2851605d 100644
--- a/plexpy/webserve.py
+++ b/plexpy/webserve.py
@@ -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)