fix: make both RemoveLessSpecificSeasonEpisode passes execute (#961) - #962
Open
opensubtitles wants to merge 1 commit into
Open
fix: make both RemoveLessSpecificSeasonEpisode passes execute (#961)#962opensubtitles wants to merge 1 commit into
opensubtitles wants to merge 1 commit into
Conversation
Rule.__eq__/__hash__ in rebulk compare by class only, so when rebulk objects
are merged via extend_safe the second RemoveLessSpecificSeasonEpisode
instance is silently dropped: only the ("season") pass ever ran, and the
("episode") pass was dead code.
Split the registration into two distinct subclasses (RemoveLessSpecificSeason
/ RemoveLessSpecificEpisode) so both passes survive registration, and guard
the rule to act only when one filepart is strictly more SxxExx-specific than
the others. Equally-specific fileparts ("S06E01.E10" pack directory vs
"S06E09" file) are left to the generic RemoveAmbiguous, whose full-property
weight and rightmost preference already pick the correct side.
Fixes guessit-io#961
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #961.
Problem
processors.pyregisters the same rule class twice:but rebulk's
Rule.__eq__/__hash__compare by class only, so when rebulk objects are merged (extend_safeineffective_rules()) the second instance is silently dropped. Only the("season")pass has ever executed; the("episode")pass is dead code. Verifiable on 4.4.0:Fix
RemoveLessSpecificSeasonandRemoveLessSpecificEpisode, so both passes survive dedup.The.Good.Wife.S06E01.E10.…/The.Good.Wife.S06E09.….mkv— the pack directory's[1, 10]overrode the file's episode 9), so the rule now acts only when one filepart is strictly more SxxExx-specific than the others; equally-specific fileparts fall through to the genericRemoveAmbiguous, whose full-property weight and rightmost preference already pick the correct side.Same fix shipped in guessit-js (TypeScript port tracking this corpus) where we originally hit the trap.
Tests
Full suite: 2520 passed, 4 skipped (was 1 failure with the naive two-subclass fix, 0 with the specificity guard).