Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Filter history by local and remote plays #1961

Draft
wants to merge 4 commits into
base: nightly
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
12 changes: 12 additions & 0 deletions data/interfaces/default/css/tautulli.css
Original file line number Diff line number Diff line change
Expand Up @@ -2427,6 +2427,18 @@ a .library-user-instance-box:hover {
.home-padded-header .button-bar {
float: left;
}
#history-option-container {
float: right;
background-color: #333;
padding: 1rem;
border-radius: 0.6rem;
}
.history-option-bar {
margin: 0.2rem;
}
.history-option-button-group {
display: table-cell;
}
.home-platforms {
}
.home-platforms ul,
Expand Down
144 changes: 89 additions & 55 deletions data/interfaces/default/history.html
Original file line number Diff line number Diff line change
Expand Up @@ -16,57 +16,74 @@
</div>
% endif
<div class='table-card-header'>
<div class="header-bar">
<div class="header-bar" style="margin-top: 2.4rem;">
<span><i class="fa fa-history"></i> History</span>
</div>
<div class="button-bar">
% if _session['user_group'] == 'admin':
<div class="alert alert-danger alert-edit" role="alert" id="row-edit-mode-alert"><i class="fa fa-exclamation-triangle"></i>&nbsp</div>
<div class="btn-group">
<button class="btn btn-danger btn-edit" data-toggle="button" aria-pressed="false" autocomplete="off" id="row-edit-mode">
<i class="fa fa-trash-o"></i> Delete mode
</button>
<div id="history-option-container" class="container">
<div class="button-bar history-option-bar" style="float: left;">
% if _session['user_group'] == 'admin':
<div class="alert alert-danger alert-edit" role="alert" id="row-edit-mode-alert"><i class="fa fa-exclamation-triangle"></i>&nbsp</div>
<div class="btn-group">
<button class="btn btn-danger btn-edit" data-toggle="button" aria-pressed="false" autocomplete="off" id="row-edit-mode">
<i class="fa fa-trash-o"></i> Delete mode
</button>
</div>
% endif
% if _session['user_group'] == 'admin':
<div class="btn-group" id="user-selection">
<label>
<select name="history-user" id="history-user" class="btn" style="color: inherit;">
<option value="">All Users</option>
<option disabled>&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;</option>
</select>
</label>
</div>
% endif
</div>
% endif
% if _session['user_group'] == 'admin':
<div class="btn-group" id="user-selection">
<label>
<select name="history-user" id="history-user" class="btn" style="color: inherit;">
<option value="">All Users</option>
<option disabled>&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;&#9472;</option>
</select>
</label>
<div class="button-bar history-option-bar">
<div class="btn-group">
<button class="btn btn-dark refresh-history-button" id="refresh-history-list"><i class="fa fa-refresh"></i> Refresh history</button>
</div>
<div class="btn-group colvis-button-bar"></div>
</div>
% endif
<div class="btn-group" data-toggle="buttons" id="media_type-selection">
<label class="btn btn-dark btn-filter">
<input type="checkbox" name="media_type-filter" id="history-media_type-movie" value="movie" autocomplete="off"><i class="fa fa-film"></i> Movies
</label>
<label class="btn btn-dark btn-filter">
<input type="checkbox" name="media_type-filter" id="history-media_type-episode" value="episode" autocomplete="off"><i class="fa fa-television"></i> TV Shows
</label>
<label class="btn btn-dark btn-filter">
<input type="checkbox" name="media_type-filter" id="history-media_type-track" value="track" autocomplete="off"><i class="fa fa-music"></i> Music
</label>
<label class="btn btn-dark btn-filter">
<input type="checkbox" name="media_type-filter" id="history-media_type-live" value="live" autocomplete="off"><i class="fa fa-broadcast-tower"></i> Live TV
</label>
<div class="button-bar history-option-bar">
<div class="btn-group-justified history-option-button-group" data-toggle="buttons" id="media_type-selection" style="padding-right: 0.5rem;">
<label class="btn btn-dark btn-filter">
<input type="checkbox" name="media_type-filter" id="history-media_type-movie" value="movie" autocomplete="off"><i class="fa fa-film"></i> Movies
</label>
<label class="btn btn-dark btn-filter">
<input type="checkbox" name="media_type-filter" id="history-media_type-episode" value="episode" autocomplete="off"><i class="fa fa-television"></i> TV Shows
</label>
<label class="btn btn-dark btn-filter">
<input type="checkbox" name="media_type-filter" id="history-media_type-track" value="track" autocomplete="off"><i class="fa fa-music"></i> Music
</label>
<label class="btn btn-dark btn-filter">
<input type="checkbox" name="media_type-filter" id="history-media_type-live" value="live" autocomplete="off"><i class="fa fa-broadcast-tower"></i> Live TV
</label>
</div>
<div class="btn-group-justified history-option-button-group" data-toggle="buttons" id="network_type-selection" style="padding-right: 0.5rem;">
<label class="btn btn-dark btn-filter">
<input type="checkbox" name="network_type-filter" id="history-network_type-lan" value="lan" autocomplete="off"><i class="fa fa-server"></i> Local Play
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
<input type="checkbox" name="network_type-filter" id="history-network_type-lan" value="lan" autocomplete="off"><i class="fa fa-server"></i> Local Play
<input type="checkbox" name="network_type-filter" id="history-network_type-lan" value="lan" autocomplete="off"><i class="fa fa-laptop-house"></i> Local

</label>
<label class="btn btn-dark btn-filter">
<input type="checkbox" name="network_type-filter" id="history-network_type-wan" value="wan" autocomplete="off"><i class="fa fa-globe"></i> Remote Play
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
<input type="checkbox" name="network_type-filter" id="history-network_type-wan" value="wan" autocomplete="off"><i class="fa fa-globe"></i> Remote Play
<input type="checkbox" name="network_type-filter" id="history-network_type-wan" value="wan" autocomplete="off"><i class="fa fa-globe"></i> Remote

</label>
<label class="btn btn-dark btn-filter">
<input type="checkbox" name="network_type-filter" id="history-network_type-cellular" value="cellular" autocomplete="off"><i class="fa fa-broadcast-tower"></i> Mobile Play
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
<input type="checkbox" name="network_type-filter" id="history-network_type-cellular" value="cellular" autocomplete="off"><i class="fa fa-broadcast-tower"></i> Mobile Play
<input type="checkbox" name="network_type-filter" id="history-network_type-cellular" value="cellular" autocomplete="off"><i class="fa fa-broadcast-tower"></i> Mobile

</label>
</div>
<div class="btn-group-justified history-option-button-group" data-toggle="buttons" id="transcode_decision-selection">
<label class="btn btn-dark btn-filter">
<input type="checkbox" name="transcode_decision-filter" id="history-transcode_decision-direct_play" value="direct play" autocomplete="off"><i class="fa fa-play-circle"></i> Direct Play
</label>
<label class="btn btn-dark btn-filter">
<input type="checkbox" name="transcode_decision-filter" id="history-transcode_decision-copy" value="copy" autocomplete="off"><i class="fa fa-stream"></i> Direct Stream
</label>
<label class="btn btn-dark btn-filter">
<input type="checkbox" name="transcode_decision-filter" id="history-transcode_decision-transcode" value="transcode" autocomplete="off"><i class="fa fa-server"></i> Transcode
</label>
</div>
</div>
<div class="btn-group" data-toggle="buttons" id="transcode_decision-selection">
<label class="btn btn-dark btn-filter">
<input type="checkbox" name="transcode_decision-filter" id="history-transcode_decision-direct_play" value="direct play" autocomplete="off"><i class="fa fa-play-circle"></i> Direct Play
</label>
<label class="btn btn-dark btn-filter">
<input type="checkbox" name="transcode_decision-filter" id="history-transcode_decision-copy" value="copy" autocomplete="off"><i class="fa fa-stream"></i> Direct Stream
</label>
<label class="btn btn-dark btn-filter">
<input type="checkbox" name="transcode_decision-filter" id="history-transcode_decision-transcode" value="transcode" autocomplete="off"><i class="fa fa-server"></i> Transcode
</label>
</div>
<div class="btn-group">
<button class="btn btn-dark refresh-history-button" id="refresh-history-list"><i class="fa fa-refresh"></i> Refresh history</button>
</div>
<div class="btn-group colvis-button-bar"></div>
</div>
</div>
<div class="table-card-back">
Expand Down Expand Up @@ -145,14 +162,15 @@ <h4 class="modal-title" id="myModalLabel">Confirm Delete</h4>
}
});

