diff --git a/data/interfaces/default/js/tables/history_table.js b/data/interfaces/default/js/tables/history_table.js index a9552dab..c3be6f33 100644 --- a/data/interfaces/default/js/tables/history_table.js +++ b/data/interfaces/default/js/tables/history_table.js @@ -36,10 +36,10 @@ history_table_options = { "targets": [0], "data": null, "createdCell": function (td, cellData, rowData, row, col) { - if (rowData['id'] === null) { + if (rowData['row_id'] === null) { $(td).html(''); } else { - $(td).html(''); + $(td).html(''); } }, "width": "5%", @@ -317,19 +317,19 @@ history_table_options = { "rowCallback": function (row, rowData, rowIndex) { if (rowData['group_count'] == 1) { // if no grouped rows simply toggle the delete button - if ($.inArray(rowData['id'], history_to_delete) !== -1) { - $(row).find('button[data-id="' + rowData['id'] + '"]').toggleClass('btn-warning').toggleClass('btn-danger'); + if ($.inArray(rowData['row_id'], history_to_delete) !== -1) { + $(row).find('button[data-id="' + rowData['row_id'] + '"]').toggleClass('btn-warning').toggleClass('btn-danger'); } - } else if (rowData['id'] !== null) { + } else if (rowData['row_id'] !== null) { // if grouped rows // toggle the parent button to danger - $(row).find('button[data-id="' + rowData['id'] + '"]').toggleClass('btn-warning').toggleClass('btn-danger'); + $(row).find('button[data-id="' + rowData['row_id'] + '"]').toggleClass('btn-warning').toggleClass('btn-danger'); // check if any child rows are not selected var group_ids = rowData['group_ids'].split(',').map(Number); group_ids.forEach(function (id) { var index = $.inArray(id, history_to_delete); if (index == -1) { - $(row).find('button[data-id="' + rowData['id'] + '"]').addClass('btn-warning').removeClass('btn-danger'); + $(row).find('button[data-id="' + rowData['row_id'] + '"]').addClass('btn-warning').removeClass('btn-danger'); } }); } @@ -353,7 +353,7 @@ $('.history_table').on('click', '> tbody > tr > td.modal-control', function () { var rowData = row.data(); $.get('get_stream_data', { - row_id: rowData['id'], + row_id: rowData['row_id'], session_key: rowData['session_key'], user: rowData['friendly_name'] }).then(function (jqXHR) { @@ -382,9 +382,9 @@ $('.history_table').on('click', '> tbody > tr > td.delete-control > button', fun if (rowData['group_count'] == 1) { // if no grouped rows simply add or remove row from history_to_delete - var index = $.inArray(rowData['id'], history_to_delete); + var index = $.inArray(rowData['row_id'], history_to_delete); if (index === -1) { - history_to_delete.push(rowData['id']); + history_to_delete.push(rowData['row_id']); } else { history_to_delete.splice(index, 1); } @@ -549,7 +549,7 @@ function createChildTable(row, rowData) { var childRowData = childRow.data(); $.get('get_stream_data', { - row_id: childRowData['id'], + row_id: childRowData['row_id'], user: childRowData['friendly_name'] }).then(function (jqXHR) { $("#info-modal").html(jqXHR); @@ -576,9 +576,9 @@ function createChildTable(row, rowData) { var childRowData = childRow.data(); // add or remove row from history_to_delete - var index = $.inArray(childRowData['id'], history_to_delete); + var index = $.inArray(childRowData['row_id'], history_to_delete); if (index === -1) { - history_to_delete.push(childRowData['id']); + history_to_delete.push(childRowData['row_id']); } else { history_to_delete.splice(index, 1); } diff --git a/data/interfaces/default/js/tables/history_table_modal.js b/data/interfaces/default/js/tables/history_table_modal.js index 575e91cd..69030b3a 100644 --- a/data/interfaces/default/js/tables/history_table_modal.js +++ b/data/interfaces/default/js/tables/history_table_modal.js @@ -169,7 +169,7 @@ $('.history_table').on('click', 'td.modal-control', function () { function showStreamDetails() { $.ajax({ url: 'get_stream_data', - data: { row_id: rowData['id'], user: rowData['friendly_name'] }, + data: { row_id: rowData['row_id'], user: rowData['friendly_name'] }, cache: false, async: true, complete: function (xhr, status) { diff --git a/plexpy/datafactory.py b/plexpy/datafactory.py index bbdea771..01a00340 100644 --- a/plexpy/datafactory.py +++ b/plexpy/datafactory.py @@ -64,7 +64,7 @@ class DataFactory(object): columns = [ 'session_history.reference_id', - 'session_history.id', + 'session_history.id AS row_id', 'MAX(started) AS date', 'MIN(started) AS started', 'MAX(stopped) AS stopped', @@ -116,7 +116,7 @@ class DataFactory(object): columns_union = [ 'NULL AS reference_id', - 'NULL AS id', + 'NULL AS row_id', 'started AS date', 'started', 'stopped', @@ -228,7 +228,7 @@ class DataFactory(object): platform = common.PLATFORM_NAME_OVERRIDES.get(item['platform'], item['platform']) row = {'reference_id': item['reference_id'], - 'id': item['id'], + 'row_id': item['row_id'], 'date': item['date'], 'started': item['started'], 'stopped': item['stopped'], diff --git a/plexpy/webserve.py b/plexpy/webserve.py index 65ff47dd..5329a755 100644 --- a/plexpy/webserve.py +++ b/plexpy/webserve.py @@ -1663,7 +1663,6 @@ class WebInterface(object): "group_count": 1, "group_ids": "1124", "guid": "com.plexapp.agents.thetvdb://121361/6/1?lang=en", - "id": 1124, "ip_address": "xxx.xxx.xxx.xxx", "live": 0, "media_index": 17, @@ -1679,6 +1678,7 @@ class WebInterface(object): "player": "Castle-PC", "rating_key": 4348, "reference_id": 1123, + "row_id": 1124, "session_key": null, "started": 1462688107, "state": null,