Nextup episodes api call missing first episode of the show #6834

Closed
opened 2026-02-07 04:10:47 +03:00 by OVERLORD · 2 comments
Owner

Originally created by @hagaygo on GitHub (Mar 18, 2025).

Description of the bug

When calling /Shows/NextUp API call the result sometimes misses "in progress" episodes when they are the first episodes of the show.

Reproduction steps

1.Make sure to have at least two shows in your library (I'll call them X and Y)
2.Mark first episode of show X as watched.
3.Verify it is shown on NextUp API call.
4.Partially watch first episode of show Y.
5.Check NextUp result it should show both episodes of each show , the episode of show Y should be first.
6.Now fully play the next episode of show X
7. Requery NextUp API again and you'll we see only show X next episode and partially played episode of show Y is not shown at all.

What is the current bug behavior?

Not fully watched episode (first of the show) are not shown on some cases.

What is the expected correct behavior?

Partially played episodes should always be shown on NextUp API call.

I looked into the code and found the problem.

TVSeriesManager.cs

var anyFound = false;

return allNextUp
    .Where(i =>
    {
        if (request.DisableFirstEpisode)
        {
            return i.LastWatchedDate != DateTime.MinValue;
        }

        if (alwaysEnableFirstEpisode || (i.LastWatchedDate != DateTime.MinValue && i.LastWatchedDate.Date >= request.NextUpDateCutoff))
        {
            anyFound = true;
            return true;
        }

        return !anyFound && i.LastWatchedDate == DateTime.MinValue;
    })
    .Select(i => i.GetEpisodeFunction())
    .Where(i => i is not null)!;

There is some logic here that we don't want to see first episodes of a show. (since first episode's show don't have value in LastWatchedDate it ignores him)
If a fully playback episode is the first on the list the anyFound is true and no first episode is shown next.
If our partially played episode is the first on the list , anyFound is still false and it will be returned.

I am not sure how to fix this since we don't yet have the playback position filled up and fill all the items on the list seems overkill. (if we hade the playback runtime ticks value we could not filter out the episode)

Any fix/help will be appreciated.

Jellyfin Server version

10.10.0+

Specify commit id

No response

Specify unstable release number

No response

Specify version number

No response

Specify the build version

10.10.6

Environment

- OS: Windows , Linux
- Clients: WEB and JellyCon

Jellyfin logs

not required

FFmpeg logs


Client / Browser logs

No response

Relevant screenshots or videos

No response

Additional information

No response

Originally created by @hagaygo on GitHub (Mar 18, 2025). ### Description of the bug When calling /Shows/NextUp API call the result sometimes misses "in progress" episodes when they are the first episodes of the show. ### Reproduction steps 1.Make sure to have at least two shows in your library (I'll call them X and Y) 2.Mark first episode of show X as watched. 3.Verify it is shown on NextUp API call. 4.Partially watch first episode of show Y. 5.Check NextUp result it should show both episodes of each show , the episode of show Y should be first. 6.Now fully play the next episode of show X 7. Requery NextUp API again and you'll we see only show X next episode and partially played episode of show Y is not shown at all. ### What is the current _bug_ behavior? Not fully watched episode (first of the show) are not shown on some cases. ### What is the expected _correct_ behavior? Partially played episodes should always be shown on NextUp API call. I looked into the code and found the problem. TVSeriesManager.cs ```` var anyFound = false; return allNextUp .Where(i => { if (request.DisableFirstEpisode) { return i.LastWatchedDate != DateTime.MinValue; } if (alwaysEnableFirstEpisode || (i.LastWatchedDate != DateTime.MinValue && i.LastWatchedDate.Date >= request.NextUpDateCutoff)) { anyFound = true; return true; } return !anyFound && i.LastWatchedDate == DateTime.MinValue; }) .Select(i => i.GetEpisodeFunction()) .Where(i => i is not null)!; ```` There is some logic here that we don't want to see first episodes of a show. (since first episode's show don't have value in LastWatchedDate it ignores him) If a fully playback episode is the first on the list the anyFound is true and no first episode is shown next. If our partially played episode is the first on the list , anyFound is still false and it will be returned. I am not sure how to fix this since we don't yet have the playback position filled up and fill all the items on the list seems overkill. (if we hade the playback runtime ticks value we could not filter out the episode) Any fix/help will be appreciated. ### Jellyfin Server version 10.10.0+ ### Specify commit id _No response_ ### Specify unstable release number _No response_ ### Specify version number _No response_ ### Specify the build version 10.10.6 ### Environment ```markdown - OS: Windows , Linux - Clients: WEB and JellyCon ``` ### Jellyfin logs ```shell not required ``` ### FFmpeg logs ```shell ``` ### Client / Browser logs _No response_ ### Relevant screenshots or videos _No response_ ### Additional information _No response_
OVERLORD added the bug label 2026-02-07 04:10:47 +03:00
Author
Owner

@theguymadmax commented on GitHub (Mar 18, 2025):

This part of the code is being rewritten in PR #13687. Feel free to test it and see if the issue persists.

@theguymadmax commented on GitHub (Mar 18, 2025): This part of the code is being rewritten in PR #13687. Feel free to test it and see if the issue persists.
Author
Owner

@hagaygo commented on GitHub (Mar 18, 2025):

Seems the PR fixes this issue I'll close this this issue now and follow the PR

@hagaygo commented on GitHub (Mar 18, 2025): Seems the PR fixes this issue I'll close this this issue now and follow the PR
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/jellyfin#6834