Skip to content

fix(naming): recognise Saison, Serie, Seria, and ordinal season folders - #2333

Merged
Quick104 merged 4 commits into
mainfrom
fix/issue-2322-season-folder-labels
Oct 12, 2026
Merged

Quick104 merged 4 commits into
mainfrom
fix/issue-2322-season-folder-labels

Conversation

@Quick104

@Quick104 Quick104 commented Oct 12, 2026 •

Copy link
Copy Markdown
Contributor

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, or 1st 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 in 1st Season/Episode 01.mkv lose 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 Documentary is 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 through seasonDirectoryNumber and the label list in season.go, so the change is made there and every caller agrees.

  • Adds saison, serie/série, and seria/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 (e plus a combining accent). An ordinal no longer pairs with the one-letter S label, so 21st S.W.A.T. Archive is not season 21.
  • 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 (Series 2 (2019), Series.2.1080p.BluRay). Series 7 Documentary and Series 7 - The Contenders there are shows. Deeper folders, and names that start with the show title, keep the UK form Series 5 Matt Smith as season 5, as on main. Serie A and Seria were never seasons, since a label needs a number.
  • seasonDirectoryNumber gains a topLevel argument. Each caller passes it only when the folder sits directly in a configured library folder (where numeric-only season folders such as 01 are 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 fixes La Series 2 on main).

A nested category layout such as Documentales/Serie 2 Temporada Completa/ now reads as season 2 of Documentales, the same way Series 2 … already does on main. Keeping nested word labels as seasons is what keeps the UK Series N form working.

docs/architecture/media-naming.md records the rule.

Validation

  • New internal/naming tests 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, and jellycompat tests pass. make lint-changed reports 0 issues.
  • Reproduced on an isolated dev sandbox on main: each Saison N, 1st Season, Seria 2, and Série 3 folder became its own series titled after the folder, and Series 7 Documentary files 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 nested Series 5 Matt Smith as season 5, and treats Series 7 Documentary, Series 7 - The Contenders, and 21st S.W.A.T. Archive as shows.
  • Upgrade path: a library scanned on main with real show names, then rescanned on this branch, partly heals. One leftover item per show re-matched to the real show and the other kept its file; a full metadata refresh did not merge it. Relinking only claims unlinked files, so this is existing behaviour, not something this change introduces.

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

  • Libraries scanned before this change keep their split series after a rescan (see Validation). Fixing the leftover item's match, or removing and re-adding the library, regroups it.
  • In a library folder that is one show, an unnamed Episode 03.mkv inside Series 5 Matt Smith reads like Series 7 Documentary/Episode 03.mkv in 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.
  • A show folder directly in the library folder named Saison 2 …, Serie 2 …, or 1st 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 for Season 2 ….

Checklist

  • I read and can explain the complete diff.
  • This pull request addresses one concern.
  • The Evidence section shows every change a user can see, or says there is none.

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

  • Harness: Claude Code in T3 Code
  • Tool(s): Claude Code; Codex (design opinion and background adversarial review)
  • Model(s): claude-opus-5-5; gpt-6.1-sol; claude-sonnet-5-5 (review subagents)
  • Involvement: Fully AI-generated, maintainer-directed; human verification happens in review
  • Adversarial review: A second model (gpt-6.1-sol) compared guard designs before the fix and recommended a label-based check over a pure library-top rule, which would break libraries rooted at a single show. A multi-agent code review of the diff found that the guard dropped the season from title-prefixed folders (Doctor Who Series 5 Matt Smith), still accepted dash- and bracket-suffixed titles, and let an ordinal pair with the S label; 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 as La Série 2 were 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

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

silo-kody Bot commented Oct 12, 2026 •

Copy link
Copy Markdown

Silo Kody — review complete

Review finished. Check the inline comments for findings and verify each suggestion against the code and tests.

Reviewing changes in Silo
  • Include the related issue, expected behavior, and validation steps in the PR description.
  • For API changes, describe the effect on Apple and Android clients and Jellyfin compatibility.
  • For plugin changes, identify the affected SDK contract, plugin, and catalog entry.
  • Follow this repository's AGENTS.md and CONTRIBUTING.md.
  • Request another review with @kody start-review in a PR comment.
  • React with 👍 or 👎 to give feedback on individual suggestions.
Review settings
Review Options

The following review options are enabled or disabled:

Options Enabled
Bug ✅
Performance ✅
Security ✅
Business Logic ❌

@coderabbitai

coderabbitai Bot commented Oct 12, 2026 •

Copy link
Copy Markdown
Contributor

Warning

Review limit reached

You'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.

Check out review usage here.

View limit details

Limit details: You’ve used all 4 included reviews currently available.

Learn how review limits work.

Review configuration:

⚙️ Run configuration
  • Configuration used: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 0763277e-f892-4036-b266-ce7cc0214677

📥 Commits

Reviewing files that changed from the base of the PR and between 50108f6 and f979067.


📒 Files selected for processing (10)
  • docs/architecture/media-naming.md
  • internal/naming/episode.go
  • internal/naming/episode_parity_test.go
  • internal/naming/episode_reliability_test.go
  • internal/naming/filename.go
  • internal/naming/root_inference.go
  • internal/naming/season.go
  • internal/naming/season_test.go
  • internal/naming/series_folder.go
  • internal/naming/variants.go

  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 12, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-12T01:46:05.687823Z db54285 New commits
🔒 Security Review ✅ Completed 2026-10-12T01:46:45.376220Z db54285 New commits
ℹ️ 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 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".

Comment thread internal/naming/season.go Resolved
Comment thread internal/naming/season.go Resolved
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 Quick104 left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread internal/naming/filename.go Resolved
Comment thread internal/naming/episode.go Resolved
Comment thread internal/naming/series_folder.go Resolved

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 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".

Comment thread internal/naming/season.go
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})(?:$|[ ._\-\[\]])`)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge 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 👍 / 👎.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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]>

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 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".

Comment thread internal/naming/season.go Resolved
Comment thread internal/naming/season.go Outdated
}
rest = rest[4:]
}
return startsWithMatch(episodeTechnicalRe, rest) || startsWithMatch(inferReleaseTokenRe, rest)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge 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 👍 / 👎.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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]>
Comment thread internal/naming/season.go
func seasonLabelStandsAlone(label, rest string) bool {
if !wordSeasonDirectoryLabelRe.MatchString(label) {
return true
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

kody code-review Bug medium

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.

​

​

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread internal/naming/season.go
Comment on lines +37 to +41
rest = stripFolderTags(rest)
for {
rest = strings.TrimLeft(rest, " ._-[](){}")
if rest == "" {
return true

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

kody code-review Bug medium

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.

​

​

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@silo-triage silo-triage Bot added bug Something isn't working go Pull requests that update go code priority: P2 Limited scope, workaround exists, or polish labels Oct 12, 2026
@Quick104
Quick104 merged commit f11ad3c into main Oct 12, 2026
31 checks passed
@Quick104
Quick104 deleted the fix/issue-2322-season-folder-labels branch October 12, 2026 15:45
Quick104 added a commit to dannyshafer/silo-server that referenced this pull request Oct 13, 2026
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]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working go Pull requests that update go code priority: P2 Limited scope, workaround exists, or polish

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[bug] Saison, Serie, Seria, and "1st Season" folders become separate series

1 participant