Help - Search - Members - Calendar
Full Version: Question about title formatting
Hydrogenaudio Forums > Hosted Forums > foobar2000 > Support - (fb2k)
Agent[424]
CODE
[$char(9) $if(%album%,$abbr(%album%,25),%_directoryname%)    ::    %_length%]

I use that to display Track Length and Album Name (or directory name). They are aligned to the right. Now, here is my problem.

CODE
Artist - BlahBlahBlah               Album Name  ::  4:20
Another Artist - NahNah            Album Name  ::  10:57

When the time is longer than 9:59 I get a space in there that I don't want. Is there some formatting string I can put in there to insure that this doesn't happen?

For instance:

If the time is less than 9:59 seconds, display like this "%artist% - %title% %album% :: %length%" if over 9:59 seconds display like this "same as above, but with one less space after the :: section"

I went through the documentation, but some of this is waaayyyy over my head. I ran a search, but the only thing I could think of was "title formatting" which returned some interesting results, but not what I was looking for. If this answer is super-obvious, forgive me, I have only been using fb2k for about 10 months now. I am just branching out into the more complex formatting strings (was using %artist% - %title% for the longest time).

Thanks

PS: Using version 0.8.3 on Windows XP SP2, up to date.
richard123
Why not
[$if(%album%,$abbr(%album%,25),%_directoryname%) :: $char(9) %_length%]

or consider $pad() [or $pad_right()]
[$char(9) $if(%album%,$abbr(%album%,25),%_directoryname%) :: $pad(%_length%,6)]
Agent[424]
Hello, richard123

The tags you gave me didn't yield the results I had wanted, but they put me in the right direction, nonetheless.

CODE
[$char(9) $if(%album%,$abbr(%album%,25),%_directoryname%)    $pad(::,5) $pad_right(%_length%,5,0)]

I went with this, and just padded the spaces with a 0, which looks okay from where I am sitting. Thanks a lot, would have taken me ages to get this on my own.
Synthetic Soul
Using $tab() seems like the most sensible suggestion, but just for messing about I use:

CODE
$num($div(%_length_seconds%,60),2):$num($mod(%_length_seconds%,60),2)

... to display durations. This provides a 00:00 format so all durations (under 100:00) are the same length in a monospace font.

I also have an adaption that flashes the colon every second, but that's just silly.
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.