feat: track episode availability from media servers scanners - #3402
feat: track episode availability from media servers scanners#34020xSysR3ll wants to merge 1 commit into
Conversation
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Team Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
b686913 to
31c93b5
Compare
This comment has been minimized.
This comment has been minimized.
5d9fd87 to
5d061b0
Compare
|
This pull request has merge conflicts. Please resolve the conflicts so the PR can be successfully reviewed and merged. |
5d061b0 to
6e41f8f
Compare
6e41f8f to
fcdb7aa
Compare
fcdb7aa to
737842d
Compare
|
This pull request has merge conflicts. Please resolve the conflicts so the PR can be successfully reviewed and merged. |
fallenbagel
left a comment
There was a problem hiding this comment.
Two changes in here aren't about episode badges. The Jellyfin cache key fix should go straight to develop on its own as it's fixing a bug live today. The Plex 4K detection switch should either come out or land as its own PR covering the movie path too, since right now the file is half on videoResolution and half on width and there is no explanation as to why. The Jellyfin season-existence change is fine but keys off enable4kShow rather than the tracking setting, so it needs a gate or this will change behaviour for people who do not use this setting. The worst blocker is the per-source demotion since, as written, each source deletes what it can't see and the sources disagree.
| } else { | ||
| const episodes = await this.jellyfinClient.getEpisodes( | ||
| seriesId, | ||
| seasonMeta.Id, | ||
| { includeMediaInfo: true } | ||
| ); |
There was a problem hiding this comment.
This runs for every 4K instance whether or not episode tracking is on. The branch splits on enable4kShow, not shouldTrackEpisodes, so the 4K pass stops treating a season as present just because episodes exist and starts requiring a stream over 2000 wide. That's the right behavior and it lines up with what the scanner already does, but it changes 4K season removal for anyone with a 4K Sonarr configured whether or not they turned tracking on. Gate it on shouldTrackEpisodes and let the existing behavior stand for everyone else.
| for (const episode of episodes) { | ||
| const versions = episode.Media ?? []; | ||
| const hasStandard = this.enable4kShow | ||
| ? versions.some((media) => media.videoResolution !== '4k') | ||
| : versions.length > 0; | ||
| const has4k = | ||
| this.enable4kShow && | ||
| versions.some((media) => media.videoResolution === '4k'); | ||
|
|
||
| if (hasStandard) { | ||
| totalStandard += 1; | ||
| } | ||
| if (has4k) { | ||
| total4k += 1; | ||
| } |
There was a problem hiding this comment.
With 4K off, an episode Plex returns without a Media array which used to count toward totalStandard and now doesn't. Probably fine since it is typed non-pption but hasStandard = this.enable4kShow ? versions.some(...) : true keeps the count identical and the ?? [] still does its job in the 4K branch.
| const episodeDetails: ProcessableEpisode[] | undefined = settings.main | ||
| .enableEpisodeAvailability | ||
| ? [] | ||
| : undefined; |
There was a problem hiding this comment.
I think we need to make this very clear. Either in settings or settings that leads to docs or whatever, Plex agents are per-library, so an install with one TMDB-agent library and one TVDB-agent library can't satisfy the provider-matching requirement for both. Same with jellyfin
| if (existingEpisode) { | ||
| if (episodeDetail.hasFile) { | ||
| existingEpisode[is4k ? 'status4k' : 'status'] = | ||
| MediaStatus.AVAILABLE; | ||
| toSave.push(existingEpisode); | ||
| } | ||
| if (this.enable4kShow && episodeDetail.hasFile4k) { | ||
| existingEpisode.status4k = MediaStatus.AVAILABLE; | ||
| toSave.push(existingEpisode); | ||
| } |
There was a problem hiding this comment.
Same entity gets pushed twice when both flags are set.
737842d to
1773b28
Compare
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
1773b28 to
a4fbb6a
Compare
a4fbb6a to
0ab8476
Compare
Yep, since I already had the fixes I wanted to include them directly here but I'll revert and keep that for another PR then. |
0ab8476 to
56b276e
Compare
56b276e to
25fa072
Compare
We can merge those before this stack so they will get added here anyways. Like the cache one is a live bug already present in develop so |
25fa072 to
d8201b7
Compare
Description
Part 3 of #1671, stacked on #3355.
Wires episode availability into the media server scanners so media-server-only users get per-episode badges without Sonarr.
Episode numbers come from the library agent, so Seerr's metadata provider must match that agent (TMDB or TVDB).
Sonarr tracking stays TVDB-only.
How Has This Been Tested?
Only unit tests for now.
Screenshots / Logs (if applicable)
Checklist:
pnpm buildpnpm i18n:extract