Skip to content

Commit

Permalink
Made the series play button play the next episode
Browse files Browse the repository at this point in the history
  • Loading branch information
beef331 committed Oct 6, 2023
1 parent 3c443e2 commit 031445a
Showing 1 changed file with 28 additions and 0 deletions.
28 changes: 28 additions & 0 deletions src/components/playback/playbackmanager.js
Original file line number Diff line number Diff line change
Expand Up @@ -1848,6 +1848,34 @@ class PlaybackManager {
SortBy: options.shuffle ? 'Random' : 'SortName',
MediaTypes: 'Audio'
});
} else if (firstItem.Type === 'Series' || firstItem.Type === 'Season') {
const apiClient = ServerConnections.getApiClient(firstItem.ServerId);
promise = apiClient.getEpisodes(firstItem.SeriesId || firstItem.Id, {
IsVirtualUnaired: false,
IsMissing: false,
UserId: apiClient.getCurrentUserId(),
Fields: 'Chapters'
}).then(function (episodesResult) {
let foundItem = false;
const isSeries = firstItem.Type === 'Series'
episodesResult.Items = episodesResult.Items.filter(function (e) {
if (foundItem) {
return true;
}
if (!e.UserData.Played && (isSeries || e.SeasonId == firstItem.Id)) {
foundItem = true;
return true;
}

return false;
});

if (episodesResult.Items.length === 0) {
// TODO: Reset Watch Status and add all
}
episodesResult.TotalRecordCount = episodesResult.Items.length;
return episodesResult;
});
} else if (firstItem.IsFolder && firstItem.CollectionType === 'homevideos') {
promise = getItemsForPlayback(serverId, mergePlaybackQueries({
ParentId: firstItem.Id,
Expand Down

0 comments on commit 031445a

Please sign in to comment.