Repository navigation
Conversation
Metadata tagging now also writes the book's publisher, subtitle and
language from the Audible details lookup, under the existing
metadata_tagging_enabled switch (no new settings):
- M4B/M4A/MP4: freeform PUBLISHER, SUBTITLE and LANGUAGE in the ASIN
post-step (ffmpeg's mp4 muxer drops them). A value that is empty
after sanitizing is left out, so one bad value never costs the ASIN.
- MP3: TPUB, TIT3 (clearing a source TXXX:SUBTITLE so it never sits
next to TIT3) and TLAN.
- FLAC: publisher, subtitle and language Vorbis fields, replacing the
source's.
Values are bounded (1 KiB), whitespace-collapsed, and lone surrogates
and U+FFFE/U+FFFF become U+FFFD: the post-step reads every value back
byte for byte, and ffprobe returns neither as written. Non-string
lookup values are ignored. The organizer's disk check and log line come
from buildMp4FreeformTags, so they match what is written. The
language is Audible's name with its first letter capitalized
("English"), as Audiobookshelf shows it, not an ISO 639 code.
AudibleAudiobook gains subtitle (Audnexus and catalog). With tagging
off, the ASIN step on a merged file still writes the ASIN only.
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.
Follow-up to #419 for #208: publisher, subtitle and language, on top of the ASIN post-step from #404. Same rules as before: under
metadata_tagging_enabled, no new settings.What is written
----:com.apple.iTunes:PUBLISHERTPUBpublisher----:com.apple.iTunes:SUBTITLETIT3, plussubtitle=to clear a sourceTXXX:SUBTITLEsubtitle----:com.apple.iTunes:LANGUAGETLANlanguagepublisherName,language, plus newsubtitlefrom Audnexus and the catalog). The book row stores none of them, so there is no fallback. Without a value nothing is written, and the source file's tags stay.sanitizeShortTagValue: non-strings ignored, bounded, whitespace runs collapsed, controls dropped, capped at 1 KiB. The post-step reads every value back byte for byte, so what ffprobe would not return as written is replaced with U+FFFD: lone surrogates (toWellFormed) and U+FFFE/U+FFFF. Probed: ffmpeg's UTF-8 check rejects only those two. Other noncharacters, C1 controls, DEL, ZWJ, U+2028 and emoji read back fine.buildMp4FreeformTagsleaves out a value that is empty after sanitizing. Since the post-step writes all tags or none, one bad value can't cost the ASIN; a test covers this.buildMp4FreeformTagsitself, so both match what is actually written. The two organizer tests use the real builder in theirmetadata-taggermock for that.Choices worth a look
english, and the tag is that name with a capital first letter, as Audiobookshelf's own Audible provider shows it. For MP3 this meansTLAN=English, while ID3 expects an ISO 639-2 code there. Withengin MP3 files, Audiobookshelf would show "eng" next to "English" for M4B books, and its language filter would split one library into two values. Easy to change if you'd rather follow ID3 strictly, or leave language out for MP3.TIT3. ffmpeg'ssubtitlekey becomes aTXXXframe, and a sourceTIT3would survive next to it: the same "old next to new" problem as the FLAC description in feat: write description, genre, media type and gapless tags (#208) #397.TIT3is the frame Mp3tag, Picard and Audiobookshelf's own embedding use, and Audiobookshelf reads it through itstit3alias.Testing
metadata-tagger.book-details.test.ts(mapping per format, freeform builder) andmetadata-tagger.book-details.integration.test.ts(real ffmpeg). Every source already carries the three fields, and the tests check that they are replaced, never duplicated: m4b freeform atoms in any case, MP3TIT3+TXXX:SUBTITLE+TPUB+TLAN, FLACPUBLISHER/SUBTITLE/LANGUAGEwithORGANIZATIONleft alone. They also check that the ASIN still lands when another value is bad.regressions/208-asin-tagextended and run locally (--trusted): Audiobookshelf readstagPublisher"Audible Studios" andtagLanguage"English" into the book's publisher and language. With tagging off, neither is written. No fixture book has an Audible subtitle, so SUBTITLE is covered by the unit and real-ffmpeg tests only.npm testgreen (4045 passed),tscclean, no new ESLint findings,docker build -f dockerfile.unifiedOK.