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

Fix incorrect flag check preventing expected behavior when navigating to next episode

This commit is contained in:
Connor Smith 2024-04-20 01:41:23 -04:00
parent b38ac26fcf
commit 13dfa62eb4

View file

@ -18,6 +18,7 @@ import { PluginType } from '../../types/plugin.ts';
import { includesAny } from '../../utils/container.ts'; import { includesAny } from '../../utils/container.ts';
import { getItems } from '../../utils/jellyfin-apiclient/getItems.ts'; import { getItems } from '../../utils/jellyfin-apiclient/getItems.ts';
import { getItemBackdropImageUrl } from '../../utils/jellyfin-apiclient/backdropImage'; import { getItemBackdropImageUrl } from '../../utils/jellyfin-apiclient/backdropImage';
import { MediaType } from '@jellyfin/sdk/lib/generated-client/models/media-type';
import { MediaError } from 'types/mediaError'; import { MediaError } from 'types/mediaError';
import { getMediaError } from 'utils/mediaError'; import { getMediaError } from 'utils/mediaError';
@ -1934,34 +1935,32 @@ class PlaybackManager {
promise = new Promise(function (resolve, reject) { promise = new Promise(function (resolve, reject) {
const apiClient = ServerConnections.getApiClient(firstItem.ServerId); const apiClient = ServerConnections.getApiClient(firstItem.ServerId);
apiClient.getCurrentUser().then(function (user) { if (!firstItem.SeriesId) {
if (!user.Configuration.EnableNextEpisodeAutoPlay || !firstItem.SeriesId) { resolve(null);
resolve(null); return;
return; }
}
apiClient.getEpisodes(firstItem.SeriesId, { apiClient.getEpisodes(firstItem.SeriesId, {
IsVirtualUnaired: false, IsVirtualUnaired: false,
IsMissing: false, IsMissing: false,
UserId: apiClient.getCurrentUserId(), UserId: apiClient.getCurrentUserId(),
Fields: ['Chapters', 'Trickplay'] Fields: ['Chapters', 'Trickplay']
}).then(function (episodesResult) { }).then(function (episodesResult) {
let foundItem = false; let foundItem = false;
episodesResult.Items = episodesResult.Items.filter(function (e) { episodesResult.Items = episodesResult.Items.filter(function (e) {
if (foundItem) { if (foundItem) {
return true; return true;
} }
if (e.Id === firstItem.Id) { if (e.Id === firstItem.Id) {
foundItem = true; foundItem = true;
return true; return true;
} }
return false; return false;
}); });
episodesResult.TotalRecordCount = episodesResult.Items.length; episodesResult.TotalRecordCount = episodesResult.Items.length;
resolve(episodesResult); resolve(episodesResult);
}, reject); }, reject);
});
}); });
} }
@ -3313,7 +3312,13 @@ class PlaybackManager {
if (errorOccurred) { if (errorOccurred) {
showPlaybackInfoErrorMessage(self, 'PlaybackError' + displayErrorCode); showPlaybackInfoErrorMessage(self, 'PlaybackError' + displayErrorCode);
} else if (nextItem) { } else if (nextItem) {
self.nextTrack(); const apiClient = ServerConnections.getApiClient(nextItem.item.ServerId);
apiClient.getCurrentUser().then(function (user) {
if (user.Configuration.EnableNextEpisodeAutoPlay || nextMediaType !== MediaType.Video) {
self.nextTrack();
}
});
} }
} }