[FEATURE] Language token for file/folder renaming (e.g. {Book Language})

Open Beginner friendly
#343 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
72/100
Issue type
Feature
Clarity
Mostly clear
Activity status
Active
Tech stack
csharp
Domain
backend

Research direction

Start in src/NzbDrone.Core/Organizer/FileNameBuilder.cs, where the existing {Book ...} token handlers are, and check how Edition.Language in src/NzbDrone.Core/Books/Model/Edition.cs and Book.LanguageName / Book.LanguageCode in src/NzbDrone.Core/Books/Model/Book.cs are exposed. Add a handler for a language token that returns an empty string when no language is set. Done when a naming format containing the token renders the language code, and an unset language collapses inside a bracketed group.

Written by the indexing model from the issue text.

Description

enhancement

Summary

Add a renaming token that outputs the language of the book/edition, so it can be used in the Media Management naming format.

Motivation

For mixed-language libraries (e.g. English and German audiobooks) there is currently no reliable way to distinguish editions by language in the file or folder name. The title can't be used as a proxy: German editions frequently keep the original English book title.

Example — Rebecca Yarros, "Threshing Day" (The Empyrean #3.5):
the German edition keeps the identical book title "Threshing Day" and only the series name differs (English "Fourth Wing" vs German "Flammengeküsst"). Relying on the series name is fragile, and the book title itself is identical across languages, so neither distinguishes the editions. Root folders are per-author and can't separate languages either, and there is no naming token for language.

Proposed solution

Add a token such as {Book Language} (and/or {Edition Language}) to the naming format.

The data already exists in the model, so this is mainly about exposing it:

  • Edition.Language (src/NzbDrone.Core/Books/Model/Edition.cs)
  • Book.LanguageName / Book.LanguageCode (src/NzbDrone.Core/Books/Model/Book.cs)

Implementation would be a new token handler in
src/NzbDrone.Core/Organizer/FileNameBuilder.cs, alongside the existing {Book ...} handlers. Returning an empty string when no language is set would let it collapse cleanly inside a bracketed group, e.g. {(Book Language)} rendering (EN) / (DE) and disappearing when unknown.

Example

Same book, two language editions with an identical title — only the token tells them apart:

{Book Series}/{Book Title} ({Book Language})

Fourth Wing/Threshing Day (EN)
Flammengeküsst/Threshing Day (DE)

Dominant language
C#
Stars
664
Forks
48
Avg merge
5h 47m
Merged PRs (30d)
4

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from Chaptarr/chaptarr

All issues in Chaptarr/chaptarr

Similar issues

More C# issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.