Save home stats config to local storage instead of server

This commit is contained in:
JonnyWong16 2018-10-13 20:27:08 -07:00
parent d93390f8ed
commit 018356b85e
5 changed files with 22 additions and 63 deletions

View file

@ -203,12 +203,8 @@ _CONFIG_DEFINITIONS = {
'HISTORY_TABLE_ACTIVITY': (int, 'General', 1),
'HOME_SECTIONS': (list, 'General', ['current_activity','watch_stats','library_stats','recently_added']),
'HOME_LIBRARY_CARDS': (list, 'General', ['first_run']),
'HOME_STATS_LENGTH': (int, 'General', 30),
'HOME_STATS_TYPE': (int, 'General', 0),
'HOME_STATS_COUNT': (int, 'General', 5),
'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']),
'HOME_STATS_RECENTLY_ADDED_COUNT': (int, 'General', 50),
'HOME_REFRESH_INTERVAL': (int, 'General', 10),
'HTTPS_CREATE_CERT': (int, 'General', 1),
'HTTPS_CERT': (str, 'General', ''),

View file

@ -266,12 +266,6 @@ class DataFactory(object):
if grouping is None:
grouping = plexpy.CONFIG.GROUP_HISTORY_TABLES
if time_range is None:
time_range = plexpy.CONFIG.HOME_STATS_LENGTH
if stats_type is None:
stats_type = plexpy.CONFIG.HOME_STATS_TYPE
if stats_count is None:
stats_count = plexpy.CONFIG.HOME_STATS_COUNT
if stats_cards is None:
stats_cards = plexpy.CONFIG.HOME_STATS_CARDS

View file

@ -173,10 +173,6 @@ class WebInterface(object):
def home(self, **kwargs):
config = {
"home_sections": plexpy.CONFIG.HOME_SECTIONS,
"home_stats_length": plexpy.CONFIG.HOME_STATS_LENGTH,
"home_stats_type": plexpy.CONFIG.HOME_STATS_TYPE,
"home_stats_count": plexpy.CONFIG.HOME_STATS_COUNT,
"home_stats_recently_added_count": plexpy.CONFIG.HOME_STATS_RECENTLY_ADDED_COUNT,
"home_refresh_interval": plexpy.CONFIG.HOME_REFRESH_INTERVAL,
"pms_name": plexpy.CONFIG.PMS_NAME,
"pms_is_cloud": plexpy.CONFIG.PMS_IS_CLOUD,
@ -301,24 +297,6 @@ class WebInterface(object):
return serve_template(templatename="home_stats.html", title="Stats", data=stats_data)
@cherrypy.expose
@requireAuth(member_of("admin"))
def set_home_stats_config(self, time_range=None, stats_type=None, stats_count=None, recently_added_count=None, **kwargs):
if time_range:
plexpy.CONFIG.__setattr__('HOME_STATS_LENGTH', time_range)
plexpy.CONFIG.write()
if stats_type:
plexpy.CONFIG.__setattr__('HOME_STATS_TYPE', stats_type)
plexpy.CONFIG.write()
if stats_count:
plexpy.CONFIG.__setattr__('HOME_STATS_COUNT', stats_count)
plexpy.CONFIG.write()
if recently_added_count:
plexpy.CONFIG.__setattr__('HOME_STATS_RECENTLY_ADDED_COUNT', recently_added_count)
plexpy.CONFIG.write()
return "Updated home stats config values."
@cherrypy.expose
@requireAuth()
def library_stats(self, **kwargs):
@ -1838,16 +1816,7 @@ class WebInterface(object):
@cherrypy.expose
@requireAuth()
def graphs(self, **kwargs):
config = {
"graph_type": plexpy.CONFIG.GRAPH_TYPE,
"graph_days": plexpy.CONFIG.GRAPH_DAYS,
"graph_months": plexpy.CONFIG.GRAPH_MONTHS,
"graph_tab": plexpy.CONFIG.GRAPH_TAB,
"music_logging_enable": plexpy.CONFIG.MUSIC_LOGGING_ENABLE
}
return serve_template(templatename="graphs.html", title="Graphs", config=config)
return serve_template(templatename="graphs.html", title="Graphs")
@cherrypy.expose
@cherrypy.tools.json_out()