Skip to content

Commit

Permalink
Hide user info for Now Screening
Browse files Browse the repository at this point in the history
  • Loading branch information
Matthew Petersen committed Aug 31, 2021
1 parent 2db5902 commit d1df484
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 4 deletions.
4 changes: 4 additions & 0 deletions classes/core/settings.js
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,8 @@ class Settings {
this.enableTrivia = DEFAULT_SETTINGS.enableTrivia;
this.triviaNumber = DEFAULT_SETTINGS.triviaNumber;
this.triviaFrequency = DEFAULT_SETTINGS.triviaFrequency;
this.pinNS = DEFAULT_SETTINGS.pinNS;
this.hideUser = DEFAULT_SETTINGS.hideUser;
return;
}

Expand Down Expand Up @@ -271,6 +273,8 @@ class Settings {
else this.genres = cs.genres;
if (jsonObject.pinNSSwitch) this.pinNS = jsonObject.pinNSSwitch;
else this.pinNS = cs.pinNS;
if (jsonObject.hideUser) this.hideUser = jsonObject.hideUser;
else this.hideUser = cs.hideUser;
if (jsonObject.titleFont) this.custBrand = jsonObject.titleFont;
else this.custBrand = cs.custBrand;
if (jsonObject.nowScreening) this.nowScreening = jsonObject.nowScreening;
Expand Down
9 changes: 6 additions & 3 deletions classes/mediaservers/plex.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ class Plex {
* @desc Gets now screening cards
* @returns {object} mediaCard[] - Returns an array of mediaCards
*/
async GetNowScreening(playThemes, playGenenericThemes, hasArt, filterRemote, filterLocal, filterDevices, filterUsers) {
async GetNowScreening(playThemes, playGenenericThemes, hasArt, filterRemote, filterLocal, filterDevices, filterUsers, hideUser) {
// get raw data first
let nsCards = [];
let nsRaw;
Expand Down Expand Up @@ -358,8 +358,11 @@ class Plex {

// populate common data
medCard.mediaType = md.type;
medCard.user = md.User.title;
medCard.device = md.Player.device;
//hide identifiable info if set
if(hideUser !== "true") {
medCard.user = md.User.title;
medCard.device = md.Player.device;
}

medCard.runTime = Math.round(md.Media[0].duration / 60000);
medCard.progress = Math.round(md.viewOffset / 60000);
Expand Down
1 change: 1 addition & 0 deletions consts.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ const DEFAULT_SETTINGS = {
plexPort : 32400,
plexToken : "",
pinNS : "false",
hideUser: "false",
onDemandLibraries : "",
numberOnDemand : 2,
onDemandRefresh : 30,
Expand Down
4 changes: 3 additions & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -438,7 +438,8 @@ async function loadNowScreening() {
loadedSettings.filterRemote,
loadedSettings.filterLocal,
loadedSettings.filterDevices,
loadedSettings.filterUsers
loadedSettings.filterUsers,
loadedSettings.hideUser
);
// restore defaults if plex now available after an error
if (isPlexUnavailable) {
Expand Down Expand Up @@ -1493,6 +1494,7 @@ app.post(
plexPort: req.body.plexPort ? parseInt(req.body.plexPort) : DEFAULT_SETTINGS.plexPort,
plexLibraries: req.body.plexLibraries,
pinNSSwitch: req.body.pinNSSwitch,
hideUser: req.body.hideUser,
numberOnDemand: !isNaN(parseInt(req.body.numberOnDemand)) ? parseInt(req.body.numberOnDemand) : DEFAULT_SETTINGS.numberOnDemand,
onDemandRefresh: parseInt(req.body.onDemandRefresh) ? parseInt(req.body.onDemandRefresh) : DEFAULT_SETTINGS.onDemandRefresh,
genres: req.body.genres,
Expand Down
9 changes: 9 additions & 0 deletions myviews/settings.ejs
Original file line number Diff line number Diff line change
Expand Up @@ -642,6 +642,15 @@
</div>
</div>
<div class="form-group">
<div class="custom-control custom-control-nolabel custom-switch ml-auto">
<input type="checkbox" class="custom-control-input" name="hideUser" id="hideUser"
value="true" <% if(typeof formData !== 'undefined' && errors){%><%=formData.hideUser ? 'checked' : '' %><%}else{%><%=(settings.hideUser == 'true') ? 'checked' : '' %><%}%>>
<label class="custom-control-label" for="hideUser">Hide user info</label>
<small id="hideUserHelp" class="form-text text-muted">Hides user information being displayed at bottom of slide</small>
</div>
</div>
<div class="form-group">
<label for="filterDevices">Filter by device(s)</label>
<input type="text" class="form-control" id="filterDevices" name="filterDevices" aria-describedby="filterDevicesHelp"
Expand Down

0 comments on commit d1df484

Please sign in to comment.