mirror of
https://github.com/Tautulli/Tautulli.git
synced 2025-07-08 14:10:52 -07:00
Merge branch 'nightly' into python3
This commit is contained in:
commit
d75744bb4a
2 changed files with 78 additions and 40 deletions
|
@ -1290,8 +1290,10 @@ def mask_config_passwords(config):
|
||||||
return config
|
return config
|
||||||
|
|
||||||
|
|
||||||
def bool_true(value):
|
def bool_true(value, return_none=False):
|
||||||
if value is True or value == 1:
|
if value is None and return_none:
|
||||||
|
return None
|
||||||
|
elif value is True or value == 1:
|
||||||
return True
|
return True
|
||||||
elif isinstance(value, str) and value.lower() in ('1', 'true', 't', 'yes', 'y', 'on'):
|
elif isinstance(value, str) and value.lower() in ('1', 'true', 't', 'yes', 'y', 'on'):
|
||||||
return True
|
return True
|
||||||
|
|
|
@ -528,6 +528,8 @@ class WebInterface(object):
|
||||||
("duration", True, False)]
|
("duration", True, False)]
|
||||||
kwargs['json_data'] = build_datatables_json(kwargs, dt_columns, "section_name")
|
kwargs['json_data'] = build_datatables_json(kwargs, dt_columns, "section_name")
|
||||||
|
|
||||||
|
grouping = helpers.bool_true(grouping, return_none=True)
|
||||||
|
|
||||||
library_data = libraries.Libraries()
|
library_data = libraries.Libraries()
|
||||||
library_list = library_data.get_datatables_list(kwargs=kwargs, grouping=grouping)
|
library_list = library_data.get_datatables_list(kwargs=kwargs, grouping=grouping)
|
||||||
|
|
||||||
|
@ -928,7 +930,7 @@ class WebInterface(object):
|
||||||
]
|
]
|
||||||
```
|
```
|
||||||
"""
|
"""
|
||||||
grouping = int(grouping) if str(grouping).isdigit() else grouping
|
grouping = helpers.bool_true(grouping, return_none=True)
|
||||||
|
|
||||||
if section_id:
|
if section_id:
|
||||||
library_data = libraries.Libraries()
|
library_data = libraries.Libraries()
|
||||||
|
@ -971,7 +973,7 @@ class WebInterface(object):
|
||||||
]
|
]
|
||||||
```
|
```
|
||||||
"""
|
"""
|
||||||
grouping = int(grouping) if str(grouping).isdigit() else grouping
|
grouping = helpers.bool_true(grouping, return_none=True)
|
||||||
|
|
||||||
if section_id:
|
if section_id:
|
||||||
library_data = libraries.Libraries()
|
library_data = libraries.Libraries()
|
||||||
|
@ -1195,6 +1197,8 @@ class WebInterface(object):
|
||||||
("duration", True, False)]
|
("duration", True, False)]
|
||||||
kwargs['json_data'] = build_datatables_json(kwargs, dt_columns, "friendly_name")
|
kwargs['json_data'] = build_datatables_json(kwargs, dt_columns, "friendly_name")
|
||||||
|
|
||||||
|
grouping = helpers.bool_true(grouping, return_none=True)
|
||||||
|
|
||||||
user_data = users.Users()
|
user_data = users.Users()
|
||||||
user_list = user_data.get_datatables_list(kwargs=kwargs, grouping=grouping)
|
user_list = user_data.get_datatables_list(kwargs=kwargs, grouping=grouping)
|
||||||
|
|
||||||
|
@ -1545,7 +1549,7 @@ class WebInterface(object):
|
||||||
]
|
]
|
||||||
```
|
```
|
||||||
"""
|
"""
|
||||||
grouping = int(grouping) if str(grouping).isdigit() else grouping
|
grouping = helpers.bool_true(grouping, return_none=True)
|
||||||
|
|
||||||
if user_id:
|
if user_id:
|
||||||
user_data = users.Users()
|
user_data = users.Users()
|
||||||
|
@ -1588,7 +1592,7 @@ class WebInterface(object):
|
||||||
]
|
]
|
||||||
```
|
```
|
||||||
"""
|
"""
|
||||||
grouping = int(grouping) if str(grouping).isdigit() else grouping
|
grouping = helpers.bool_true(grouping, return_none=True)
|
||||||
|
|
||||||
if user_id:
|
if user_id:
|
||||||
user_data = users.Users()
|
user_data = users.Users()
|
||||||
|
@ -1790,10 +1794,7 @@ class WebInterface(object):
|
||||||
("watched_status", False, False)]
|
("watched_status", False, False)]
|
||||||
kwargs['json_data'] = build_datatables_json(kwargs, dt_columns, "date")
|
kwargs['json_data'] = build_datatables_json(kwargs, dt_columns, "date")
|
||||||
|
|
||||||
if grouping and str(grouping).isdigit():
|
grouping = helpers.bool_true(grouping, return_none=True)
|
||||||
grouping = int(grouping)
|
|
||||||
elif grouping == 'false':
|
|
||||||
grouping = 0
|
|
||||||
|
|
||||||
custom_where = []
|
custom_where = []
|
||||||
if user_id:
|
if user_id:
|
||||||
|
@ -2009,10 +2010,13 @@ class WebInterface(object):
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
"""
|
"""
|
||||||
grouping = int(grouping) if str(grouping).isdigit() else grouping
|
grouping = helpers.bool_true(grouping, return_none=True)
|
||||||
|
|
||||||
graph = graphs.Graphs()
|
graph = graphs.Graphs()
|
||||||
result = graph.get_total_plays_per_day(time_range=time_range, user_id=user_id, y_axis=y_axis, grouping=grouping)
|
result = graph.get_total_plays_per_day(time_range=time_range,
|
||||||
|
y_axis=y_axis,
|
||||||
|
user_id=user_id,
|
||||||
|
grouping=grouping)
|
||||||
|
|
||||||
if result:
|
if result:
|
||||||
return result
|
return result
|
||||||
|
@ -2049,10 +2053,13 @@ class WebInterface(object):
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
"""
|
"""
|
||||||
grouping = int(grouping) if str(grouping).isdigit() else grouping
|
grouping = helpers.bool_true(grouping, return_none=True)
|
||||||
|
|
||||||
graph = graphs.Graphs()
|
graph = graphs.Graphs()
|
||||||
result = graph.get_total_plays_per_dayofweek(time_range=time_range, user_id=user_id, y_axis=y_axis)
|
result = graph.get_total_plays_per_dayofweek(time_range=time_range,
|
||||||
|
y_axis=y_axis,
|
||||||
|
user_id=user_id,
|
||||||
|
grouping=grouping)
|
||||||
|
|
||||||
if result:
|
if result:
|
||||||
return result
|
return result
|
||||||
|
@ -2089,10 +2096,13 @@ class WebInterface(object):
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
"""
|
"""
|
||||||
grouping = int(grouping) if str(grouping).isdigit() else grouping
|
grouping = helpers.bool_true(grouping, return_none=True)
|
||||||
|
|
||||||
graph = graphs.Graphs()
|
graph = graphs.Graphs()
|
||||||
result = graph.get_total_plays_per_hourofday(time_range=time_range, user_id=user_id, y_axis=y_axis)
|
result = graph.get_total_plays_per_hourofday(time_range=time_range,
|
||||||
|
y_axis=y_axis,
|
||||||
|
user_id=user_id,
|
||||||
|
grouping=grouping)
|
||||||
|
|
||||||
if result:
|
if result:
|
||||||
return result
|
return result
|
||||||
|
@ -2129,10 +2139,13 @@ class WebInterface(object):
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
"""
|
"""
|
||||||
grouping = int(grouping) if str(grouping).isdigit() else grouping
|
grouping = helpers.bool_true(grouping, return_none=True)
|
||||||
|
|
||||||
graph = graphs.Graphs()
|
graph = graphs.Graphs()
|
||||||
result = graph.get_total_plays_per_month(time_range=time_range, y_axis=y_axis, user_id=user_id)
|
result = graph.get_total_plays_per_month(time_range=time_range,
|
||||||
|
y_axis=y_axis,
|
||||||
|
user_id=user_id,
|
||||||
|
grouping=grouping)
|
||||||
|
|
||||||
if result:
|
if result:
|
||||||
return result
|
return result
|
||||||
|
@ -2143,7 +2156,7 @@ class WebInterface(object):
|
||||||
@cherrypy.tools.json_out()
|
@cherrypy.tools.json_out()
|
||||||
@requireAuth()
|
@requireAuth()
|
||||||
@addtoapi()
|
@addtoapi()
|
||||||
def get_plays_by_top_10_platforms(self, time_range='30', y_axis='plays', grouping=None, user_id=None, **kwargs):
|
def get_plays_by_top_10_platforms(self, time_range='30', y_axis='plays', user_id=None, grouping=None, **kwargs):
|
||||||
""" Get graph data by top 10 platforms.
|
""" Get graph data by top 10 platforms.
|
||||||
|
|
||||||
```
|
```
|
||||||
|
@ -2169,10 +2182,13 @@ class WebInterface(object):
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
"""
|
"""
|
||||||
grouping = int(grouping) if str(grouping).isdigit() else grouping
|
grouping = helpers.bool_true(grouping, return_none=True)
|
||||||
|
|
||||||
graph = graphs.Graphs()
|
graph = graphs.Graphs()
|
||||||
result = graph.get_total_plays_by_top_10_platforms(time_range=time_range, y_axis=y_axis, user_id=user_id)
|
result = graph.get_total_plays_by_top_10_platforms(time_range=time_range,
|
||||||
|
y_axis=y_axis,
|
||||||
|
user_id=user_id,
|
||||||
|
grouping=grouping)
|
||||||
|
|
||||||
if result:
|
if result:
|
||||||
return result
|
return result
|
||||||
|
@ -2183,7 +2199,7 @@ class WebInterface(object):
|
||||||
@cherrypy.tools.json_out()
|
@cherrypy.tools.json_out()
|
||||||
@requireAuth()
|
@requireAuth()
|
||||||
@addtoapi()
|
@addtoapi()
|
||||||
def get_plays_by_top_10_users(self, time_range='30', y_axis='plays', grouping=None, user_id=None, **kwargs):
|
def get_plays_by_top_10_users(self, time_range='30', y_axis='plays', user_id=None, grouping=None, **kwargs):
|
||||||
""" Get graph data by top 10 users.
|
""" Get graph data by top 10 users.
|
||||||
|
|
||||||
```
|
```
|
||||||
|
@ -2209,10 +2225,13 @@ class WebInterface(object):
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
"""
|
"""
|
||||||
grouping = int(grouping) if str(grouping).isdigit() else grouping
|
grouping = helpers.bool_true(grouping, return_none=True)
|
||||||
|
|
||||||
graph = graphs.Graphs()
|
graph = graphs.Graphs()
|
||||||
result = graph.get_total_plays_by_top_10_users(time_range=time_range, y_axis=y_axis, user_id=user_id)
|
result = graph.get_total_plays_by_top_10_users(time_range=time_range,
|
||||||
|
y_axis=y_axis,
|
||||||
|
user_id=user_id,
|
||||||
|
grouping=grouping)
|
||||||
|
|
||||||
if result:
|
if result:
|
||||||
return result
|
return result
|
||||||
|
@ -2223,7 +2242,7 @@ class WebInterface(object):
|
||||||
@cherrypy.tools.json_out()
|
@cherrypy.tools.json_out()
|
||||||
@requireAuth()
|
@requireAuth()
|
||||||
@addtoapi()
|
@addtoapi()
|
||||||
def get_plays_by_stream_type(self, time_range='30', y_axis='plays', grouping=None, user_id=None, **kwargs):
|
def get_plays_by_stream_type(self, time_range='30', y_axis='plays', user_id=None, grouping=None, **kwargs):
|
||||||
""" Get graph data by stream type by date.
|
""" Get graph data by stream type by date.
|
||||||
|
|
||||||
```
|
```
|
||||||
|
@ -2248,10 +2267,13 @@ class WebInterface(object):
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
"""
|
"""
|
||||||
grouping = int(grouping) if str(grouping).isdigit() else grouping
|
grouping = helpers.bool_true(grouping, return_none=True)
|
||||||
|
|
||||||
graph = graphs.Graphs()
|
graph = graphs.Graphs()
|
||||||
result = graph.get_total_plays_per_stream_type(time_range=time_range, y_axis=y_axis, user_id=user_id)
|
result = graph.get_total_plays_per_stream_type(time_range=time_range,
|
||||||
|
y_axis=y_axis,
|
||||||
|
user_id=user_id,
|
||||||
|
grouping=grouping)
|
||||||
|
|
||||||
if result:
|
if result:
|
||||||
return result
|
return result
|
||||||
|
@ -2262,7 +2284,7 @@ class WebInterface(object):
|
||||||
@cherrypy.tools.json_out()
|
@cherrypy.tools.json_out()
|
||||||
@requireAuth()
|
@requireAuth()
|
||||||
@addtoapi()
|
@addtoapi()
|
||||||
def get_plays_by_source_resolution(self, time_range='30', y_axis='plays', grouping=None, user_id=None, **kwargs):
|
def get_plays_by_source_resolution(self, time_range='30', y_axis='plays', user_id=None, grouping=None, **kwargs):
|
||||||
""" Get graph data by source resolution.
|
""" Get graph data by source resolution.
|
||||||
|
|
||||||
```
|
```
|
||||||
|
@ -2287,10 +2309,13 @@ class WebInterface(object):
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
"""
|
"""
|
||||||
grouping = int(grouping) if str(grouping).isdigit() else grouping
|
grouping = helpers.bool_true(grouping, return_none=True)
|
||||||
|
|
||||||
graph = graphs.Graphs()
|
graph = graphs.Graphs()
|
||||||
result = graph.get_total_plays_by_source_resolution(time_range=time_range, y_axis=y_axis, user_id=user_id)
|
result = graph.get_total_plays_by_source_resolution(time_range=time_range,
|
||||||
|
y_axis=y_axis,
|
||||||
|
user_id=user_id,
|
||||||
|
grouping=grouping)
|
||||||
|
|
||||||
if result:
|
if result:
|
||||||
return result
|
return result
|
||||||
|
@ -2301,7 +2326,7 @@ class WebInterface(object):
|
||||||
@cherrypy.tools.json_out()
|
@cherrypy.tools.json_out()
|
||||||
@requireAuth()
|
@requireAuth()
|
||||||
@addtoapi()
|
@addtoapi()
|
||||||
def get_plays_by_stream_resolution(self, time_range='30', y_axis='plays', grouping=None, user_id=None, **kwargs):
|
def get_plays_by_stream_resolution(self, time_range='30', y_axis='plays', user_id=None, grouping=None, **kwargs):
|
||||||
""" Get graph data by stream resolution.
|
""" Get graph data by stream resolution.
|
||||||
|
|
||||||
```
|
```
|
||||||
|
@ -2326,10 +2351,13 @@ class WebInterface(object):
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
"""
|
"""
|
||||||
grouping = int(grouping) if str(grouping).isdigit() else grouping
|
grouping = helpers.bool_true(grouping, return_none=True)
|
||||||
|
|
||||||
graph = graphs.Graphs()
|
graph = graphs.Graphs()
|
||||||
result = graph.get_total_plays_by_stream_resolution(time_range=time_range, y_axis=y_axis, user_id=user_id)
|
result = graph.get_total_plays_by_stream_resolution(time_range=time_range,
|
||||||
|
y_axis=y_axis,
|
||||||
|
user_id=user_id,
|
||||||
|
grouping=grouping)
|
||||||
|
|
||||||
if result:
|
if result:
|
||||||
return result
|
return result
|
||||||
|
@ -2340,7 +2368,7 @@ class WebInterface(object):
|
||||||
@cherrypy.tools.json_out()
|
@cherrypy.tools.json_out()
|
||||||
@requireAuth()
|
@requireAuth()
|
||||||
@addtoapi()
|
@addtoapi()
|
||||||
def get_stream_type_by_top_10_users(self, time_range='30', y_axis='plays', grouping=None, user_id=None, **kwargs):
|
def get_stream_type_by_top_10_users(self, time_range='30', y_axis='plays', user_id=None, grouping=None, **kwargs):
|
||||||
""" Get graph data by stream type by top 10 users.
|
""" Get graph data by stream type by top 10 users.
|
||||||
|
|
||||||
```
|
```
|
||||||
|
@ -2365,10 +2393,13 @@ class WebInterface(object):
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
"""
|
"""
|
||||||
grouping = int(grouping) if str(grouping).isdigit() else grouping
|
grouping = helpers.bool_true(grouping, return_none=True)
|
||||||
|
|
||||||
graph = graphs.Graphs()
|
graph = graphs.Graphs()
|
||||||
result = graph.get_stream_type_by_top_10_users(time_range=time_range, y_axis=y_axis, user_id=user_id)
|
result = graph.get_stream_type_by_top_10_users(time_range=time_range,
|
||||||
|
y_axis=y_axis,
|
||||||
|
user_id=user_id,
|
||||||
|
grouping=grouping)
|
||||||
|
|
||||||
if result:
|
if result:
|
||||||
return result
|
return result
|
||||||
|
@ -2379,7 +2410,7 @@ class WebInterface(object):
|
||||||
@cherrypy.tools.json_out()
|
@cherrypy.tools.json_out()
|
||||||
@requireAuth()
|
@requireAuth()
|
||||||
@addtoapi()
|
@addtoapi()
|
||||||
def get_stream_type_by_top_10_platforms(self, time_range='30', y_axis='plays', grouping=None, user_id=None, **kwargs):
|
def get_stream_type_by_top_10_platforms(self, time_range='30', y_axis='plays', user_id=None, grouping=None, **kwargs):
|
||||||
""" Get graph data by stream type by top 10 platforms.
|
""" Get graph data by stream type by top 10 platforms.
|
||||||
|
|
||||||
```
|
```
|
||||||
|
@ -2404,10 +2435,13 @@ class WebInterface(object):
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
"""
|
"""
|
||||||
grouping = int(grouping) if str(grouping).isdigit() else grouping
|
grouping = helpers.bool_true(grouping, return_none=True)
|
||||||
|
|
||||||
graph = graphs.Graphs()
|
graph = graphs.Graphs()
|
||||||
result = graph.get_stream_type_by_top_10_platforms(time_range=time_range, y_axis=y_axis, user_id=user_id)
|
result = graph.get_stream_type_by_top_10_platforms(time_range=time_range,
|
||||||
|
y_axis=y_axis,
|
||||||
|
user_id=user_id,
|
||||||
|
grouping=grouping)
|
||||||
|
|
||||||
if result:
|
if result:
|
||||||
return result
|
return result
|
||||||
|
@ -5544,7 +5578,7 @@ class WebInterface(object):
|
||||||
@cherrypy.tools.json_out()
|
@cherrypy.tools.json_out()
|
||||||
@requireAuth(member_of("admin"))
|
@requireAuth(member_of("admin"))
|
||||||
@addtoapi()
|
@addtoapi()
|
||||||
def get_home_stats(self, grouping=0, time_range=30, stats_type='plays', stats_count=10, **kwargs):
|
def get_home_stats(self, time_range=30, stats_type='plays', stats_count=10, grouping=None, **kwargs):
|
||||||
""" Get the homepage watch statistics.
|
""" Get the homepage watch statistics.
|
||||||
|
|
||||||
```
|
```
|
||||||
|
@ -5626,6 +5660,8 @@ class WebInterface(object):
|
||||||
elif stats_type in (1, '1'):
|
elif stats_type in (1, '1'):
|
||||||
stats_type = 'duration'
|
stats_type = 'duration'
|
||||||
|
|
||||||
|
grouping = helpers.bool_true(grouping, return_none=True)
|
||||||
|
|
||||||
data_factory = datafactory.DataFactory()
|
data_factory = datafactory.DataFactory()
|
||||||
result = data_factory.get_home_stats(grouping=grouping,
|
result = data_factory.get_home_stats(grouping=grouping,
|
||||||
time_range=time_range,
|
time_range=time_range,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue