Background: I'm not actually familiar with the scripting used for Mp3Tag actions/exports/etc. I've been able to monkey-see/monkey-do a bit just based on common sense, but a lot of the scripting is beyond what I can understand just looking at the code, particularly when RegEx is thrown into the mix. I have, however, taught myself Swift back when I was working on my Mac, so I'm not entirely clueless. I just don't know this particular language.
Dilemma: I have usually been a Mac user, but lately I've needed to work on my PC while I'm organizing my audiobook library, which I hand-verify the chapters and metadata for because I'm just OCD like that.
It's a time-consuming process, particularly as my library grows.
The Goal: I want to keep .nfo and .cue files as a backup plan (or really any text equivalent, .nfo and .cue just are handily specific.)
That way, if something happens to my external drive (or I pull the same boneheaded move twice and accidentally delete the wrong directory that happens to be too big for the Recycle Bin--oops) and I have to re-download my audiobook library from the Zon and elsewhere, it will be quicker to create a convert script to import the metadata from an .nfo file, and a .cue file for the chaptering, than to do it all again.
Exporting the metadata is fairly straightforward, and I imagine importing it will be too. It's working with the chapters that is tripping me up, because I don't know how Mp3Tag reads embedded chapters (if it does at all.)
Ultimately, I need the chaptering data exported (and importable) either as a .cue or in one of the following formats, which are also commonly used (if only I could find an app that gave the option to use all three, but it's either .cue or these):
00:00:00.000 Opening Credits 00:00:16.000 Prologue 00:22:00.000 Chapter 1
CHAPTER01=00:00:00.000 CHAPTER01NAME=Opening Credits CHAPTER02=00:00:16.000 CHAPTER02NAME=Prologue CHAPTER03=00:22:00.000 CHAPTER03NAME=Chapter 1
Ultimately, the formatting is trivial. Once I have the data, I can export it in whatever format I want. It's getting the embedded chapter data out of the file that poses a challenge.
What I've Tried: @pone has some amazing scripts that ALMOST do what I want to do with regard to exporting a cue sheet, but they appear to be reliant upon an initial tracklist import from Discogs, rather that exporting the chapters from the file's metadata (either The scripting is WAY over my head, but when it generated what was supposed to be the tracklist, it didn't bear any resemblance to any tracklist I've seen. Which would make sense, because why would audiobook data be on Discogs?
The Process: I'm using Seanap's Plex Audiobook Guide--particularly the export, action, and source files for Mp3Tag--to flush out my metadata, and then I verify the results by looking it over, and make tweaks where necessary, before considering it finalized.
For my .nfo files, I'm using a highly-specified export based on the simple NFO design by @dano, attached here:
NFO.mte (2.2 KB)
As you can see at the end, I've got a listing of the chapters at the bottom, mostly just because I'm experimenting with what I need to do to generate a chaptering data file before I start trying to write that script. Supposedly, there is a
%subsong% option for files with embedded chapters that would facilitate this, but it doesn't seem to be working for me. But I digress....
With "Chapters are listed as separate files" checked, I can get a list of the chapters and the duration of each chapter, which I can then export using:
$loop($num(%discnumber%,3)$num(%track%,4)%_filename_ext%)$num(%track%,2). %title%$repeat( ,$sub(57,$len(%title%))) [$replace(%_length%,_,:)] $loopend()
However, that isn't really what I need. I need the starting timestamp of each chapter, not the duration. If the starting timestamp can't be parsed (either from the
chpl atom in Nero chaptering, or the sample table atoms on the chapter text track for Quicktime chaptering) it would have to be calculated by getting the sum of the durations of all the preceeding chapters.
I feel like I'm close on this, but I'm missing something and my lack of understanding about this type of scripting and what data MP3Tag has available for export is preventing me from finding the solution. I've actually written pure Swift libraries for parsing and editing metadata and chapter data in MP4 and ID3 tagged files, so I'm familiar with how metadata WORKS, I just don't have the same level of understanding of the tools I'm using now.