diff --git a/src/components/appRouter.js b/src/components/appRouter.js index 62ba350ed8..4b2b0006c0 100644 --- a/src/components/appRouter.js +++ b/src/components/appRouter.js @@ -752,7 +752,13 @@ class AppRouter { } if (item === 'nextup') { - return '#!/list.html?type=nextup&serverId=' + options.serverId; + url = '#!/list.html?type=nextup&serverId=' + options.serverId; + + if (options.rewatching) { + url += '&rewatching=' + options.rewatching; + } + + return url; } if (item === 'list') { diff --git a/src/components/homesections/homesections.js b/src/components/homesections/homesections.js index 2f42b2f24a..59d948e129 100644 --- a/src/components/homesections/homesections.js +++ b/src/components/homesections/homesections.js @@ -596,7 +596,7 @@ import ServerConnections from '../ServerConnections'; }); } - function getNextUpFetchFn(serverId, userSettings) { + function getNextUpFetchFn(serverId, userSettings, rewatching) { return function () { const apiClient = ServerConnections.getApiClient(serverId); const oldestDateForNextUp = new Date(); @@ -609,7 +609,8 @@ import ServerConnections from '../ServerConnections'; EnableImageTypes: 'Primary,Backdrop,Banner,Thumb', EnableTotalRecordCount: false, DisableFirstEpisode: false, - NextUpDateCutoff: oldestDateForNextUp.toISOString() + NextUpDateCutoff: oldestDateForNextUp.toISOString(), + Rewatching: rewatching }); }; } @@ -635,21 +636,32 @@ import ServerConnections from '../ServerConnections'; }; } - function loadNextUp(elem, apiClient, userSettings) { + function renderNextUpSection(elem, apiClient, userSettings, rewatching) { let html = ''; html += '
'; if (!layoutManager.tv) { html += ''; html += '

'; - html += globalize.translate('NextUp'); + if (rewatching) { + html += globalize.translate('NextUpRewatching'); + } else { + html += globalize.translate('NextUp'); + } html += '

'; html += ''; html += '
'; } else { - html += '

' + globalize.translate('NextUp') + '

'; + html += '

'; + if (rewatching) { + html += globalize.translate('NextUpRewatching'); + } else { + html += globalize.translate('NextUp'); + } + html += '

'; } html += '
'; @@ -669,11 +681,26 @@ import ServerConnections from '../ServerConnections'; elem.innerHTML = html; const itemsContainer = elem.querySelector('.itemsContainer'); - itemsContainer.fetchData = getNextUpFetchFn(apiClient.serverId(), userSettings); + itemsContainer.fetchData = getNextUpFetchFn(apiClient.serverId(), userSettings, rewatching); itemsContainer.getItemsHtml = getNextUpItemsHtmlFn(userSettings.useEpisodeImagesInNextUpAndResume()); itemsContainer.parentContainer = elem; } + function loadNextUp(elem, apiClient, userSettings) { + elem.classList.remove('verticalSection'); + + for (let i = 0; i <= 1; i++) { + const frag = document.createElement('div'); + frag.classList.add('verticalSection'); + frag.classList.add('hide'); + elem.appendChild(frag); + + // 0 pass is regular next up + // 1 pass is rewatching next up + renderNextUpSection(frag, apiClient, userSettings, i == 1); + } + } + function getLatestRecordingsFetchFn(serverId, activeRecordingsOnly) { return function () { const apiClient = ServerConnections.getApiClient(serverId); diff --git a/src/controllers/list.js b/src/controllers/list.js index c271cfa7a3..68cf09fe31 100644 --- a/src/controllers/list.js +++ b/src/controllers/list.js @@ -259,7 +259,8 @@ import { appRouter } from '../components/appRouter'; ImageTypeLimit: 1, EnableImageTypes: 'Primary,Backdrop,Thumb', EnableTotalRecordCount: false, - SortBy: sortBy + SortBy: sortBy, + Rewatching: params.rewatching })); } @@ -677,6 +678,9 @@ class ItemsView { } if (params.type === 'nextup') { + if (params.rewatching === 'true') { + return globalize.translate('NextUpRewatching'); + } return globalize.translate('NextUp'); } diff --git a/src/strings/en-us.json b/src/strings/en-us.json index 27a5784163..821f24e1f9 100644 --- a/src/strings/en-us.json +++ b/src/strings/en-us.json @@ -1126,6 +1126,7 @@ "NextChapter": "Next chapter", "NextTrack": "Skip to next", "NextUp": "Next Up", + "NextUpRewatching": "Rewatching", "No": "No", "NoCreatedLibraries": "Seems like you haven't created any libraries yet. {0}Would you like to create one now?{1}", "None": "None",