function loadHistoryTable(media_type, transcode_decision, selected_user_id) {
function loadHistoryTable(media_type, network_type, transcode_decision, selected_user_id) {
history_table_options.ajax = {
url: 'get_history',
type: 'POST',
data: function (d) {
return {
json_data: JSON.stringify(d),
media_type: media_type,
network_type: network_type,
transcode_decision: transcode_decision,
user_id: selected_user_id
};
Expand All @@ -170,16 +188,25 @@ <h4 class="modal-title" id="myModalLabel">Confirm Delete</h4>

$('#media_type-selection').on('change', function () {
$('#media_type-selection > label').removeClass('active');
var selected_filter = $('input[name=media_type-filter]:checked', '#media_type-selection');
let selected_filter = $('input[name=media_type-filter]:checked', '#media_type-selection');
$(selected_filter).closest('label').addClass('active');
media_type = $(selected_filter).map(function () { return $(this).val(); }).get().join(',');
setLocalStorage('history_media_type', media_type);
history_table.draw();
});

$('#network_type-selection').on('change', function () {
$('#network_type-selection > label').removeClass('active');
let selected_filter = $('input[name=network_type-filter]:checked', '#network_type-selection');
$(selected_filter).closest('label').addClass('active');
network_type = $(selected_filter).map(function () { return $(this).val(); }).get().join(',');
setLocalStorage('history_network_type', network_type);
history_table.draw();
});

$('#transcode_decision-selection').on('change', function () {
$('#transcode_decision-selection > label').removeClass('active');
var selected_filter = $('input[name=transcode_decision-filter]:checked', '#transcode_decision-selection');
let selected_filter = $('input[name=transcode_decision-filter]:checked', '#transcode_decision-selection');
$(selected_filter).closest('label').addClass('active');
transcode_decision = $(selected_filter).map(function () { return $(this).val(); }).get().join(',');
setLocalStorage('history_transcode_decision', transcode_decision);
Expand All @@ -192,23 +219,30 @@ <h4 class="modal-title" id="myModalLabel">Confirm Delete</h4>
});
}

var selected_user_id = "${_session['user_group']}" == "admin" ? null : "${_session['user_id']}";
const selected_user_id = "${_session['user_group']}" == "admin" ? null : "${_session['user_id']}";

var media_type = getLocalStorage('history_media_type', 'all');
const media_type = getLocalStorage('history_media_type', 'all');
$.each(media_type.split(','), function (i, item) {
var history_media_type = $('#history-media_type-' + item);
let history_media_type = $('#history-media_type-' + item);
history_media_type.prop('checked', true);
history_media_type.closest('label').addClass('active');
});

var transcode_decision = getLocalStorage('history_transcode_decision', 'all');
const network_type = getLocalStorage('history_network_type', '');
$.each(network_type.split(','), function (i, item) {
let history_network_type = $('#history-network_type-' + item);
history_network_type.prop('checked', true);
history_network_type.closest('label').addClass('active');
});

const transcode_decision = getLocalStorage('history_transcode_decision', 'all');
$.each(transcode_decision.split(','), function (i, item) {
var history_transcode_decision = $('#history-transcode_decision-' + item.replace(' ', '_'));
let history_transcode_decision = $('#history-transcode_decision-' + item.replace(' ', '_'));
history_transcode_decision.prop('checked', true);
history_transcode_decision.closest('label').addClass('active');
});

loadHistoryTable(media_type, transcode_decision, selected_user_id);
loadHistoryTable(media_type, network_type, transcode_decision, selected_user_id);

% if _session['user_group'] == 'admin':
$('#row-edit-mode').on('click', function() {
Expand Down
38 changes: 32 additions & 6 deletions data/interfaces/default/library.html
Original file line number Diff line number Diff line change
Expand Up @@ -216,6 +216,17 @@
</button>
</div>
% endif
<div class="btn-group" data-toggle="buttons" id="network_type-selection">
<label class="btn btn-dark btn-filter">
<input type="checkbox" name="network_type-filter" id="history-network_type-lan" value="lan" autocomplete="off"><i class="fa fa-server"></i> Local Play
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
<input type="checkbox" name="network_type-filter" id="history-network_type-lan" value="lan" autocomplete="off"><i class="fa fa-server"></i> Local Play
<input type="checkbox" name="network_type-filter" id="history-network_type-lan" value="lan" autocomplete="off"><i class="fa fa-laptop-house"></i> Local

</label>
<label class="btn btn-dark btn-filter">
<input type="checkbox" name="network_type-filter" id="history-network_type-wan" value="wan" autocomplete="off"><i class="fa fa-globe"></i> Remote Play
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
<input type="checkbox" name="network_type-filter" id="history-network_type-wan" value="wan" autocomplete="off"><i class="fa fa-globe"></i> Remote Play
<input type="checkbox" name="network_type-filter" id="history-network_type-wan" value="wan" autocomplete="off"><i class="fa fa-globe"></i> Remote

</label>
<label class="btn btn-dark btn-filter">
<input type="checkbox" name="network_type-filter" id="history-network_type-cellular" value="cellular" autocomplete="off"><i class="fa fa-broadcast-tower"></i> Mobile Play
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
<input type="checkbox" name="network_type-filter" id="history-network_type-cellular" value="cellular" autocomplete="off"><i class="fa fa-broadcast-tower"></i> Mobile Play
<input type="checkbox" name="network_type-filter" id="history-network_type-cellular" value="cellular" autocomplete="off"><i class="fa fa-broadcast-tower"></i> Mobile

</label>
</div>
<div class="btn-group" data-toggle="buttons" id="transcode_decision-selection">
<label class="btn btn-dark btn-filter">
<input type="checkbox" name="transcode_decision-filter" id="history-transcode_decision-direct_play" value="direct play" autocomplete="off"><i class="fa fa-play-circle"></i> Direct Play
Expand Down Expand Up @@ -567,7 +578,7 @@ <h4 class="modal-title" id="myModalLabel">Confirm Delete</h4>

$(".inactive-library-tooltip").tooltip();

function loadHistoryTable(transcode_decision) {
function loadHistoryTable(network_type, transcode_decision) {
// Build watch history table
history_table_options.ajax = {
url: 'get_history',
Expand All @@ -577,6 +588,7 @@ <h4 class="modal-title" id="myModalLabel">Confirm Delete</h4>
json_data: JSON.stringify( d ),
section_id: section_id,
user_id: "${history_user_id}",
network_type: network_type,
transcode_decision: transcode_decision
};
}
Expand All @@ -590,24 +602,38 @@ <h4 class="modal-title" id="myModalLabel">Confirm Delete</h4>

$('#transcode_decision-selection').on('change', function () {
$('#transcode_decision-selection > label').removeClass('active');
var selected_filter = $('input[name=transcode_decision-filter]:checked', '#transcode_decision-selection');
let selected_filter = $('input[name=transcode_decision-filter]:checked', '#transcode_decision-selection');
$(selected_filter).closest('label').addClass('active');
transcode_decision = $(selected_filter).map(function () { return $(this).val(); }).get().join(',');
setLocalStorage('library_' + section_id + 'history_transcode_decision', transcode_decision);
history_table.draw();
});

$('#network_type-selection').on('change', function () {
$('#network_type-selection > label').removeClass('active');
let selected_filter = $('input[name=network_type-filter]:checked', '#network_type-selection');
$(selected_filter).closest('label').addClass('active');
network_type = $(selected_filter).map(function () { return $(this).val(); }).get().join(',');
setLocalStorage('library_' + section_id + 'history_network_type', network_type);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
setLocalStorage('library_' + section_id + 'history_network_type', network_type);
setLocalStorage('library_' + section_id + '-history_network_type', network_type);

history_table.draw();
});
}

$('#nav-tabs-history').on('shown.bs.tab', function() {
if (typeof(history_table) === 'undefined') {
var transcode_decision = getLocalStorage('library_' + section_id + 'history_transcode_decision', 'all');
const transcode_decision = getLocalStorage('library_' + section_id + 'history_transcode_decision', 'all');
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
const transcode_decision = getLocalStorage('library_' + section_id + 'history_transcode_decision', 'all');
const transcode_decision = getLocalStorage('library_' + section_id + '-history_transcode_decision', 'all');

Also fix setLocalStoage on line 608.

$.each(transcode_decision.split(','), function (i, item) {
var history_transcode_decision = $('#history-transcode_decision-' + item.replace(' ', '_'));
let history_transcode_decision = $('#history-transcode_decision-' + item.replace(' ', '_'));
history_transcode_decision.prop('checked', true);
history_transcode_decision.closest('label').addClass('active');
});

loadHistoryTable(transcode_decision);
const network_type = getLocalStorage('library_' + section_id + 'history_network_type', '');
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
const network_type = getLocalStorage('library_' + section_id + 'history_network_type', '');
const network_type = getLocalStorage('library_' + section_id + '-history_network_type', '');

$.each(network_type.split(','), function (i, item) {
let history_network_type = $('#history-network_type-' + item);
history_network_type.prop('checked', true);
history_network_type.closest('label').addClass('active');
});
loadHistoryTable(network_type, transcode_decision);
}
});

Expand Down