So I'm trying to abbreviate codec names to 3 letters and Monkey's Audio is giving me grey hairs. I tried to replace the apostrophe with unicode $char(39) as well as put apostrophes around the apostrophe but neither worked. Is there any workaround for this?
Here is the code I'm using:
$if($stricmp(%codec%,'Musepack'),'MPC',
$if($stricmp(%codec%,'Vorbis'),'OGG',
$if($strcmp(%codec%,'Monkey's Audio'),'APE',
%codec%)))
'
(single quotation mark)
Inserts specified text bypassing syntax processing; allows special characters such as %,$,[,] to be inserted. In order to insert a quotation mark character, use '' (two single quotation marks).
Strings enclosed in quotation marks are not processed, that's why $char(39) did not work.
$if($stricmp(%codec%,Musepack),MPC,
$if($stricmp(%codec%,Vorbis),OGG,
$if($stricmp(%codec%,Monkey''s Audio),APE,
%codec%)))
Shorter and probably faster according to a quick speed test:
$replace(%codec%,Musepack,MPC,Vorbis,OGG,Monkey''s Audio,APE)
I am surprised that this didnt work:
Monkey$char(39)s Audio
because it appears to work in every test I run on my end.
Oh it's because the whole thing was in quotes .. yea the first and last ' are causing the $ in $char() not to be processed.
I dont like mucking about with special characters so I'd suggest this:
$if($stricmp(%codec%,Musepack),MPC,
$if($stricmp(%codec%,Vorbis),OGG,
$if($stricmp(%codec%,Monkey$char(39)s Audio),APE,
%codec%)))
or something less messy than a cascading if like the replace option above.
Shorter and probably faster according to a quick speed test [...]
Is such a tool available for foobar? If so, where can I get it?
Instead of %codec% why not use $ext(%path%) to get the three letter extension (except for .flac)?
Rob
In Column Tab under Playlist View in ColumnUI settings in Preferences. You can find a Tools button there which open a menu and Speed Test is in it.
Thanks for the tips
Instead of %codec% why not use $ext(%path%) to get the three letter extension (except for .flac)?
This will not work for online streams and it will fall victim to any misnamed files while %codec% is a lot more versatile in it's implementation.