1
0
Fork 0
mirror of https://github.com/jellyfin/jellyfin-web synced 2025-03-30 19:56:21 +00:00

Add setting for max days for a show to appear in next up list

This commit is contained in:
Jack 2021-06-22 22:05:51 -04:00
parent 2fe6a63542
commit e0a6ad943f
5 changed files with 35 additions and 3 deletions

View file

@ -132,6 +132,7 @@ import template from './displaySettings.template.html';
context.querySelector('.selectDateTimeLocale').value = userSettings.dateTimeLocale() || ''; context.querySelector('.selectDateTimeLocale').value = userSettings.dateTimeLocale() || '';
context.querySelector('#txtLibraryPageSize').value = userSettings.libraryPageSize(); context.querySelector('#txtLibraryPageSize').value = userSettings.libraryPageSize();
context.querySelector('#txtMaxDaysForNextUp').value = userSettings.maxDaysForNextUp();
context.querySelector('.selectLayout').value = layoutManager.getSavedLayout() || ''; context.querySelector('.selectLayout').value = layoutManager.getSavedLayout() || '';
@ -156,6 +157,7 @@ import template from './displaySettings.template.html';
userSettingsInstance.screensaver(context.querySelector('.selectScreensaver').value); userSettingsInstance.screensaver(context.querySelector('.selectScreensaver').value);
userSettingsInstance.libraryPageSize(context.querySelector('#txtLibraryPageSize').value); userSettingsInstance.libraryPageSize(context.querySelector('#txtLibraryPageSize').value);
userSettingsInstance.maxDaysForNextUp(context.querySelector("#txtMaxDaysForNextUp").value);
userSettingsInstance.enableFastFadein(context.querySelector('#chkFadein').checked); userSettingsInstance.enableFastFadein(context.querySelector('#chkFadein').checked);
userSettingsInstance.enableBlurhash(context.querySelector('#chkBlurhash').checked); userSettingsInstance.enableBlurhash(context.querySelector('#chkBlurhash').checked);

View file

@ -182,6 +182,11 @@
<div class="fieldDescription">${LabelLibraryPageSizeHelp}</div> <div class="fieldDescription">${LabelLibraryPageSizeHelp}</div>
</div> </div>
<div class="inputContainer inputContainer-withDescription">
<input is="emby-input" type="number" id="txtMaxDaysForNextUp" pattern="[0-9]*" required="required" min="0" max="1000" step="1" label="${LabelMaxDaysForNextUp}" />
<div class="fieldDescription">${LabelMaxDaysForNextUpHelp}</div>
</div>
<div class="checkboxContainer checkboxContainer-withDescription"> <div class="checkboxContainer checkboxContainer-withDescription">
<label> <label>
<input type="checkbox" is="emby-checkbox" id="chkFadein" /> <input type="checkbox" is="emby-checkbox" id="chkFadein" />

View file

@ -595,9 +595,11 @@ import ServerConnections from '../ServerConnections';
}); });
} }
function getNextUpFetchFn(serverId) { function getNextUpFetchFn(serverId, userSettings) {
return function () { return function () {
const apiClient = ServerConnections.getApiClient(serverId); const apiClient = ServerConnections.getApiClient(serverId);
let oldestDateForNextUp = new Date()
oldestDateForNextUp.setDate(oldestDateForNextUp.getDate() - userSettings.maxDaysForNextUp());
return apiClient.getNextUpEpisodes({ return apiClient.getNextUpEpisodes({
Limit: enableScrollX() ? 24 : 15, Limit: enableScrollX() ? 24 : 15,
Fields: 'PrimaryImageAspectRatio,DateCreated,BasicSyncInfo,Path', Fields: 'PrimaryImageAspectRatio,DateCreated,BasicSyncInfo,Path',
@ -605,7 +607,8 @@ import ServerConnections from '../ServerConnections';
ImageTypeLimit: 1, ImageTypeLimit: 1,
EnableImageTypes: 'Primary,Backdrop,Banner,Thumb', EnableImageTypes: 'Primary,Backdrop,Banner,Thumb',
EnableTotalRecordCount: false, EnableTotalRecordCount: false,
DisableFirstEpisode: true DisableFirstEpisode: false,
NextUpDateCutoff: oldestDateForNextUp.toUTCString()
}); });
}; };
} }
@ -665,7 +668,7 @@ import ServerConnections from '../ServerConnections';
elem.innerHTML = html; elem.innerHTML = html;
const itemsContainer = elem.querySelector('.itemsContainer'); const itemsContainer = elem.querySelector('.itemsContainer');
itemsContainer.fetchData = getNextUpFetchFn(apiClient.serverId()); itemsContainer.fetchData = getNextUpFetchFn(apiClient.serverId(), userSettings);
itemsContainer.getItemsHtml = getNextUpItemsHtmlFn(userSettings.useEpisodeImagesInNextUpAndResume()); itemsContainer.getItemsHtml = getNextUpItemsHtmlFn(userSettings.useEpisodeImagesInNextUpAndResume());
itemsContainer.parentContainer = elem; itemsContainer.parentContainer = elem;
} }

