If conditionals not working in scripts #116
Unanswered
ElysiumFic
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
In an effort to customize my export output, I'm trying to implement if conditionals into my version of the
Rename, Relocate, etc
script, but I appear to have broken it instead. MP3Tag will write some of the output files (like desc.txt and reader.txt) but won't even attempt to change the directory. I have been trying a lot of things, but I believe the trouble began when I tried to introduce conditionals into my%_filename%
formatting.Forgive me in advance if this is long. I'm making lots of little tweaks, and I'm not sure where I'm going wrong, except that things were working all right until I added in conditionals. This is also part of a larger project, so I'm giving lots of contextual data in case someone knows of a better way to achieve what I'm trying to achieve.
THE OBJECTIVE:
I want sort of a full range of metadata output available. I want the library structured according to best practices, and then within the audiobook directory, I want the metadata available in several of the most commonly used forms.
This is in large part an effort to future-proof against any change in the storage and playback environment I'm using for my library.
By doing this, I hope that, no matter how the tools and processes evolve, I can be somewhat assured that I can import my library into the next New Nifty Audiobook Organization Thing without having to redo the effort of organization my library all over again.
Presently, I'm about to migrate my library into Audiobookshelf after using Plex for years. I want it all nicely organized before I migrate.
So here is what I want in my audiobook directory (i.e. everything except the kitchen sink):
audiobook.m4b
desc.txt
reader.txt
cover.jpg
audiobook.nfo
metadata.opf
audiobook.metadata.json
audiobook.cue
chapters.txt
(in mp4v2's mp4chaps format, i.e.00:00:00.000 Prologue
)Explanations:
audiobook.cue
andaudiobook.metadata.json
are output by Libation. Here is a sample of the .json:The Color Purple [B086MHFDMB].metadata.json
(Ideally, this file would be my first stop for getting the metadata and chapter info instead of scraping it from Audible, since it has already been precisely matched to the book, saving us the effort of doing another search. But I'm not even close to making that happen. I also hope someday to automate converting
audiobook.cue
tochapters.txt
but I'm not there yet either.)audiobook.nfo
andmetadata.opf
are generated by an export script with MP3Tag, just like desc.txt and reader.txt.audiobook.nfo
is modeled after Dano's simple info.metadata.opf
is slightly modified from a CoPilot suggested script. Here are those if anyone is interested:OPF.mte.txt
NFO.mte.txt
My filename for
audiobook.m4b
and any other files sharing that filename should ideally be identical to Libation's filename formatting (to facilitate integrating MP3Tag output files with Libation output files with minimal effort.)What I've got set up in Libation is:
<title> (<year>) [<id>]
aka%album%: %subtitle% (%year%) [%asin%]
It should be noted that Libation has two title options.
<title short>
stops at the first colon, while<title>
does not. Libation uses the correct unicode version of a colon so that Windows file system allows it in file and directory names. I'm not sure how to replicate that beyond cutting and pasting a colon that I know works to replace one I'm not sure of.Why does this matter?
Plex has a problem where, when you add audiobooks to a playlist or queue (on the web interface, at least, which I sometimes use for whatever reason there is at the moment), all you see is the
%title%
, without any series or subtitle information. So while separating the book title from the subtitle makes for cleaner metadata, it doesn't look very good in a playlist in Plex. Since I'm not personally dealing with books that have been divided into multiple files, I don't have to worry about chapter track naming, so I'm taking the approach of having%title%
be the equivalent of Libations<title>
while%album%
is the equivalent of<title short>
.Libation, alas, does not make the series and author ASIN available for including your filename or folder formatting, which is why, after exporting using Libation, I need to go through with MP3Tag and restructure things.
Here is how I want my directory structure to appear:
It doesn't look like including the ASIN for author and series is necessarily best practices, but it seems to me that relying on the author ASIN is a much more consistent way of keeping books from the same author together when Audible has a tendency to use different punctuation in author names involving initials, and tends to have a lot of minor variations in series naming that results in files that should be in the same series directory getting put in different directories. So that information should be... somewhere. I'm just not sure where.
I edited the Audible data source script to include scraping the Author and Series ASIN, which you can see here:
Audible.com#Search by Album.src.txt
So. With all that said, this is my first attempt at the
Rename, Relocate, etc
script, and something about including a conditional for the series part has resulted in nothing changing regarding where the files are being located. Export documents are being placed in the directory where the audiobook currently resides.&1 Rename Relocate etc.mta.txt
So I guess I have two questions:
Beta Was this translation helpful? Give feedback.
All reactions