diff --git a/data/interfaces/default/history.html b/data/interfaces/default/history.html
index babc260a..c5e6b12c 100644
--- a/data/interfaces/default/history.html
+++ b/data/interfaces/default/history.html
@@ -44,6 +44,7 @@ from plexpy import helpers
|
|
|
+ |
diff --git a/data/interfaces/default/home_stats.html b/data/interfaces/default/home_stats.html
index 310e5883..ca3ae372 100644
--- a/data/interfaces/default/home_stats.html
+++ b/data/interfaces/default/home_stats.html
@@ -28,6 +28,7 @@ users_watched Returns the count for the associated stat.
== Only if 'stat_id' is 'top_user' ==
thumb Returns url of the user's gravatar. Returns '' if none exists.
user Returns the username for the associated stat.
+user_id Returns the user id for the associated stat.
friendly_name Returns the friendly name of the user for the associated stat.
== Only if 'stat_id' is 'top_platform' ==
@@ -112,7 +113,7 @@ DOCUMENTATION :: END
diff --git a/data/interfaces/default/images/platforms/xbox.png b/data/interfaces/default/images/platforms/xbox.png
new file mode 100644
index 00000000..45ba5107
Binary files /dev/null and b/data/interfaces/default/images/platforms/xbox.png differ
diff --git a/data/interfaces/default/js/tables/history_table.js b/data/interfaces/default/js/tables/history_table.js
index 8082b100..8b442f57 100644
--- a/data/interfaces/default/js/tables/history_table.js
+++ b/data/interfaces/default/js/tables/history_table.js
@@ -89,8 +89,8 @@ history_table_options = {
},
{
"targets": [5],
- "data":"title",
- "name":"title",
+ "data":"full_title",
+ "name":"full_title",
"createdCell": function (td, cellData, rowData, row, col) {
if (cellData !== '') {
if (rowData['media_type'] === 'movie' || rowData['media_type'] === 'episode') {
@@ -198,6 +198,12 @@ history_table_options = {
"data":"video_decision",
"searchable":false,
"visible":false
+ },
+ {
+ "targets": [16],
+ "data":"user_id",
+ "searchable":false,
+ "visible":false
}
diff --git a/data/interfaces/default/user.html b/data/interfaces/default/user.html
index 9c44b57d..315081f3 100644
--- a/data/interfaces/default/user.html
+++ b/data/interfaces/default/user.html
@@ -198,6 +198,7 @@ from plexpy import helpers
|
|
|
+ |
diff --git a/plexpy/datafactory.py b/plexpy/datafactory.py
index 1f4ea71a..7f7bc9c5 100644
--- a/plexpy/datafactory.py
+++ b/plexpy/datafactory.py
@@ -146,7 +146,7 @@ class DataFactory(object):
'.user ELSE users.friendly_name END) as friendly_name',
t1 + '.player as platform',
t1 + '.ip_address',
- t2 + '.full_title as title',
+ t2 + '.full_title as full_title',
t1 + '.started',
t1 + '.paused_counter',
t1 + '.stopped',
@@ -195,7 +195,7 @@ class DataFactory(object):
"friendly_name": item['friendly_name'],
"platform": item["platform"],
"ip_address": item["ip_address"],
- "title": item["title"],
+ "full_title": item["full_title"],
"started": item["started"],
"paused_counter": item["paused_counter"],
"stopped": item["stopped"],
@@ -259,7 +259,7 @@ class DataFactory(object):
columns = ['session_history.started as last_seen',
'session_history.ip_address as ip_address',
- 'COUNT(session_history.ip_address) as play_count',
+ 'COUNT(session_history.id) as play_count',
'session_history.player as platform',
'session_history_metadata.full_title as last_watched',
'session_history.user as user',
@@ -413,9 +413,17 @@ class DataFactory(object):
'LIMIT 1'
result = monitor_db.select(query, args=[user, user])
elif user_id:
- query = 'SELECT user_id, username, friendly_name, email, thumb, ' \
- 'is_home_user, is_allow_sync, is_restricted FROM users WHERE user_id = ? LIMIT 1'
- result = monitor_db.select(query, args=[user_id])
+ query = 'SELECT user_id, username, friendly_name, email, ' \
+ 'thumb, is_home_user, is_allow_sync, is_restricted ' \
+ 'FROM users ' \
+ 'WHERE user_id = ? ' \
+ 'UNION ALL ' \
+ 'SELECT user_id, user, null, null, null, null, null, null ' \
+ 'FROM session_history ' \
+ 'WHERE user_id = ? ' \
+ 'GROUP BY user ' \
+ 'LIMIT 1'
+ result = monitor_db.select(query, args=[user_id, user_id])
if result:
for item in result:
if not item['friendly_name']:
@@ -540,7 +548,8 @@ class DataFactory(object):
'users.friendly_name end) as friendly_name,' \
'COUNT(session_history.id) as total_plays, ' \
'MAX(session_history.started) as last_watch, ' \
- 'users.thumb ' \
+ 'users.thumb, ' \
+ 'users.user_id ' \
'FROM session_history ' \
'JOIN session_history_metadata ON session_history.id = session_history_metadata.id ' \
'LEFT OUTER JOIN users ON session_history.user_id = users.user_id ' \
@@ -560,6 +569,7 @@ class DataFactory(object):
user_thumb = item[4]
row = {'user': item[0],
+ 'user_id': item[5],
'friendly_name': item[1],
'total_plays': item[2],
'last_play': item[3],
diff --git a/plexpy/datatables.py b/plexpy/datatables.py
index 39ad17c2..4c821999 100644
--- a/plexpy/datatables.py
+++ b/plexpy/datatables.py
@@ -80,9 +80,9 @@ class DataTables(object):
% (column_data['column_string'], table_name, join, group_by,
where, order)
else:
- query = 'SELECT * FROM (SELECT * FROM (SELECT %s FROM %s %s GROUP BY %s) %s %s) %s' \
- % (column_data['column_string'], table_name, join, group_by,
- where, order, custom_where)
+ query = 'SELECT * FROM (SELECT %s FROM %s %s %s GROUP BY %s) %s %s' \
+ % (column_data['column_string'], table_name, join, custom_where, group_by,
+ where, order)
else:
if custom_where == '':
query = 'SELECT %s FROM %s %s %s %s' \