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:
parent
2fe6a63542
commit
e0a6ad943f
5 changed files with 35 additions and 3 deletions
|
@ -132,6 +132,7 @@ import template from './displaySettings.template.html';
|
|||
context.querySelector('.selectDateTimeLocale').value = userSettings.dateTimeLocale() || '';
|
||||
|
||||
context.querySelector('#txtLibraryPageSize').value = userSettings.libraryPageSize();
|
||||
context.querySelector('#txtMaxDaysForNextUp').value = userSettings.maxDaysForNextUp();
|
||||
|
||||
context.querySelector('.selectLayout').value = layoutManager.getSavedLayout() || '';
|
||||
|
||||
|
@ -156,6 +157,7 @@ import template from './displaySettings.template.html';
|
|||
userSettingsInstance.screensaver(context.querySelector('.selectScreensaver').value);
|
||||
|
||||
userSettingsInstance.libraryPageSize(context.querySelector('#txtLibraryPageSize').value);
|
||||
userSettingsInstance.maxDaysForNextUp(context.querySelector("#txtMaxDaysForNextUp").value);
|
||||
|
||||
userSettingsInstance.enableFastFadein(context.querySelector('#chkFadein').checked);
|
||||
userSettingsInstance.enableBlurhash(context.querySelector('#chkBlurhash').checked);
|
||||
|
|
|
@ -182,6 +182,11 @@
|
|||
<div class="fieldDescription">${LabelLibraryPageSizeHelp}</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">
|
||||
<label>
|
||||
<input type="checkbox" is="emby-checkbox" id="chkFadein" />
|
||||
|
|
|
@ -595,9 +595,11 @@ import ServerConnections from '../ServerConnections';
|
|||
});
|
||||
}
|
||||
|
||||
function getNextUpFetchFn(serverId) {
|
||||
function getNextUpFetchFn(serverId, userSettings) {
|
||||
return function () {
|
||||
const apiClient = ServerConnections.getApiClient(serverId);
|
||||
let oldestDateForNextUp = new Date()
|
||||
oldestDateForNextUp.setDate(oldestDateForNextUp.getDate() - userSettings.maxDaysForNextUp());
|
||||
return apiClient.getNextUpEpisodes({
|
||||
Limit: enableScrollX() ? 24 : 15,
|
||||
Fields: 'PrimaryImageAspectRatio,DateCreated,BasicSyncInfo,Path',
|
||||
|
@ -605,7 +607,8 @@ import ServerConnections from '../ServerConnections';
|
|||
ImageTypeLimit: 1,
|
||||
EnableImageTypes: 'Primary,Backdrop,Banner,Thumb',
|
||||
EnableTotalRecordCount: false,
|
||||
DisableFirstEpisode: true
|
||||
DisableFirstEpisode: false,
|
||||
NextUpDateCutoff: oldestDateForNextUp.toUTCString()
|
||||
});
|
||||
};
|
||||
}
|
||||
|
@ -665,7 +668,7 @@ import ServerConnections from '../ServerConnections';
|
|||
elem.innerHTML = html;
|
||||
|
||||
const itemsContainer = elem.querySelector('.itemsContainer');
|
||||
itemsContainer.fetchData = getNextUpFetchFn(apiClient.serverId());
|
||||
itemsContainer.fetchData = getNextUpFetchFn(apiClient.serverId(), userSettings);
|
||||
itemsContainer.getItemsHtml = getNextUpItemsHtmlFn(userSettings.useEpisodeImagesInNextUpAndResume());
|
||||
itemsContainer.parentContainer = elem;
|
||||
}
|
||||
|
|
|
@ -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.
|
||||
* @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 screensaver = currentSettings.screensaver.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 loadQuerySettings = currentSettings.loadQuerySettings.bind(currentSettings);
|
||||
export const saveQuerySettings = currentSettings.saveQuerySettings.bind(currentSettings);
|
||||
|
|
|
@ -680,6 +680,8 @@
|
|||
"LabelLanNetworks": "LAN networks:",
|
||||
"LabelLibraryPageSize": "Library page size:",
|
||||
"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:",
|
||||
"LabelLocalCustomCss": "Custom CSS styling which applies to this client only. You may want to disable server custom CSS.",
|
||||
"LabelLocalHttpServerPortNumber": "Local HTTP port number:",
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue