Help - Search - Members - Calendar
Full Version: Problem with title formatting and foo_osd
Hydrogenaudio Forums > Hosted Forums > foobar2000 > General - (fb2k)
Overlord
This is probably the wrong place to post this, but I'm at my wits end with this. I've been trying for about 3 hours now to get foo_osd to display a string at the top of the screen in one of 2 ways: if it's a VGZ, GYM or SPC file In the format "album - name (time)", and if it's anything else, "artist - name (time)".

I have this formatting string:

CODE
$if($stricmp($ext(%_path%),vgz),00ff00|000000[%album% - ]$if2(%title%,%_filename%) '('%_length%')', 00ff00|000000[%artist% - ]$if2(%title%,%_filename%) '('%_length%')')


This does what I want it to do - unfortunately, only with VGZ. I tried using an $or() where VGZ is but that's seemingly doing nothing - where am I going wrong, and how can I get this working (ideally, so I can put more extensions in in this same way in the future if needed)?
Silverbolt
CODE
$if($or($stricmp($ext(%_path%),vgz),
$stricmp($ext(%_path%),gym),
$stricmp($ext(%_path%),spc)),
00ff00|000000[%album% - ]$if2(%title%,%_filename%) '('%_length%')',
00ff00|000000[%artist% - ]$if2(%title%,%_filename%) '('%_length%')')
Synthetic Soul
QUOTE(Overlord @ Feb 23 2006, 03:19 AM)
(ideally, so I can put more extensions in in this same way in the future if needed)
To make it easier to add extensions, instead of:

$or($stricmp($ext(%_path%),vgz),$stricmp($ext(%_path%),gym),$stricmp($ext(%_path%),spc))

... one possibility would be:

$strstr('.vgz.gym.spc',.$lower($ext(%_path%)))

You then just add your new extension, ".xxx", to the string '.vgz.gym.spc', e.g.: '.vgz.gym.spc.xxx'.

The delimiter is used to ensure that a match isn't made "mid extension", i.e.: if we used:

$strstr('vgzgymspc',$lower($ext(%_path%)))

... an extension of "zgy" would create a false match.

Silverbolt's code is certainly clear enough, but noobs (I'm not suggesting you fall into this category, I refer to someone using your code) might find this approach easier to deal with.
Overlord
Thank you both, that works perfectly. =)
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2008 Invision Power Services, Inc.