Hello everyone!
I am hoping for some help with an Action to rename the audio file.
I'm working with audiobooks, which have the SERIES and SERIES-PART fields (both are TEXT) along with the normal ALBUM, ARTIST, etc fields.
I'd like to format the filename like:
<ARTIST>\<SERIES>\<SERIES-PART> - <ALBUM> (<YEAR>)\<ARTIST> - (<SERIES> - Book <SERIES-PART>) <ALBUM> (<YEAR>) - <TITLE>
This produces a folder path like:
Lois McMaster Bujold\Vorkosigan series\01 - Shards of Honor (1986)\Lois McMaster Bujold - (Vorkosigan series - Book 01) Shards of Honor (1986) - Part 01
The issue I'm having is dealing with the <SERIES-PART> field.
If <SERIES-PART> is less than 10, I'd like to have a leading 0 (zero) added, if not, then use <SERIES-PART> as is.
I've tried the following:
$if($lt($len($num(%Series-Part%,0)),10),%Artist%\%Series%\0%Series-Part% - %Album% (%year%)\%Artist% - (%Series% - Book 0%SERIES-PART%) %Album% (%Year%) - Part $num(%Track%,2),%Artist%\%Series%\%Series-Part% - %Album% (%year%)\%Artist% - (%Series% - Book %SERIES-PART%) %Album% (%Year%) - Part $num(%Track%,2))
but not matter what, the $IF evaluates as TRUE, and the first condition is always performed. So, if <SERIES-PART> is 16, the file is renamed 016 when I'd like only 16 (the FALSE condition).
To throw another wrinkle, working with <SERIES-PART> that has a decimal, ie 5.3 or 16.1. I use $NUM(%SERIES-PART%,0) to get everything before the decimal point, as my tests showed $num(16.1,0) returned 16, but no go.
How do I get the $IF to evaluate correctly so that if the <SERIES-PART> is less than 10, add a 0,
and
how to deal with <SERIES-PART> that have a decimal (again adding a 0 if <SERIES-PART> is less than 10 and keeping what is after the decimal)?
Thanks for any help!

