All pastes #830888 Raw Edit

Miscellany

public text v1 · immutable
#830888 ·published 2007-12-24 10:45 UTC
rendered paste body
[size=4]Appendix B: Text Tools (foo_utils)[/size]
[size=3]Introduction[/size]
Text Tools is a wonderful add-on that lets us generate lists with headers and footers. This can seriously speed up your upload process on this site, as I will demonstrate.

[size=3]Installation[/size]
First off, download and install the plugin "foo_utils" from [url=http://foosion.foobar2000.org/0.9/]this site[/url] (it's called "Utilities" and the download link is on the right, "component archive").

[size=3]Usage[/size]
Once Text Tools is installed you should have a new page in Foobar's preferences:

[img]http://www.uploadthis.co.uk/uploads/FZeroX/foobar_text_tools.png[/img]

You can put exactly the same things in here as in Title Formatting, with one exception: it doesn't put in line endings for you, so if you want your tracks to be on different lines, put "$crlf()" at the end of your formatting string (without the quotes), this function inserts a newline.

When you've put what you want into Text Tools, go to your playlist, select the tracks you want to create a listing for, and you should find a new option in the right-click context menu:

[img]http://www.uploadthis.co.uk/uploads/ZoFreX/foobar_text_tools_context.png[/img]

This copies the listings to the clipboard! Here's one I did earlier:
The Chemical Brothers
We Are The Night
[size=4]We Are The Night[/size]

[size=3]Description[/size]


[size=3]Tracklist[/size]
[b]Disc 1[/b]
[b]01.[/b] No Path To Follow (1:04)
[b]02.[/b] We Are The Night (6:33)
[b]03.[/b] All Rights Reversed (4:43)
[b]04.[/b] Saturate (4:50)
[b]05.[/b] Do It Again (5:33)
[b]06.[/b] Das Spiegel (5:52)
[b]07.[/b] The Salmon Dance (3:40)
[b]08.[/b] Burst Generator (6:53)
[b]09.[/b] A Modern Midnight Conversation (5:56)
[b]10.[/b] Battle Scars (5:50)
[b]11.[/b] Harpoons (2:25)
[b]12.[/b] The Pills Won't Help You Now (6:42)
[b]13.[/b] Seal (JPN BONUS TRACK) (4:40)
[b]14.[/b] No Need (JPN BONUS TRACK) (5:15)

The reason I have so much stuff in the header is to speed up uploading: I paste all of this into the description, then cut/paste artist and album into the right fields. If there are multiple cds I have the formatted "disc x" ready for me, if not I delete it. Other things you could add to save yourself time include %date%, %codec%, %codec_profile% and %bitrate%!

[size=4]Appendix C: More Advanced Formatting Strings[/size]
First stop: titleformat_help.html is your friend, it has a complete reference of all the functions available to you. If you start experimenting with them you'll find it's very easy to quickly put together really advanced stuff!

[size=3]Primitive Pretty Tracklistings[/size]
I did have two different tracklisting strings, as if the album is by various artists it's nice to have the artist's name in the listing as well - but this is superfluous if there is only one.

Single artist:
'['b']'$num(%tracknumber%,$ifgreater(%list_total%, 9, 2, 1)).'['/b']' %artist% - %title% '('%length%')'$crlf()

Various artists:
'['b']'$num(%tracknumber%,$ifgreater(%list_total%, 9, 2, 1)).'['/b']' %title% '('%length%')'$crlf()

Nothing much different to Formatting String 1, here. But switching between those was arduous and time-consuming, and I wouldn't have beaten [url=http://what.cd/userdetails.php?id=35718]fragmer[/url] in our race to upload Leftism if I was using arduous and time-consuming methods to create my tracklistings!

[size=3]Advanced Pretty Tracklistings[/size]
For those who don't care how it works and just want the goods, look no further:

$if($stricmp(%album artist%,various),'['b']'$num(%tracknumber%,$ifgreater(%list_total%, 9, 2, 1)).'['/b']' %artist% - %title% '('%length%')'$crlf(),'['b']'$num(%tracknumber%,$ifgreater(%list_total%, 9, 2, 1)).'['/b']' %title% '('%length%')'$crlf())

Intimidating, isn't it? Let's breakdown what's going on, starting with the new basic building blocks I've introduced:

$if(expression,value1,value2) - gives value1 if expression contains a present field, otherwise gives value2.
$stricmp(value1,value2) - compares value1 to value2. Returns something if they are the same, doesn't if they aren't. Isn't case sensitive.

Combined these two functions add incredible power to Foobar's title formatting! So if we did $if($stricmp(%album artist%,various),yes it is,no it isn't), this would output "yes it is" if the album artist is "Various" and "no it isn't" if it isn't. This then lets us choose between the two formatting strings automatically, and if you replace "yes it is" and "no it isn't" with the two different formatting strings given above, you will find you have the same as the intimidating all-in-one string.

Sample outputs:
From The Chemical Brothers - We Are The Night we get:
[b]1.[/b] No Path To Follow (1:04)
[b]2.[/b] We Are The Night (6:33)

And from Various - Hackers we get:
[b]1.[/b] Kruder & Dorfmeister - Original Bedroom Rockers (6:07)
[b]2.[/b] Underworld - Cowgirl (8:56)

That's all for now, folks!

[size=3][b]Please feel free to post any suggestions, questions, or issues you have regarding this tutorial as replies (I'd prefer replies to this thread to private messages). Thanks![/b][/size]