diff --git a/data/interfaces/default/css/plexpy-dataTables.css b/data/interfaces/default/css/plexpy-dataTables.css
index 5ef66009..f93c174b 100644
--- a/data/interfaces/default/css/plexpy-dataTables.css
+++ b/data/interfaces/default/css/plexpy-dataTables.css
@@ -359,11 +359,13 @@ table.display tr.shown + tr:hover {
}
table.display tr.shown + tr:hover a,
table.display tr.shown + tr td:hover a,
+table.display tr.shown + tr td:hover a .fa,
table.display tr.shown + tr .pagination > .active > a,
table.display tr.shown + tr .pagination > .active > a:hover {
color: #fff;
}
table.display tr.shown + tr table[id^='history_child'] td:hover a,
+table.display tr.shown + tr table[id^='history_child'] td:hover a .fa,
table.display tr.shown + tr table[id^='media_info_child'] > tr > td:hover a,
table.display tr.shown + tr table[id^='media_info_child'] tr.shown + tr table[id^='media_info_child'] td:hover a {
color: #cc7b19;
diff --git a/data/interfaces/default/history_table_modal.html b/data/interfaces/default/history_table_modal.html
index 1e5dfbb6..87f58268 100644
--- a/data/interfaces/default/history_table_modal.html
+++ b/data/interfaces/default/history_table_modal.html
@@ -5,7 +5,15 @@
@@ -13,11 +21,18 @@
- Started |
- Stopped |
+ Delete |
+ Date |
User |
- Player |
+ IP Address |
+ Platform |
+ Player |
Title |
+ Started |
+ Paused |
+ Stopped |
+ Duration |
+ |
@@ -28,28 +43,31 @@
-
+
% else:
diff --git a/plexpy/graphs.py b/plexpy/graphs.py
index 90736b51..66b761c3 100644
--- a/plexpy/graphs.py
+++ b/plexpy/graphs.py
@@ -27,7 +27,7 @@ class Graphs(object):
def __init__(self):
pass
- def get_total_plays_per_day(self, time_range='30', y_axis='plays', user_id=None):
+ def get_total_plays_per_day(self, time_range='30', y_axis='plays', user_id=None, grouping=None):
monitor_db = database.MonitorDatabase()
if not time_range.isdigit():
@@ -38,17 +38,22 @@ class Graphs(object):
user_cond = 'AND session_history.user_id = %s ' % session.get_session_user_id()
elif user_id and user_id.isdigit():
user_cond = 'AND session_history.user_id = %s ' % user_id
-
+
+ if grouping is None:
+ grouping = plexpy.CONFIG.GROUP_HISTORY_TABLES
+
+ group_by = 'reference_id' if grouping else 'id'
+
try:
if y_axis == 'plays':
query = 'SELECT date(started, "unixepoch", "localtime") AS date_played, ' \
'SUM(CASE WHEN media_type = "episode" THEN 1 ELSE 0 END) AS tv_count, ' \
'SUM(CASE WHEN media_type = "movie" THEN 1 ELSE 0 END) AS movie_count, ' \
'SUM(CASE WHEN media_type = "track" THEN 1 ELSE 0 END) AS music_count ' \
- 'FROM session_history ' \
+ 'FROM (SELECT * FROM session_history GROUP BY %s) ' \
'WHERE datetime(stopped, "unixepoch", "localtime") >= datetime("now", "-%s days", "localtime") %s' \
'GROUP BY date_played ' \
- 'ORDER BY started ASC' % (time_range, user_cond)
+ 'ORDER BY started ASC' % (group_by, time_range, user_cond)
result = monitor_db.select(query)
else:
diff --git a/plexpy/webserve.py b/plexpy/webserve.py
index e8cd2da2..3f54c72e 100644
--- a/plexpy/webserve.py
+++ b/plexpy/webserve.py
@@ -1799,7 +1799,7 @@ class WebInterface(object):
@cherrypy.tools.json_out()
@requireAuth()
@addtoapi()
- def get_plays_by_date(self, time_range='30', user_id=None, y_axis='plays', **kwargs):
+ def get_plays_by_date(self, time_range='30', user_id=None, y_axis='plays', grouping=None, **kwargs):
""" Get graph data by date.
```
@@ -1823,8 +1823,13 @@ class WebInterface(object):
}
```
"""
+ if grouping and str(grouping).isdigit():
+ grouping = int(grouping)
+ elif grouping == 'false':
+ grouping = 0
+
graph = graphs.Graphs()
- result = graph.get_total_plays_per_day(time_range=time_range, user_id=user_id, y_axis=y_axis)
+ result = graph.get_total_plays_per_day(time_range=time_range, user_id=user_id, y_axis=y_axis, grouping=grouping)
if result:
return result