Skip to main content

Notice

Please note that most of the software linked on this forum is likely to be safe to use. If you are unsure, feel free to ask in the relevant topics, or send a private message to an administrator or moderator. To help curb the problems of false positives, or in the event that you do find actual malware, you can contribute through the article linked here.
Topic: Foobar2000 format strings (Read 497613 times) previous topic - next topic
0 Members and 1 Guest are viewing this topic.

Foobar2000 format strings

Thanks to the awesome TAGZ library, awesome stuff is possible. I can make song titles look the way I want.

This is what I want:
Quote
Title - Version foo
Artist / Title
Artist / Album Disc 2 11 / Title
Album Disc 2 11 / Artist 28 / Title - Version bar

automatic title formatting based on the amount of data available.


Which basically means I start with the following:
if (album is by various artists)
%album% [Disc %discnumber% ]%tracknumber% / %artist% / %title%[ - %version%]
else
[%artist% / ][%album%[ [Disc %discnumber% ]%tracknumber%] / ])%title%[ - %version%]

if (album name is longer than 20 characters)
$abbr(%album%,20) instead of just %album% and so on.

to pad tracknumbers with zeroes
$tracknumber%()

if artist differs from performer
$if2(%performer%,%artist%)

if title is unknown
if2(%title%,%_filename_ext%)

which ultimately gives me:
Quote
$pad_right(%_playlist_number%,4). $if(%various%,$abbr(%album%,20) [Disc %discnumber% ]$tracknumber%() / $if2(%performer%,%artist%) / ,[$if2(%performer%,%artist%) / ][$abbr(%album%,20)[ [Disc %discnumber% ]$tracknumber%()] / ])$if2(%title%,%_filename_ext%)[ - %version%][ - $num(%__bitrate%,3)kbps][   %_length%]


Tell me what you think, please. I'd love to see other people's strings too. : )

edit: updated string to work on recent versions of foobar2000, minor additions too.
Hey folks, use QUOTE instead of CODE for formatting strings, please. CODE can cause display problems for other people.

edit2: I've since switched to this:
Quote
$num(%_playlist_number%,$len(%_playlist_total%)). []
$if(%__replaygain_track_peak%,,$rgb(255,0,0))

$if(%various%,

%album% [Disc %discnumber% ]$tracknumber() / $if2(%performer%,%artist%) / ,

[$if2(%performer%,%artist%) / ][%album%[ [Disc %discnumber% ]$tracknumber()] / ])

$if2(%title%,%_filename_ext%)
[ - %version%]
$num($if2(%__bitrate_dynamic%,%__bitrate%),3)kbps]
[$tab()%_length%]

Foobar2000 format strings

Reply #1
Ok, I got mine ready thanks to some help from you people, and I´m sure, one of these days I´ll be able to toggle different formats with my number keys ;-)
I´m too lazy to put comments on the string, just copy/paste and try yourself, feed it a couple of folders and you´ll see!! My background is black and my selection bar is yellow.

Quote
$if(%title%,$padcut([$caps(%artist%)],35) $padcut(00FFFF$caps(%title%),40)D2D200$if(%bpm%,$cut(%bpm%,3)bpm/,$if(%__bitrate%,$cut(%__bitrate%,3)bps/,No Data!)),409FFF%filename%)$if(%tracknumber%,409FFF$num(%tracknumber%,2) of 00FFFF$caps(%album%),0000FF$caps(%album%)) [%date%] $if(%__replaygain_album_gain%,00FF00T %__replaygain_track_gain% A %__replaygain_album_gain%,0000FF$caps(%album%)5B91FF No ReplayGain! %comment%)

Foobar2000 format strings

Reply #2
This is what I currently use.  Haven't had time to had l33t coloring or anything though..  (I'm hoping to see italics/bold/underline formatting sometime in the future )

