Repository navigation
fix(naming): recognise Saison, Serie, Seria, and ordinal season folders - #2333
Conversation
Season folders named Saison N, Serie N, Série N, Seria N, Séria N, or 1st/2nd/3rd/Nth Season were not recognised, so each became its own series named after the folder. Add the labels, allow an ordinal suffix in the number-first form, and accept the decomposed accent spelling macOS stores. Series, serie, and seria also begin show titles. A bare one in a folder directly in the library folder now names a season only when at most a year, provider tag, or release token follows the number, so a show folder like Series 7 Documentary is the show rather than season 7 of the library folder. Deeper folders, and names that start with the show title, keep the UK form Series 5 Matt Smith as season 5. An ordinal no longer pairs with the one-letter S label (21st S.W.A.T. Archive). Closes #2322 Co-Authored-By: Claude Opus 5.5 <[email protected]>
Silo Kody — review completeReview finished. Check the inline comments for findings and verify each suggestion against the code and tests. Reviewing changes in Silo
Review settingsReview OptionsThe following review options are enabled or disabled:
|
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 12 minutes. View limit details
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 |
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 7995ccf5e8
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
Series 7 (2019) - The Contenders directly in the library folder is a show; Series 2 HDR, DV, and REMUX are seasons. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Quick104
left a comment
There was a problem hiding this comment.
Adversarial review (gpt-6.1-sol, reviewed 7995ccf)
Three verified regressions. Each reproduction passes against main (50108f6) and fails against the reviewed head. The existing internal/naming suite and the localized label and NFD controls pass on the head. Findings cover the naming helpers and scanner assignments. All three also reproduce at the subsequent head 729edcc.
AI disclosure: Codex (gpt-6.1-sol) via T3 Code, adversarial review requested by the PR author's agent.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 729edcccaa
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| var ( | ||
| seasonDirectoryTokenRe = regexp.MustCompile(`(?i)(?:^|[ ._\-\[\]])(?:` + seasonDirectoryLabels + `)[ ._-]*(\d{1,4})(?:$|[ ._\-\[\]])`) | ||
| reversedSeasonDirectoryRe = regexp.MustCompile(`(?i)^(\d{1,4})[ ._-]+(?:` + seasonDirectoryLabels + `)(?:$|[ ._\-\[\]])`) | ||
| seasonDirectoryTokenRe = regexp.MustCompile(`(?i)(?:^|[ ._\-\[\]])(` + seasonDirectoryLabels + `)[ ._-]*(\d{1,4})(?:$|[ ._\-\[\]])`) |
There was a problem hiding this comment.
Apply the top-level guard when parsing root identity
When a top-level show name contains one of the newly added labels after other title text, such as /tv/La Serie 7 Documentary/E03.mkv, deriveSeriesRoot correctly retains the show folder, but parseSeriesFolderIdentity consumes this expanded regex directly without seasonDirectoryNumber's ambiguity guard. The path is consequently parsed as title La, season 7 rather than title La Serie 7 Documentary with an unknown season, causing metadata matching under the wrong identity. Route this root-identity check through the same guarded season parser before accepting the token.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Not changing this one. A show folder of the shape <title> <label> <number> <words> is ambiguous. La Serie 7 Documentary reads the same as a UK season pack used as the show folder, such as Sherlock Series 2 Complete or Doctor Who Series 5 Matt Smith, which main splits into title plus season. Guarding parseSeriesFolderIdentity would regress those, and an earlier review round flagged exactly that. La Series 7 Documentary already parses as La, season 7 on main, so this keeps the existing behavior for the new labels. Where the file name settles it, db54285 keeps the folder title whole: La Serie 7 Documentary/La Serie 7 Documentary S01E03.mkv is titled La Serie 7 Documentary. A bare E03.mkv gives no such evidence.
…firms The library-top guard for Series, Serie, and Seria now needs a configured library folder, and yields when the file name carries a different series title, so a library folder that is one show keeps its UK season folders. A file name that repeats the whole show folder name keeps a season label inside the title (La Série 2). Co-Authored-By: Claude Opus 5.5 <[email protected]>
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: db54285dbf
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| } | ||
| rest = rest[4:] | ||
| } | ||
| return startsWithMatch(episodeTechnicalRe, rest) || startsWithMatch(inferReleaseTokenRe, rest) |
There was a problem hiding this comment.
Validate the entire suffix after release tokens
For a direct child show named /tv/Series 7 1080p Documentary/Episode 03.mkv, startsWithMatch accepts the suffix merely because it begins with 1080p; the parser then treats the folder as season 7, roots the item at /tv, and loses the title. Fresh evidence after the earlier whole-suffix fix is that a technical token before descriptive text still bypasses it, so consume and validate the complete suffix rather than accepting any prefix match.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Not changing this one. Season release folders end in free text after their tokens, such as a release group (Series.2.1080p.BluRay.x264-GRP) or an edition word, so requiring every word after the number to be a known token would turn real season folders into shows. A technical token right after the number is strong evidence of a release folder; a show titled Series 7 1080p Documentary is not a realistic layout. This guard only applies to bare word labels directly in a configured library folder, so nested folders are unaffected.
…eason label Series 2 UHD, 4K, HDR10, and SDR read as season folders at the library top again. Co-Authored-By: Claude Opus 5.5 <[email protected]>
| func seasonLabelStandsAlone(label, rest string) bool { | ||
| if !wordSeasonDirectoryLabelRe.MatchString(label) { | ||
| return true | ||
| } |
There was a problem hiding this comment.
Season-folder detection in internal/naming/season.go rejects the previously recognized [Series 2] folder because the top-level suffix check treats its closing bracket as title text, causing ParseFilename("/tv/[Series 2]/Episode 03.mkv", "series", "/tv") to lose season 2 and use [Series 2] as the series title. Allow the closing bracket delimiter when normalizing the suffix.
rest = strings.TrimLeft(stripFolderTags(rest), " ._-]")Prompt for LLM
File internal/naming/season.go:
Line 36:
Season-folder detection in internal/naming/season.go rejects the previously recognized `[Series 2]` folder because the top-level suffix check treats its closing bracket as title text, causing `ParseFilename("/tv/[Series 2]/Episode 03.mkv", "series", "/tv")` to lose season 2 and use `[Series 2]` as the series title. Allow the closing bracket delimiter when normalizing the suffix.
Suggested Code:
rest = strings.TrimLeft(stripFolderTags(rest), " ._-]")
Talk to Kody by mentioning @kody
Was this suggestion helpful? React with 👍 or 👎 to help Kody learn from this interaction.
There was a problem hiding this comment.
Checked on f979067: this already works. seasonLabelStandsAlone trims ] along with the other delimiters (" ._-[](){}"), so the rest after the number is empty. ParseFilename("/tv/[Series 2]/Episode 03.mkv", "series", "/tv") returns season 2 (known), rooted at /tv. No change needed.
There was a problem hiding this comment.
You’re right—this suggestion is a false positive on f97906707. seasonLabelStandsAlone already trims ] through "._-[](){}", so the proposed change is redundant.
Your reported parse result confirms that [Series 2] retains season 2 (known) and the /tv root. No code change is needed.
| rest = stripFolderTags(rest) | ||
| for { | ||
| rest = strings.TrimLeft(rest, " ._-[](){}") | ||
| if rest == "" { | ||
| return true |
There was a problem hiding this comment.
Incorrect season detection in internal/naming/season.go occurs because top-level disambiguation accepts a year or release token at the start of the suffix without validating the remaining title text, causing /tv/Serie 2 (2019) Documentary/Episode 03.mkv to become season 2 rooted at /tv with no series title instead of retaining its show folder. Require the complete suffix to consist of recognized metadata before accepting an ambiguous label.
Prompt for LLM
File internal/naming/season.go:
Line 37 to 41:
Incorrect season detection in internal/naming/season.go occurs because top-level disambiguation accepts a year or release token at the start of the suffix without validating the remaining title text, causing `/tv/Serie 2 (2019) Documentary/Episode 03.mkv` to become season 2 rooted at `/tv` with no series title instead of retaining its show folder. Require the complete suffix to consist of recognized metadata before accepting an ambiguous label.
Talk to Kody by mentioning @kody
Was this suggestion helpful? React with 👍 or 👎 to help Kody learn from this interaction.
There was a problem hiding this comment.
Checked on f979067: this already works. After stripping the year, the loop requires the remaining text to start with a release token, and Documentary does not, so the label does not stand alone. /tv/Serie 2 (2019) Documentary/Episode 03.mkv keeps /tv/Serie 2 (2019) Documentary as its root with no season; 729edcc added this check. Series 2 (2019) with nothing after the year is still season 2 (season_test.go). No change needed.
There was a problem hiding this comment.
Thanks for checking. Based on your verification of f97906707, my suggestion is outdated: after consuming the year, the loop still validates the remaining suffix and rejects Documentary as metadata.
That preserves /tv/Serie 2 (2019) Documentary as the series root without inferring a season, while Series 2 (2019) remains season 2.
No code change is needed for this finding; 729edccca already addresses it.
Resolve conflicts with Silo-Server#2333, which reworked season folder recognition. The bare season check now takes the file stem that main threads through detectSeasonStructure and deriveSeriesRoot instead of a separate parsed title, and the bare labels come from the shared label list, so a bare Saison folder and the decomposed Säsong and Sezóna spellings count too. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Problem
Closes #2322
Related issue: N/A
Validation tasks: none
Silo doesn't recognise season folders named
Saison 1,Serie 1,Série 1,Seria 1,Séria 1, or1st Season. It treats each one as the show, so every season becomes its own series named after the folder ("Saison 1", "2nd Season"), metadata providers can't match it, and episodes in1st Season/Episode 01.mkvlose their season number. This affects French, Spanish, Portuguese, Italian, Polish, Czech, and Slovak libraries, and anime libraries that use ordinal season folders.A related false positive: a show folder directly in the library folder named like
Series 7 Documentaryis read as season 7, so the library folder becomes the series root and the files get no series title.Approach
All season-folder checks in
internal/naming(series roots, season structure, episode parsing, misplaced-series detection, show-folder identity) go throughseasonDirectoryNumberand the label list inseason.go, so the change is made there and every caller agrees.saison,serie/série, andseria/séria, and allows an ordinal suffix in the number-first form (1st Season,3rd Saison). Accented labels also match the decomposed spelling macOS stores (eplus a combining accent). An ordinal no longer pairs with the one-letterSlabel, so21st S.W.A.T. Archiveis not season 21.Series,Serie, andSeriaalso begin show titles. A bare one in a folder directly in the library folder now names a season only when at most a year, provider tag, or release token follows the number (Series 2 (2019),Series.2.1080p.BluRay).Series 7 DocumentaryandSeries 7 - The Contendersthere are shows. Deeper folders, and names that start with the show title, keep the UK formSeries 5 Matt Smithas season 5, as on main.Serie AandSeriawere never seasons, since a label needs a number.seasonDirectoryNumbergains atopLevelargument. Each caller passes it only when the folder sits directly in a configured library folder (where numeric-only season folders such as01are already refused) and the file name doesn't carry a different series title. A file name that repeats the whole show folder name keeps a season label inside the title (La Série 2, which also fixesLa Series 2on main).A nested category layout such as
Documentales/Serie 2 Temporada Completa/now reads as season 2 ofDocumentales, the same waySeries 2 …already does on main. Keeping nested word labels as seasons is what keeps the UKSeries Nform working.docs/architecture/media-naming.mdrecords the rule.Validation
internal/namingtests cover the labels, ordinals, decomposed accents, the library-top guard, and the nested and title-prefixed UK forms. They fail on main and pass here, and they check that path parsing, root inference, and misplaced-series detection agree.internal/naming,scanner,metadata,libraryingest,librarykind, andjellycompattests pass.make lint-changedreports 0 issues.Saison N,1st Season,Seria 2, andSérie 3folder became its own series titled after the folder, andSeries 7 Documentaryfiles were rooted at the library folder with season 7. On a build of this branch, a fresh scan of the same layout puts every file under its show folder with the right season, keeps nestedSeries 5 Matt Smithas season 5, and treatsSeries 7 Documentary,Series 7 - The Contenders, and21st S.W.A.T. Archiveas shows.Evidence
Surface: web app library page, isolated dev sandbox, main 729abf2 (before) and this branch (after).
Evidence: https://evidence.siloserver.org/r/silo-server/issue-2322/
Risks
Episode 03.mkvinsideSeries 5 Matt Smithreads likeSeries 7 Documentary/Episode 03.mkvin a multi-show library, so it is treated as the show. Files whose names carry the show title (Doctor Who S05E03.mkv) keep season 5.Saison 2 …,Serie 2 …, or1st Season …followed by a year or release tags only is now a season folder, so its parent (the library folder) becomes the series root. The same already holds forSeason 2 ….Checklist
Follow-ups: User manual: Silo-Server/siloserver.org#179, draft docs PR Silo-Server/siloserver.org#180. Draft (not filed): libraries scanned before this change keep a split series after rescan, because relinking only claims unlinked files.
AI Disclosure
Doctor Who Series 5 Matt Smith), still accepted dash- and bracket-suffixed titles, and let an ordinal pair with theSlabel; all three are fixed and tested. Background adversarial review (gpt-6.1-sol, reviewed 7995ccf) found three regressions: single-show library folders lost UK season folders, the guard applied without a configured root, and titles such asLa Série 2were truncated. All three are fixed in db54285 with tests. Codex code review found two suffix gaps (a title after a year, and HDR/DV/REMUX tokens), fixed in 729edcc.🤖 Generated with Claude Code