AiredEpisodeOrderComparer does not respect dates. #3133

Closed
opened 2026-02-06 22:51:45 +03:00 by OVERLORD · 0 comments
Owner

Originally created by @ankenyr on GitHub (Jul 6, 2021).

Describe the bug
AiredEpisodeOrderComparer.cs looks to not compare the air ordering but rather the Parent Index (Season Number) modified by the Index Number (Episode number)

This leads to it being basically the same as absolute order

System (please complete the following information):

  • OS: Windows
  • Virtualization: None - Developing
  • Clients: Browser, Curl
  • Browser: Chrome 91.0.4472.77 (Official Build) (64-bit) (cohort: Stable)
  • Jellyfin Version: 1.7.5
  • Playback: n/a
  • Installed Plugins: n/a
  • Reverse Proxy: n/a
  • Base URL: web/index.html#!/details?id=c29715f7fb1f55c8ea99d6f668007266&serverId=5ff7b1beaec741feb30c711dbc0d6ad8 - Networking: Host
  • Storage: local

To Reproduce

  1. Create a directory with a naming structure as follows
    Shows
    └── Series
    ├── YYYYMMDD-Title [ytid].mkv
  2. Create a library pointing at this directory
  3. Edit episodes to have episode number of 0

Expected behavior
It would be expected that since there is no Aired Date property that premier date would be respected. It however is not and you will notice that the ordering is not in the chronological order.

Server Logs
n/a

FFmpeg Logs
n/a

Browser Console Logs
n/a

Screenshots
n/a

Additional context
This was found during development of my Youtube plugin to add the following feature
https://github.com/ankenyr/jellyfin-youtube-metadata-plugin/issues/7

It seems that at one point PremiereDate was use but was commented out and it is unclear why this is. I believe uncommenting that line would solve the issue but it would likely break other things. What seems like a better fix would be changing the comparison on line 155 to do the premiere date compare rather than what it is doing now.

Let me know if this seems sane and I can work on a PR with tests.

Originally created by @ankenyr on GitHub (Jul 6, 2021). **Describe the bug** [AiredEpisodeOrderComparer.cs](https://github.com/jellyfin/jellyfin/blob/804614315819c8c17c576b2cdfb683177b59eb7a/Emby.Server.Implementations/Sorting/AiredEpisodeOrderComparer.cs#L155) looks to not compare the air ordering but rather the Parent Index (Season Number) modified by the Index Number (Episode number) This leads to it being basically the same as absolute order **System (please complete the following information):** - OS: Windows - Virtualization: None - Developing - Clients: Browser, Curl - Browser: Chrome 91.0.4472.77 (Official Build) (64-bit) (cohort: Stable) - Jellyfin Version: 1.7.5 - Playback: n/a - Installed Plugins: n/a - Reverse Proxy: n/a - Base URL: web/index.html#!/details?id=c29715f7fb1f55c8ea99d6f668007266&serverId=5ff7b1beaec741feb30c711dbc0d6ad8 - Networking: Host - Storage: local **To Reproduce** 1) Create a directory with a naming structure as follows Shows └── Series ├── YYYYMMDD-Title [ytid].mkv 2) Create a library pointing at this directory 3) Edit episodes to have episode number of 0 **Expected behavior** It would be expected that since there is no Aired Date property that premier date would be respected. It however is not and you will notice that the ordering is not in the chronological order. **Server Logs** n/a **FFmpeg Logs** n/a **Browser Console Logs** n/a **Screenshots** n/a **Additional context** This was found during development of my Youtube plugin to add the following feature https://github.com/ankenyr/jellyfin-youtube-metadata-plugin/issues/7 It seems that at one point PremiereDate was use but was [commented out](https://github.com/jellyfin/jellyfin/blame/726e116d5bb0038edfdaa7f1672fa22df499964b/Emby.Server.Implementations/Sorting/AiredEpisodeOrderComparer.cs#L37) and it is unclear why this is. I believe uncommenting that line would solve the issue but it would likely break other things. What seems like a better fix would be changing the [comparison on line 155](https://github.com/jellyfin/jellyfin/blame/726e116d5bb0038edfdaa7f1672fa22df499964b/Emby.Server.Implementations/Sorting/AiredEpisodeOrderComparer.cs#L155) to do the premiere date compare rather than what it is doing now. Let me know if this seems sane and I can work on a PR with tests.
OVERLORD added the bug label 2026-02-06 22:51:45 +03:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/jellyfin#3133