Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: playback of series with large set of episodes #5786

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 11 additions & 4 deletions src/components/playback/playbackmanager.js
Original file line number Diff line number Diff line change
Expand Up @@ -1965,10 +1965,14 @@ export class PlaybackManager {
const apiClient = ServerConnections.getApiClient(firstItem.ServerId);
const startSeasonId = firstItem.Type === 'Season' ? items[options.startIndex || 0].Id : undefined;

const seasonId = (startSeasonId && items.length === 1) ? startSeasonId : undefined;

const episodesResult = await apiClient.getEpisodes(firstItem.SeriesId || firstItem.Id, {
IsVirtualUnaired: false,
IsMissing: false,
SeasonId: (startSeasonId && items.length === 1) ? startSeasonId : undefined,
SeasonId: seasonId,
// default to first 100 episodes if no season was specified to avoid loading too large payloads
limit: seasonId ? undefined : 100,
SortBy: options.shuffle ? 'Random' : undefined,
UserId: apiClient.getCurrentUserId(),
Fields: ['Chapters', 'Trickplay']
Expand Down Expand Up @@ -2017,16 +2021,19 @@ export class PlaybackManager {
return new Promise(function (resolve, reject) {
const apiClient = ServerConnections.getApiClient(firstItem.ServerId);

if (!firstItem.SeriesId) {
const { SeriesId, SeasonId } = firstItem;
if (!SeriesId) {
resolve(null);
return;
}

apiClient.getEpisodes(firstItem.SeriesId, {
apiClient.getEpisodes(SeriesId, {
IsVirtualUnaired: false,
IsMissing: false,
UserId: apiClient.getCurrentUserId(),
Fields: ['Chapters', 'Trickplay']
Fields: ['Chapters', 'Trickplay'],
// limit loading episodes of the current season to avoid loading too large payload
SeasonId
}).then(function (episodesResult) {
resolve(filterEpisodes(episodesResult, firstItem, options));
}, reject);
Expand Down
Loading