Repository navigation
feat(naming): {Narrator} placeholder and MyAnonamouse series fallback - #1407
Merged
Merged
Conversation
Audiobook templates can use {Narrator}, filled from the release's narrator
(MyAnonamouse enrichment), so several narrations of one book land in
separate folders. "{Title} {{Narrator}}" renders Audiobookshelf's
"Title {Name}" folder style and, with no narrator, drops both braces and
the trailing space instead of leaving "Title }".
MAM enrichment now also stores the first series' name and number in
extra.series_name/series_position, which queueing already uses when the
metadata provider has no series. A release-level series number is only
borrowed when it names the same series the provider did.
Folder names no longer keep spaces left next to "/" by an empty token.
The narrator survives the restart-safe retry payload, and the settings
preview offers {Narrator} for audiobook templates.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Owner
|
Thank you ! Awesome work |
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.
Human-Written explanation:
Following up on previous PR to use MAM ID to get nararrator and series to show up in search, this PR will allow the series and nararrator fields to be added to the path when saving an audiobook.
I have tested my ghcr.io image on my instance and it seemed to work properly.
All the text below is written by Claude.
feat(naming): {Narrator} placeholder and MyAnonamouse series fallback
Follow-up to #1390 and #1399. Related to #605 and #934 (narrator support).
Problem
Several narrations of the same audiobook currently land in the same folder, because nothing in the path template tells them apart. Keeping more than one version means renaming folders by hand after every download.
Since #1390, MyAnonamouse results carry the release's narrator and series in
extra, but the naming templates can't use them: there is no{Narrator}placeholder, and{Series}/{SeriesPosition}only come from the metadata provider.Changes
{Narrator}placeholder (core/naming.py,download/postprocess/transfer.py,core/models.py):DownloadTaskgainsnarrator, read fromnarratororextra.narratorwhen a release is queued, and kept in the restart-safe retry payload. It's available in audiobook templates like any other placeholder, including prefix/suffix blocks such as{ - Narrator}.Title {Narrator}. The template{Title} {{Narrator}}already matches as{+{Narrator}; the parser now also drops the closing brace when the narrator is empty, so the folder isTitlerather thanTitle }./: an empty placeholder at the start or end of a folder name no longer leaves a space there (e.g.Title /Title). This applies to all templates.release_sources/prowlarr/mam.py,source.py,download/orchestrator.py): MAM enrichment also stores the first series' name and number asextra.series_name/extra.series_position, which queueing already falls back to when the metadata provider has no series. The provider's series still wins. A release-level series number is only used when it names the same series as the provider, so a provider series is never paired with the number of a different MAM series (an omnibus, for example).config/settings.py,namingTemplatePreview.ts): the audiobook template descriptions list{Narrator}and explain{{Narrator}}. The settings page preview mirrors the parser changes and offers{Narrator}under "Insert variable" for audiobook templates only.environment-variables.md. This also picked up the Library Check settings, which weren't in the generated docs yet; happy to drop that part to keep the diff focused.Example
Audiobook Path Template
{Author}/{Title} {{Narrator}}/{Title}:Christopher Ruocchio/Empire of Silence {Samuel Roukin}/Empire of Silence.m4bChristopher Ruocchio/Empire of Silence/Empire of Silence.m4bTesting
tests/core/test_narrator_template_variable.py(new, 16 tests):{{Narrator}}with and without a value, the{ {Narrator}}prefix form, prefix/suffix blocks, sanitizing,build_library_path, task metadata, retry payload round trip, MAM series name/number parsing (including a1-3range having no number), and queueing (narrator fromextra, series fallback, no cross-series number, blank narrator).namingTemplatePreview.test.ts: the same{{Narrator}}cases for the preview.test_generate_env_docs.pyfor the new template description.pytest -m "not integration and not e2e"compared with an upstreammainworktree on the same machine: no new failures (the remaining ones are Windows-only on both).ruff check,ruff format --check,basedpyright(0 errors) andvultureon touched files; frontendtsc --noEmit,oxlint,oxfmt --check,vitest(218 passed).... {Simon Vance}.mp3and{Narrator}is listed for audiobook templates only.No behavior change for existing templates, apart from spaces next to
/being trimmed.🤖 Generated with Claude Code