View file

@ -429,6 +429,25 @@ export class UserSettings {
} }
} }
/**
* Get or set max days for next up list.
* @param {number|undefined} val - Max days for next up.
* @return {number} Max days for a show to stay in next up without being watched.
*/
maxDaysForNextUp(val) {
if (val !== undefined) {
return this.set('maxDaysForNextUp', parseInt(val, 10), false);
}
const maxDaysForNextUp = parseInt(this.get('maxDaysForNextUp', false), 10);
if (maxDaysForNextUp === 0) {
// Explicitly return 0 to avoid returning 100 because 0 is falsy.
return 0;
} else {
return maxDaysForNextUp || 100;
}
}
/** /**
* Get or set sound effects. * Get or set sound effects.
* @param {string|undefined} val - Sound effects. * @param {string|undefined} val - Sound effects.
@ -545,6 +564,7 @@ export const skin = currentSettings.skin.bind(currentSettings);
export const theme = currentSettings.theme.bind(currentSettings); export const theme = currentSettings.theme.bind(currentSettings);
export const screensaver = currentSettings.screensaver.bind(currentSettings); export const screensaver = currentSettings.screensaver.bind(currentSettings);
export const libraryPageSize = currentSettings.libraryPageSize.bind(currentSettings); export const libraryPageSize = currentSettings.libraryPageSize.bind(currentSettings);
export const maxDaysForNextUp = currentSettings.maxDaysForNextUp.bind(currentSettings);
export const soundEffects = currentSettings.soundEffects.bind(currentSettings); export const soundEffects = currentSettings.soundEffects.bind(currentSettings);
export const loadQuerySettings = currentSettings.loadQuerySettings.bind(currentSettings); export const loadQuerySettings = currentSettings.loadQuerySettings.bind(currentSettings);
export const saveQuerySettings = currentSettings.saveQuerySettings.bind(currentSettings); export const saveQuerySettings = currentSettings.saveQuerySettings.bind(currentSettings);

View file

@ -680,6 +680,8 @@
"LabelLanNetworks": "LAN networks:", "LabelLanNetworks": "LAN networks:",
"LabelLibraryPageSize": "Library page size:", "LabelLibraryPageSize": "Library page size:",
"LabelLibraryPageSizeHelp": "Sets the amount of items to show on a library page. Set to 0 in order to disable paging.", "LabelLibraryPageSizeHelp": "Sets the amount of items to show on a library page. Set to 0 in order to disable paging.",
"LabelMaxDaysForNextUp": "Max days for next up",
"LabelMaxDaysForNextUpHelp": "Sets the maximum amount of days a shows should stay in the Next up list without watching it.",
"LabelLineup": "Lineup:", "LabelLineup": "Lineup:",
"LabelLocalCustomCss": "Custom CSS styling which applies to this client only. You may want to disable server custom CSS.", "LabelLocalCustomCss": "Custom CSS styling which applies to this client only. You may want to disable server custom CSS.",
"LabelLocalHttpServerPortNumber": "Local HTTP port number:", "LabelLocalHttpServerPortNumber": "Local HTTP port number:",