Skip to content

feat: missing_episode rules#2386

Merged
ydkmlt84 merged 5 commits into
Maintainerr:mainfrom
speatzle:missing-episodes
Mar 9, 2026
Merged

feat: missing_episode rules#2386
ydkmlt84 merged 5 commits into
Maintainerr:mainfrom
speatzle:missing-episodes

Conversation

@speatzle

Copy link
Copy Markdown
Contributor

Description & Design

Build based on #2200 Addressing review comment:

I think this naming is a bit ambiguous. If targeting seasons, I'm unsure if this is a missing count for the season, or the whole show from the name alone. It's likely useful to have both of those, and all 3 for episodes. Perhaps split this up into 3 different rules, which means they can have a more appropriate name each?
Some of our existing rules mix logic like this and it does confuse people.

This PR Introduces 3 new Rules:

  • Number of missing Episodes in Media Type (if Episode then 1 or 0)
  • Number of missing Episodes in Season
  • Number of missing Episodes in Show

Any Naming suggestions?

This PR Currently targets the jellyfin-dev branch since it is based on top of it. Will rebase to main once jellyfin-dev is merged.

The Three Rules allow Checking how any Missing Episodes a Show/Season/Episode has.

Works by checking hasFile for Episodes. In all other cases it subtracts episodeFileCount from episodeCount to calculate the count for the Season or the Entire show.

Checklist

  • I have read the CONTRIBUTING.md document.
  • I understand the code I am submitting and can explain how it works
  • I have performed a self-review of my code
  • I have linted and formatted my code
  • My changes generate no new warnings
  • New and existing unit tests pass locally with my changes

How to test

  1. Install the branch
  2. Use the new rule

I have done basic testing. But more testing is appreciated.

Additional context

Based on #2200

@speatzle speatzle requested a review from ydkmlt84 as a code owner February 18, 2026 21:27
@speatzle speatzle marked this pull request as draft February 18, 2026 21:28
@speatzle speatzle changed the title WIP: feat: missing_episode rules feat: missing_episode rules Feb 18, 2026
@speatzle speatzle changed the base branch from jellyfin-dev to main March 2, 2026 18:55
- Fix inverted episode-level logic: return 0 when file exists, 1 when
  missing
- Fix showType on missing_episodes_show: available at all levels
  (show/season/episode), not just episode
- Fix code style: replace Yoda conditions and loose equality (==) with
  strict equality (===)
- Improve humanNames: lowercase, remove technical jargon
- DRY: deduplicate season/show statistics calculation in
  missing_episodes case
@enoch85 enoch85 marked this pull request as ready for review March 2, 2026 20:06
@Maintainerr Maintainerr deleted a comment from github-actions Bot Mar 2, 2026
@enoch85

enoch85 commented Mar 2, 2026

Copy link
Copy Markdown
Collaborator

My changes:

  • Inverted logic: hasFile ? 1 : 0 → hasFile ? 0 : 1 (1 = missing, 0 = present)
  • showType scoping: missing_episodes_show expanded from ['episode'] to ['show', 'season', 'episode']
  • Code style: Yoda conditions and == replaced with idiomatic ===
  • humanNames: Cleaned up — removed "Media Type (if Episode then 1 or 0)" jargon
  • DRY: Deduplicated the season/show stats calculation in the missing_episodes case

@enoch85

enoch85 commented Mar 2, 2026

Copy link
Copy Markdown
Collaborator

@ydkmlt84 LGTM. 👍

@ydkmlt84

ydkmlt84 commented Mar 9, 2026

Copy link
Copy Markdown
Collaborator

I removed the missing episodes stand-alone rule as it doesn't make sense.

See here:
https://discord.com/channels/1152219249549512724/1432714525097984133/1480428631171010560

@ydkmlt84 ydkmlt84 merged commit e4dae87 into Maintainerr:main Mar 9, 2026
9 checks passed
enoch85 added a commit that referenced this pull request Mar 9, 2026
…, #2442, #2406, #2386, #2370

PR #2466 - fix: honor Jellyfin played threshold
- Respect configured played percentage threshold for Jellyfin watch status

PR #2461 - feat(rules): add ARR disk target path selection for disk space rules
- Allow selecting specific disk target paths for Radarr/Sonarr disk space rules

PR #2458 - feat: clean up empty ended shows in Sonarr after season actions
- Automatically remove ended shows from Sonarr when all seasons are processed

PR #2453 - fix: improve Plex viewCount reliability and add isWatched boolean
- Use native Plex viewCount field with watch history fallback
- Add new isWatched boolean rule property

PR #2452 - build(deps): bump actions/download-artifact from 7 to 8

PR #2451 - build(deps): bump actions/upload-artifact from 6 to 7

PR #2442 - fix(server): reject null/undefined in numeric rule comparisons
- Add getComparisonResult wrapper that fails closed on null/undefined operands
- Strict type checking for BIGGER/SMALLER comparisons

PR #2406 - Metadata provider abstraction layer with TVDB support
- Add MetadataService as central metadata resolution layer
- TVDB support as alternative metadata provider
- Dynamic provider preference with fallback
- Replace TmdbIdService with unified MetadataService

PR #2386 - feat: missing_episode rules
- Add missing episode count as a rule property for Sonarr

PR #2370 - build(deps-dev): bump the eslint group with 2 updates

enoch85 commented Mar 9, 2026

Copy link
Copy Markdown
Collaborator

This is now included in the jellyfin-dev docker container - among some other fixes. To upgrade, change tag in docker from latest (or whatever you have) to jellyfin-dev. Then do:

docker compose pull jellyfin-dev && docker compose up -d

You can check the latest commits here: https://github.com/Maintainerr/Maintainerr/commits/jellyfin-dev

  1. Consider the jellyfin-dev branch to be early development, and make a backup before switching to that branch!
  2. Please test that your issue is fixed
  3. Report back here, and tag me and @ydkmlt84

Thank you very much! 🚀

@github-actions

Copy link
Copy Markdown
Contributor

🎉 This PR is included in version 3.1.0 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants