HydrogenAudio

Hosted Forums => foobar2000 => General - (fb2k) => Topic started by: orchid on 2006-12-19 21:53:10

Title: How to display apostrophe as part of text?
Post by: orchid on 2006-12-19 21:53:10
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%)))
Title: How to display apostrophe as part of text?
Post by: Frank Bicking on 2006-12-19 22:19:26
Quote
'
(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.

Code: [Select]
$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:

Code: [Select]
$replace(%codec%,Musepack,MPC,Vorbis,OGG,Monkey''s Audio,APE)
Title: How to display apostrophe as part of text?
Post by: Yotsuya on 2006-12-20 05:03:15
I am surprised that this didnt work:
Code: [Select]
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:
Code: [Select]
$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.
Title: How to display apostrophe as part of text?
Post by: eejadx on 2006-12-20 05:44:17
Shorter and probably faster according to a quick speed test [...]

Is such a tool available for foobar? If so, where can I get it?
Title: How to display apostrophe as part of text?
Post by: rocketsauce on 2006-12-20 06:44:16
Instead of %codec% why not use $ext(%path%) to get the three letter extension (except for .flac)?

Rob
Title: How to display apostrophe as part of text?
Post by: thuan on 2006-12-20 09:04:15
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.
Title: How to display apostrophe as part of text?
Post by: orchid on 2006-12-20 11:38:35
Thanks for the tips
Title: How to display apostrophe as part of text?
Post by: Yotsuya on 2006-12-20 19:06:42
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.