Reformat %length% 4_06 to 4∶06?

Tags: #<Tag:0x00007f7d009b69a8> #<Tag:0x00007f7d009b6598> #<Tag:0x00007f7d009b6250>

I’ve gotten myself all tied up with trying to convert the format of %length%…

At first I thought maybe I couldn’t use %length% in $replace so I set %_trackLength% to equal %length% and then use that with the $replace to change the underscore to a unicode colon ∶ looking thing and then if I’ve enabled it, … it becomes part of the filename.

$noop(★ 00 CREDITS ★)
$set(_showTime,1)

$set(_trackLength,%length%)

$noop(★ Get Track Length ★)
$if($eq(%_showTime%,1),
$set(_trackLength,%length%)
)
$noop(★ GAME OVER ★)
%_titleForFilename%
$if($eq(%_showTime%,1),[%_trackLength%])
$if($eq(%_showBandwidth%,1),[%__filebr% %_sample_rate%KHz %__filech%])
$noop(★ 00 CREDITS ★)

Except all I get in the filename is []

  1. Star Wars Theme [][V2 44100KHz 1Ch].m4a
    I would like to to look like:
  2. Star Wars Theme [3∶49][V2 44100KHz 1Ch].m4a
    Originally I had:
  3. Star Wars Theme [3_49][V2 44100KHz 1Ch].m4a

%@#$! :wink:

1 Like

To replace the colon with that Unicode variant you need to call replace:

$set(_trackLength,$replace(%length%,:,∶))

The rest should work, even though you should check your script because you are setting _trackLength twice. You should remove one of those.

2 Likes

I think that extra _trackLength was a product of the copy/paste when posting.

Otherwise, yes, I cleaned that up, used the simple $replace - which brought me another issue when I moved the files to a FAT32 volume, it handed the Unicode about as well as it would have the colon.

So I decided to change that Unicode character to ‘m’ for mins, and append an ‘s’ in the script, so I’d see [4m20s] … and shortly after that, I came across some tracks greater than 59 seconds and I ended up with 1m15m43s.

That’s probably another embedded voodoo $left,x detection mess. :frowning:

For the moment, I resorted to changing it init.py, to “%dm%02ds” and “%dh%02dm%02ds” for when I explore plugins to see if I can manipulate the variables that way starting with the ‘additional artist variables’ plug in as a guide.