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

Conversation

herby2212
Copy link
Contributor

@herby2212 herby2212 commented Jan 7, 2023

Description

This PR aims to implement feature request #1813 by adding a filter for the history table to filter on elements played in the local network (lan), played remote (wan) or mobile (cellular).

The settings/filter bar has partly been reworked to account for the space needed by the new buttons. With this re-arrangement additional filters, selections or buttons can be integrated in the yet free space.

Components:

  • History
  • Library History
  • User History

Open points:

  • CSS optimization
  • Response Behaviour Check
  • Font Awesome Update?

Screenshot

History
image

Library History
image

User History
image

Type of Change

Please delete options that are not relevant.

  • New feature (non-breaking change which adds functionality)

Checklist

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have added or updated the docstring for new or existing methods

@herby2212 herby2212 marked this pull request as draft January 7, 2023 13:57
Copy link
Contributor

@JonnyWong16 JonnyWong16 left a comment

Choose a reason for hiding this comment

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

I'm not a fan of the "box" design for the filters. But I also don't have a better suggestion at the moment.

@@ -1898,6 +1898,7 @@ def get_history(self, user=None, user_id=None, grouping=None, include_activity=N
after (str): History after and including the date, "YYYY-MM-DD"
section_id (int): 2
media_type (str): "movie", "episode", "track", "live"
network_type (str): "lan", "wan", "cellular"
Copy link
Contributor

Choose a reason for hiding this comment

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

Rename network_type to location so it is consistent with the rest of the API (i.e. get_activity and get_history).

history_network_type.closest('label').addClass('active');
});

const transcode_decision = getLocalStorage('user_' + user_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('user_' + user_id + 'history_transcode_decision', 'all');
const transcode_decision = getLocalStorage('user_' + user_id + '-history_transcode_decision', 'all');

Also fix setLocalStoage on line 598.

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('user_' + user_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('user_' + user_id + 'history_network_type', network_type);
setLocalStorage('user_' + user_id + '-history_network_type', network_type);

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', '');

}

$('#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.

<input type="checkbox" name="network_type-filter" id="history-network_type-lan" value="lan" autocomplete="off"><i class="fa fa-server"></i> Local Play
</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

<input type="checkbox" name="network_type-filter" id="history-network_type-wan" value="wan" autocomplete="off"><i class="fa fa-globe"></i> Remote Play
</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

</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

<input type="checkbox" name="network_type-filter" id="history-network_type-lan" value="lan" autocomplete="off"><i class="fa fa-server"></i> Local Play
</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

<input type="checkbox" name="network_type-filter" id="history-network_type-wan" value="wan" autocomplete="off"><i class="fa fa-globe"></i> Remote Play
</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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

Successfully merging this pull request may close these issues.

None yet

2 participants