title_parser: preserve dots, inner hyphens, roman numerals, acronyms - #643
Open
molnara wants to merge 1 commit into
Open
title_parser: preserve dots, inner hyphens, roman numerals, acronyms#643molnara wants to merge 1 commit into
molnara wants to merge 1 commit into
Conversation
Owner
|
Starting review today. |
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.
Problem
TitleParser.parse_titlecallsPath(filename).stem, which splits at the last dot regardless of what follows. Callers incatalog_entry.py:21andmedia_processor.py:112already strip the extension viaos.path.splitext, soparse_titlereceives a bare stem and strips a second time — consuming real title text.The same show renders inconsistently within a single schedule depending on which call path reached it. Custom
title_patternscan't work around this — the user pattern capturesG.I. Joecorrectly and the damage happens downstream, in the cleanup applied to the matched group.Four related issues in that same cleanup, all from the assumption that filenames are scene-style dot-delimited:
C.O.P.S - E60 ...C O PC.O.P.SHe-Man and the Masters of the Universe - S02E32.mkvHe Man And The Masters...He-Man And The Masters...The Godfather - Part III (1990).mp4The Godfather Part IiiThe Godfather Part IIIUFC 12 Judgement Day.mp4Ufc 12 Judgement DayUFC 12 Judgement Dayre.sub(r"[._-]", " ", title)flattens acronym dots and compound-name hyphens;str.capitalize()lowercases everything after the first character, which destroys both Roman numerals and all-caps show names.Approach
-separators are unaffected.MID,DILL,CIVILstay title-cased).KEEP_UPPERpreserves case for a small set of known acronyms. Happy to make this config-driven viamain_config.jsonif an opinionated default isn't wanted —StationManageralready loads arbitrary keys.default_patternsis byte-identical to before; the diff is confined to the cleanup path.Verification
Tested against a ~2,400 file library. Selected cases with custom patterns loaded:
The last two confirm no regression on titles without punctuation.
This fix was created using Claude model Opus 5, so up to you if you want this change. It's been working well for me so far.