Quote
$pad(%_playlist_number%, 4). [%artist% - ]$if($strcmp(%date%,-1),,%date% - )$if(%title%,['['%album%[ : <%album subtitle%>][ :: <%album description%>][ #[%disc%/]$num(%tracknumber%,2)]'] ']%title%[ / %track co-title%][ : <%track subtitle%>]$if(%piece subsection%, - Part #%piece subsection%,)[ :: <%track description%>],%_filename%)


I also think it would be cool if some sort of functionality would be added to the Tagz stuff to where you could even script conditional entries in the playlist.  For example, some of the cd's I have contain "subsongs" within a track, which are delineated by subindices.  Since Ape2 (yes, I use MPC almost exclusively for my audio library, although the idea could easily work with Vorbis comments) defines an "index" tag, it would be cool if you could script something in tagz to where it would scan the index tag, and per entry, you could add a new playlist item.

Say:

Code: [Select]
TRACKNUMBER=4
INDEX=1:00/2:00/3:00


on the playlist it could look like:

Code: [Select]
1 - Some Artist - Some Album - Some Track                          Some Total Length
2 - Some Artist - Some Album - Some Track                          Some Total Length
3 - Some Artist - Some Album - Some Track                          Some Total Length
4 - Some Artist - Some Album - Some Track                          Some Total Length
                        4.1 + Subsong 1          Subsong 1 Length/Some Total Length
                        4.2 + Subsong 2          Subsong 2 Length/Some Total Length
                        4.3 + Subsong 3          Subsong 3 Length/Some Total Length
5 - Some Artist - Some Album - Some Track                          Some Total Length


I think this sort of functionality could have all kinds of other potential uses as well.

At any rate, I think this Tagz stuff is great... definitely one of fb2k's killer features :B

Foobar2000 format strings

Reply #3
Btw.. I edited the first 2 posts so that the display would wrap correctly

If you guys want to use a monospace font then just do a quote block but with [ font = courier ] (without spaces) inside the quote block, then end the font tag before closing the quote.  It makes it much more pleasant to read the thread when it wraps properly

Foobar2000 format strings

Reply #4
Quote
I also think it would be cool if some sort of functionality would be added to the Tagz stuff to where you could even script conditional entries in the playlist.  For example, some of the cd's I have contain "subsongs" within a track, which are delineated by subindices.  Since Ape2 (yes, I use MPC almost exclusively for my audio library, although the idea could easily work with Vorbis comments) defines an "index" tag, it would be cool if you could script something in tagz to where it would scan the index tag, and per entry, you could add a new playlist item.

Quote
808080$num(%_playlist_number%,4). $if(%title%,422DA8%artist%[ feat. 9E2DA8%featuring%][ <[%date% - ]A82D55%album%[ {A8612DDisc $num(%disc%,1)}][, #93A82D$num(%tracknumber%,2)]>]: 36A82D%title%[ '('2DA880%subtitle%')'][ '['2D74A8%version%']']$if(%__replaygain_album_gain%,,   0000FF!!NO ALBUM GAIN!!),%_filename%)


The scheme gives a nice, not-entirely-saturated rainbow color going from left to right. The specialized fields I used are 'featuring', for featured artists (I'll expand it to include other things, possibly, like 'presented by'), 'subtitle', for the bracketed part of a track title, and 'version' for the mix name for electronic stuff (like "[Maas Remix]") The other bit is that all the symbols that aren't part of the field are black, so you can see exactly where the fields begin and end.

On a side note, when ClearType is enabled and the Trebuchet MS Bold font is used, FB2K is not displaying the right side of some characters.

@Dibrom: When you add an index, does FB2K treat the different sections as subtracks the way it does with ZIPs? Or is this just a feature request?

Foobar2000 format strings

Reply #5
$num(%_playlist_number%,2). [$padcut(%artist%,30) - ]$if(%title%,$padcut(%title%,40)808080 - [$padcut('['$if(%tracknumber%,Track[ #[%disc%/]$num(%tracknumber%,2) ],)from %album%'] ',45)] [- $padcut($if(%__replaygain_album_gain%,FF0080%__replaygain_album_gain%,A00000%__replaygain_track_gain%),19)800080 $num(%__bitrate%,3)kbps ][$num(%__samplerate%,5)Hz][ - %comment%],%filename%)

Foobar2000 format strings

Reply #6
here is my string (use Courier New or some other fixed width font):

Code: [Select]
$num(%_playlist_number%,4) 808080| $padcut($if(%artist%,%artist%,'Unknown Artist'),35) 808080| $padcut($if(%title%,%title%,%_filename%),55) 808080| $padcut($if(%tracknumber%,'('$num(%tracknumber%,2)') ',)$if(%album%,%album%,'Unknown Album'),40) 808080| $padcut([%genre%],15) 808080|


it looks something like this:

<link removed>

basically it does playist # (padded to 4 characters... for now), then %artist% (or "Unknown Artist"), then %title% (or filename), then %tracknumber%, or null, then %album% (or "Unknown Album"), then genre (or null)

personally i think this is good because i can resize the window to a fairly small size, and still have artist and title, or make the window bigger and see useful information...

also for this screenshot, here is the status bar:
Code: [Select]
[%artist% - ]$if(%title%,%title%,%_filename%)[ // [Track %tracknumber% ]on "%album%"]

and here is the title bar and system tray tooltip: (same thing)
Code: [Select]
[%artist% - ]$if(%title%,%title%,%_filename%)

they are pretty self explanatory... artist if it exists, then title, or filename if there is no title.

EDIT: changed "%filename%" to "%_filename%"
EDIT 2: added bit about using a fixed width font

Foobar2000 format strings

Reply #7
Here is my Playlist string:

Code: [Select]
$num(%_playlist_number%,3).   [%artist% - ]FF0000$if(%title%,['['%album%[ 0000FF#[%disc%/]$num(%tracknumber%,2)]'FF0000]  ']%title%,%_filename%)

Album in blue and Track number in red.
Still working with the strings, so maybe I get a few hints here.

B)

Foobar2000 format strings

Reply #8
Quote
@Dibrom: When you add an index, does FB2K treat the different sections as subtracks the way it does with ZIPs? Or is this just a feature request?

I don't think it does anything with the index tag.. so yeah, it's a feature request, though I'm not requesting a feature based implicitly on the index tag, but moreso a generalized ability to script conditional playlist entries.  This could be used for many things really.. the index thing just happens to be one of them.

Foobar2000 format strings

Reply #9
Code: [Select]
$num(%_playlist_number%,4). 5B5B5B$padcut($if(%artist%,%artist%,),30) $padcut($if(%title%, - %title%,),55) $padcut($if(%album%, - 5B5B5B$abbr(%album%,45),),55) $if(%tracknumber%,- 5B5B5B$num(%tracknumber%,2),)


Playlist font: ProFontWindows Size 7,
Text color RGB: 219, 219, 219,
Background: black,
Selection color: RGB: 83, 83, 83

That's it. I like it

EDIT:
My new string:
Code: [Select]
$num(%_playlist_number%,4). 5B5B5B$padcut($if(%artist%,%artist%,),30) $padcut($if(%title%, - %title%,),55) $padcut($if(%album%, - 5B5B5B$abbr(%album% ,45),),55) $padcut($if(%album%,$if(%date%,- '('%date%')', ),),10) $if(%tracknumber%,- 5B5B5B$num(%tracknumber%,2),)

Foobar2000 format strings

Reply #10
Code: [Select]
1E1ECA$num(%_playlist_number%,4)':' $if(%title%,DC0C35$padcut($if(%artist%,%artist%,),25) $if(%date%,0080FF -'['%date%']',) $padcut($if(%album%,- 5B5B5B%album%,),45) $if(%tracknumber%,0000FF- $num(%tracknumber%,2) ,)$padcut($if(%title%,0000FF- %title%,),55),$padcut(808080%_filename%,100)BF408F'-NO TAGS FOUND!')


The code is a bit messy, due to my tweaking, but it gets the job done.

Foobar2000 format strings

Reply #11
Tweaked and changed code samples from this topic to fit my needs.
Thank you all I used code from

Code: [Select]
1E1ECA$num(%_playlist_number%,4)':' $if(%title%,DC0C35$padcut($if(%artist%,%artist%,),25) $if(%tracknumber%,$padcut(0000FF- $num(%tracknumber%,2) ,14),-   ) $padcut($if(%title%,0000FF- %title%,),50) $if(%date%,$padcut(0080FF -'['%date%']',18), -'[    ]') $if(%album%,$padcut(- 5B5B5B%album%,45),$padcut('-   ',35)), $padcut(808080%_filename%BF408F,85)'NO TAGS FOUND!')$if(%__replaygain_album_gain%,$padcut(FF0080%__replaygain_album_gain%,21),$padcut(A00000%__replaygain_track_gain%,21))$if(%comment%,%comment%,)


EDIT:

Link to Screenshot

Foobar2000 format strings

Reply #12
I like it simple...:

Quote
$num(%_playlist_number%,4). [%artist% - ] %title%[    / %album%][ '('$num(%tracknumber%,2)')']


Screenshot

Regards, fileman.

Foobar2000 format strings

Reply #13
<rant>This thread is bloody hard to read, are the forum's markup facilities that hard to understand?</rant>

I seldom use foobar, but I found the default display schemes too confusing even for occasional use.

In the playlist, I just like to have artist and title because anything else wouldn't make sense when I have my whole collection (which doesn't only consist of complete albums) loaded.

Playlist:
Code: [Select]
%_playlist_number%. [%artist% - ]$if(%title%,%title%,%_filename%)



System tray tooltip:
Code: [Select]
[%artist% - ]$if(%title%,%title%,%_filename%)



File info display: default


Status bar (this one's really good IMHO):
Code: [Select]
$if(%title%,$if(%artist%,%artist%,No Artist)  |  %title%
                   $if(%tracknumber%,Track $num(%tracknumber%,2),-)
 |  $if(%album%,%album%,No Album)  |  $if(%date%,%date%,No Date),
%filename%)



Window title:
Code: [Select]
[%artist% - ]$if(%title%,%title%,%filename%)     '['%_foobar2000_version%']'


This is what it looks like.

Sorry for the line breaks in the [CODE ] elements, but that was the only way to preserve all the whitespace (it gets stripped out when put inside a [QUOTE ] or the normal post area).

[span style='font-size:8pt;line-height:100%'][EDIT][/span] Wow spase, you've just given me a great idea. I had never thought about mimicking columns like that, that of course would be the optimal solution!  [span style='font-size:8pt;line-height:100%'][/EDIT][/span]

Foobar2000 format strings

Reply #14
Quote
Wow spase, you've just given me a great idea. I had never thought about mimicking columns like that, that of course would be the optimal solution!

glad i could help  :-)

Foobar2000 format strings

Reply #15
Foobar2000 really needs a new script language with support for variables. It's a pain of in the ass to make "dynamic format strings" with the current script language. Just look at the complexity of the script code needed for determining if an artist/song/album should use %original-language-xxx% or just %xxx% :
Quote
$num(%_playlist_number%,3). $if(%original-language-artist%,%original-language-artist% - $if(%original-language-album%,'['%original-language-album%$if(%tracknumber%, #%tracknumber%'] ',),$if(%album%,'['%album%$if(%tracknumber%, #%tracknumber%'] ',),))$if(%original-language-title%,%original-language-title%,$if(%title%,%title%,)),$if(%artist%,%artist% - $if(%original-language-album%,'['%original-language-album%$if(%tracknumber%, #%tracknumber%'] ',),$if(%album%,'['%album%$if(%tracknumber%, #%tracknumber%'] ',),))$if(%original-language-title%,%original-language-title%,$if(%title%,%title%,)),%_filename%))

Foobar2000 format strings

Reply #16
Gee, this is great! This made me realise how good foobar2000 actually is, I'm really starting to like it now.

I think this is much improved compared to the minimalist scheme I posted above (because, as spase pointed out, it can just be turned into an ordinary "Artist - Title" display if you resize the window).

Scheme used:
Code: [Select]
$padcut(%_playlist_number%,4) C0C0C0| $padcut($if(%artist%,
%artist%,Unknown Artist),34) C0C0C0| $padcut($if(%title%,%title%,
%filename%),54) C0C0C0| $padcut([%album%],44) C0C0C0| $padcut
([%date%],4) C0C0C0|


Thanks again for the "inspiration".


The only thing I miss is a function that displays the values passed to it only if *all* of them exist, not just one (which [] does), badly tagged or tagless files could be handled better then.

 

Foobar2000 format strings

Reply #17
I leave the thing the way it is... "factory" default.
She is waiting in the air

Foobar2000 format strings

Reply #18
Quote
If you guys want to use a monospace font then just do a quote block but with [ font = courier ] (without spaces) inside the quote block, then end the font tag before closing the quote.


I tried the above to make my playlist number only in courier. How could you do this with the below string?

$num(%_playlist_number%,2).  $if(%artist%,%artist% - %title%,%_filename%)

Foobar2000 format strings

Reply #19
He was talking about forum functions, not foobar2000

Foobar2000 format strings

Reply #20
This thread is excellent, thanks for the many idea's.

But! 

Looking at Spase's screenshot I see all the column's are lined up, justified to the left. When I cut and paste the string into my Foobar, only the first two column's are .. what am I missing?
daefeatures.co.uk

Foobar2000 format strings

Reply #21
You've got to use a fixed-width font such as Lucida Console or Courier New for it to work properly.

Foobar2000 format strings

Reply #22
Ofcourse. D'oh!

Thanks.
daefeatures.co.uk

Foobar2000 format strings

Reply #23
Well, for what its worth, I only use a simple %artist% - %title% for the playlist. But for the status bar I use

Code: [Select]
| [Album: %Album% | ][Track: $num(%Tracknumber%,2) | ][Year: %date% | ][Genre: %genre% | ][Gain: $cut(%__replaygain_track_gain%,4)dB | ]


I like it because the separators make it clear, and they're only displayed if they're available.
.

Foobar2000 format strings

Reply #24
This page is really wide because of some [code]s, better put long code in
Quote
maybe everybody .
Anyway, useful thread!