Added ability to view per-user graphs
This commit is contained in:
@@ -861,13 +861,23 @@ class WebInterface(object):
|
||||
plexpy.CONFIG.write()
|
||||
|
||||
return "Updated graphs config values."
|
||||
|
||||
|
||||
@cherrypy.expose
|
||||
@addtoapi()
|
||||
def get_plays_by_date(self, time_range='30', y_axis='plays', **kwargs):
|
||||
def get_user_names(self, **kwargs):
|
||||
|
||||
user_data = users.Users()
|
||||
user_names = user_data.get_names(kwargs=kwargs)
|
||||
|
||||
cherrypy.response.headers['Content-type'] = 'application/json'
|
||||
return json.dumps(user_names)
|
||||
|
||||
@cherrypy.expose
|
||||
@addtoapi()
|
||||
def get_plays_by_date(self, time_range='30', user_id=None, y_axis='plays', **kwargs):
|
||||
|
||||
graph = graphs.Graphs()
|
||||
result = graph.get_total_plays_per_day(time_range=time_range, y_axis=y_axis)
|
||||
result = graph.get_total_plays_per_day(time_range=time_range, user_id=user_id, y_axis=y_axis)
|
||||
|
||||
if result:
|
||||
cherrypy.response.headers['Content-type'] = 'application/json'
|
||||
@@ -877,10 +887,10 @@ class WebInterface(object):
|
||||
|
||||
@cherrypy.expose
|
||||
@addtoapi()
|
||||
def get_plays_by_dayofweek(self, time_range='30', y_axis='plays', **kwargs):
|
||||
def get_plays_by_dayofweek(self, time_range='30', user_id=None, y_axis='plays', **kwargs):
|
||||
|
||||
graph = graphs.Graphs()
|
||||
result = graph.get_total_plays_per_dayofweek(time_range=time_range, y_axis=y_axis)
|
||||
result = graph.get_total_plays_per_dayofweek(time_range=time_range, user_id=user_id, y_axis=y_axis)
|
||||
|
||||
if result:
|
||||
cherrypy.response.headers['Content-type'] = 'application/json'
|
||||
@@ -890,10 +900,10 @@ class WebInterface(object):
|
||||
|
||||
@cherrypy.expose
|
||||
@addtoapi()
|
||||
def get_plays_by_hourofday(self, time_range='30', y_axis='plays', **kwargs):
|
||||
def get_plays_by_hourofday(self, time_range='30', user_id=None, y_axis='plays', **kwargs):
|
||||
|
||||
graph = graphs.Graphs()
|
||||
result = graph.get_total_plays_per_hourofday(time_range=time_range, y_axis=y_axis)
|
||||
result = graph.get_total_plays_per_hourofday(time_range=time_range, user_id=user_id, y_axis=y_axis)
|
||||
|
||||
if result:
|
||||
cherrypy.response.headers['Content-type'] = 'application/json'
|
||||
@@ -903,10 +913,10 @@ class WebInterface(object):
|
||||
|
||||
@cherrypy.expose
|
||||
@addtoapi()
|
||||
def get_plays_per_month(self, y_axis='plays', **kwargs):
|
||||
def get_plays_per_month(self, y_axis='plays', user_id=None, **kwargs):
|
||||
|
||||
graph = graphs.Graphs()
|
||||
result = graph.get_total_plays_per_month(y_axis=y_axis)
|
||||
result = graph.get_total_plays_per_month(y_axis=y_axis, user_id=user_id)
|
||||
|
||||
if result:
|
||||
cherrypy.response.headers['Content-type'] = 'application/json'
|
||||
@@ -916,10 +926,10 @@ class WebInterface(object):
|
||||
|
||||
@cherrypy.expose
|
||||
@addtoapi()
|
||||
def get_plays_by_top_10_platforms(self, time_range='30', y_axis='plays', **kwargs):
|
||||
def get_plays_by_top_10_platforms(self, time_range='30', y_axis='plays', user_id=None, **kwargs):
|
||||
|
||||
graph = graphs.Graphs()
|
||||
result = graph.get_total_plays_by_top_10_platforms(time_range=time_range, y_axis=y_axis)
|
||||
result = graph.get_total_plays_by_top_10_platforms(time_range=time_range, y_axis=y_axis, user_id=user_id)
|
||||
|
||||
if result:
|
||||
cherrypy.response.headers['Content-type'] = 'application/json'
|
||||
@@ -942,10 +952,10 @@ class WebInterface(object):
|
||||
|
||||
@cherrypy.expose
|
||||
@addtoapi()
|
||||
def get_plays_by_stream_type(self, time_range='30', y_axis='plays', **kwargs):
|
||||
def get_plays_by_stream_type(self, time_range='30', user_id=None, y_axis='plays', **kwargs):
|
||||
|
||||
graph = graphs.Graphs()
|
||||
result = graph.get_total_plays_per_stream_type(time_range=time_range, y_axis=y_axis)
|
||||
result = graph.get_total_plays_per_stream_type(time_range=time_range, user_id=user_id, y_axis=y_axis)
|
||||
|
||||
if result:
|
||||
cherrypy.response.headers['Content-type'] = 'application/json'
|
||||
@@ -955,10 +965,10 @@ class WebInterface(object):
|
||||
|
||||
@cherrypy.expose
|
||||
@addtoapi()
|
||||
def get_plays_by_source_resolution(self, time_range='30', y_axis='plays', **kwargs):
|
||||
def get_plays_by_source_resolution(self, time_range='30', user_id=None, y_axis='plays', **kwargs):
|
||||
|
||||
graph = graphs.Graphs()
|
||||
result = graph.get_total_plays_by_source_resolution(time_range=time_range, y_axis=y_axis)
|
||||
result = graph.get_total_plays_by_source_resolution(time_range=time_range, user_id=user_id, y_axis=y_axis)
|
||||
|
||||
if result:
|
||||
cherrypy.response.headers['Content-type'] = 'application/json'
|
||||
@@ -968,10 +978,10 @@ class WebInterface(object):
|
||||
|
||||
@cherrypy.expose
|
||||
@addtoapi()
|
||||
def get_plays_by_stream_resolution(self, time_range='30', y_axis='plays', **kwargs):
|
||||
def get_plays_by_stream_resolution(self, time_range='30', user_id=None, y_axis='plays', **kwargs):
|
||||
|
||||
graph = graphs.Graphs()
|
||||
result = graph.get_total_plays_by_stream_resolution(time_range=time_range, y_axis=y_axis)
|
||||
result = graph.get_total_plays_by_stream_resolution(time_range=time_range, user_id=user_id, y_axis=y_axis)
|
||||
|
||||
if result:
|
||||
cherrypy.response.headers['Content-type'] = 'application/json'
|
||||
@@ -994,10 +1004,10 @@ class WebInterface(object):
|
||||
|
||||
@cherrypy.expose
|
||||
@addtoapi()
|
||||
def get_stream_type_by_top_10_platforms(self, time_range='30', y_axis='plays', **kwargs):
|
||||
def get_stream_type_by_top_10_platforms(self, time_range='30', y_axis='plays', user_id=None, **kwargs):
|
||||
|
||||
graph = graphs.Graphs()
|
||||
result = graph.get_stream_type_by_top_10_platforms(time_range=time_range, y_axis=y_axis)
|
||||
result = graph.get_stream_type_by_top_10_platforms(time_range=time_range, y_axis=y_axis, user_id=user_id)
|
||||
|
||||
if result:
|
||||
cherrypy.response.headers['Content-type'] = 'application/json'
|
||||
|
Reference in New Issue
Block a user