User:Canar: Difference between revisions

From Hydrogenaudio Knowledgebase
No edit summary
 
(45 intermediate revisions by the same user not shown)
Line 1: Line 1:
[[User:Canar:Titleformat syntax guide]]
=foobar2000 ideas=
*alter fft window function for less-aliased spectrogram (completed)
*move folders along with files (completed)
*close and re-open files for file moves like is done for tag edits (asked, denied)
*multiple tab orientations for tabs ui element (asked, pending)
*[http://www.hydrogenaudio.org/forums/index.php?showtopic=58805 automatically fill values extensions] (asked, pending)
*auto-detect optimal bit-depth (completed)
*open containing folder on files in .zips (asked, pending)
=foobar2000 bugs=
#Drag and drop from Default UI to a device causing a copy will lock UI for the length of the file transfer.
#Ctrl-Alt-F1 is not bindable in Keyboard Shortcuts (asked, too much work)
#TITLE is ignored in Playback Statistics (asked, implementing)


:''Note 1: Tagz is not an official name.''
==Playback statistics-based autoplaylist order bug (won't fix)==
:''Note 2: The information in this article is outdated. Please see [[Foobar2000:Titleformat_Introduction|Titleformat Introduction]] and [[Foobar2000:Titleformat_Reference|Titleformat Reference]] for information on titleformatting in foobar2000 v0.9.''
#Take an autoplaylist containing "%play_count% IS 0".
#Play a song for less than a minute.
#Hit next.
#Listen to all of the next song.
#The song you skipped will be played!


:''This article deals with the simple syntax; please see [[foobar2000:Tagscript]] for info on the script-like syntax.''
=foobar2000 configuration strings=
A bunch of random stuff I keep stored to make setup faster. Signed so anyone can see when the last mod time was. Unless otherwise noted: [[User:Canar|Canar]] 05:19, 10 April 2011 (UTC)


So you want to learn how to use Tagz, eh? Well, then.


==Setting Up==
==foo_texttools now-playing spam==


The first thing to do is to disable the Columns UI. Use the Default User Interface, as it will immerse you fully in Tagz. Columns UI is very complex, and learning to use Tagz to configure it is difficult for advanced users, let alone new ones.
http://www.foobar2000.org/components/view/foo_texttools - becuz i am teh lazy


Next, familiarize yourself with the Properties dialog, which pops up when you right click on a playlist entry.
<code>$puts(sep,$select($add($mod($crc32(%playback_time%%title%),14),1),⇌,∿,▶,★,☮,☢,☠,☣,♩,♪,♫,♬,❤,⁂))/me $get(SEP) "%title%[ '['[%remix artist%$if($and(%remix artist%,%remix title%),''s) ][%remix title% ]Mix']']" by %artist% $get(SEP) [%date%:]%album%[/[%disc%.]%tracknumber%]$if(%genre%, $get(SEP) %genre%$if(%style%,/$meta_sep(style,/)))$if($or(%publisher%,%catalog number%), $get(SEP) [[%reissue date%:]%catalog number%]$if($and(%catalog number%,%publisher%),@)[%publisher%])</code>


In the ''Metadata'' group box, there should be many items of the form:
[[User:Canar|Canar]] 21:03, 10 April 2011 (UTC) -- FFFFFFFUUUUUUUUUUUU screwed up spacing


FIELD = text
==capitalization and normalization==
This is not exhaustive nor canonical; sometimes it will decapitalize things that I think should be capitalized. Furthermore, due to the nuances of $replace, using this in a masstagger script successfully means running data through it twice.


If there aren't any, you have a poorly tagged file. If you don't have well-tagged files, Tagz is going to do nothing for you. Tagz scripts only work properly on well-tagged files. Therefore, if you're going to customize this element of foobar2000, you need all of your files to be consistently tagged. In other words, if you're not obsessive-compulsive about perfect tagging, it's going to be hard to get your foobar to be as gorgeous as all of the screenshots you've seen, even if you use the Columns UI. I'm belaboring this point for a reason:
<code>$replace($caps2(%title%), A , a , An , an , The , the , And , and , But , but , Or , or , Nor , nor , At , at , By , by , For , for , From , from , In , in , Into , into , Of , of , Off , off , On , on , Onto , onto , Out , out , Over , over , To , to , Up , up , With , with , As , as , & , and )</code>


'''Proper tagging is the corner stone of making good-looking Tagz scripts.'''


For the purposes of this tutorial, I'm going to use the Metadata from a random track I was listening to while writing it.
==advanced/display==


ARTIST = Aphex Twin
===autocomplete fields===
<code>ARTIST+ALBUM ARTIST+COMPOSER+PERFORMER+FEATURING+REMIX ARTIST;GENRE+STYLE</code>


ALBUM = Donkey Rhubarb
===properties/standard fields===
<code>Album Artist=ALBUM ARTIST;Artist Name=ARTIST;Country=COUNTRY;Album Title=ALBUM;Date=DATE;Reissue Date=REISSUE DATE;Publisher=PUBLISHER;Catalog Number=CATALOG NUMBER;Disc Number=DISCNUMBER;Total Discs=TOTALDISCS;Track Number=TRACKNUMBER;Total Tracks=TOTALTRACKS;Vinyl Track=VINYLTRACK;Media=MEDIATYPE;Track Title=TITLE;Featuring=FEATURING;Remix Artist=REMIX ARTIST;Remix Title=REMIX TITLE;Genre=GENRE;Style=STYLE;Discogs Release ID=DISCOGS_RELEASE_ID;Quality=QUALITY;Comment=COMMENT</code>


TRACKNUMBER = 01/04
==default ui columns==


DATE = 1995
===track information===
<code>[%title% ['['[%remix artist%$if($and(%remix artist%,%remix title%),''s) ][%remix title% ]Mix']']][ '//' %track artist%][ feat. %featuring%]</code>


GENRE = Electronic
===cd sourced===
prints cd if likely cd-sourced, ie. number of samples is a multiple of 588, the cd sector size. ~0.2% chance of false positives


DISCID = 1e05c304
<code>$ifequal($mod(%length_samples%,588),0,CD,?)</code>


TITLE = Donkey Rhubarb
===mp3 sourced===
prints mp3 if likely unaccurate-length mp3-sourced, ie. number of samples is a multiple of 1152. ~0.1% chance of false positives. [[User:Canar|Canar]] 21:06, 10 April 2011 (UTC) -- fixed incorrect output


Incidentally, this is also an exceptional track, from a time period when Richard D. James was going from making very difficult, pretentious music to light, accessible music that was as complex as his pretentious efforts.
<code>$ifequal($mod(%length_samples%,1152),0,MP3,?)</code>


Here, already, we see that I'm a little obsessive about tagging. I've likely used the freeDB masstagger to grab the information about this EP, because the TRACKNUMBER information is in the format "xx/yy", where xx is the track number and yy is the total number of tracks on the disc. There's also the DISCID field, which generally also indicates use of the freeDB masstagger.
==default ui grouping==
<code>$puts(SEP,$select($add($mod($crc32(%album%%album artist%),14),1),⇌,∿,▶,★,☮,☢,☠,☣,♩,♪,♫,♬,❤,⁂)) %album artist% $get(SEP) %album% $get(SEP) %date% $get(SEP) [[%reissue date%:]%catalog number%]$if($and(%catalog number%,%publisher%),@)[%publisher%]) $get(SEP) $codec()[, %quality%]</code>


So, let's begin our Tagz adventure.
==foo_fileops file name pattern==
added reissue date, fixed spacing problem 04:03, 6 May 2011 (UTC)


==Beginner Level==
<code>$if2(%publisher%,Unknown or Independent)\[%catalog number% - ][%reissue date% - ]%album artist% - %date% - %album%\[%disc%.]%tracknumber%[ - %track artist%] - %title%[ '['[%remix artist%$if($and(%remix artist%,%remix title%),''s) ][%remix title% ]Mix']']</code>


Go to the [[Foobar2000:Preferences:Display#Title_Formatting|Title Formatting page in the Display section]] and select the Playlist tab. This will allow you to change what shows up in the playlist of the Default User Interface.
=Incomplete nonsense=
 
[[User:Canar:Titleformat syntax guide]]
Enter the string: ''%artist% - %title%'' This is a simple script that will return ''Aphex Twin - Donkey Rhubarb'' as the text representing that playlist entry. In fact, any one of the field names, when surrounded by % characters, will return the text associated with that field.
[[User:Canar:hurr]]
 
As you'd expect then, ''%artist% - %discid% - %title%'' would return ''Aphex Twin - 1e05c304 - Donkey Rhubarb''.
 
That's a kind of useless example though, because most people don't add DISCID fields to their files. So, for playlist entries without DISCID fields, that script will return ''Artist - ? - Title'' or something similar. This is kind of ugly, so let's make things a little more complex.
 
==Novice Level==
 
So DISCID isn't a common tag. Therefore, it'd be nice if we can just drop it altogether without leaving an ugly question mark in its place. So, if you'd like to have text displayed only if a field is present, there are ways to do that.
 
Enter the string:
 
''%artist%[ - %discid%] - %title''. This will return entries formatted like ''Aphex Twin - 1e05c304 - Donkey Rhubarb'' if DISCID is present and ''Aphex Twin - Donkey Rhubarb'' if it's not.
 
The little square brackets look inside themselves for a %field%. If that field contains text, their contents will be printed. If that field is empty, everything between the brackets will be omitted. They can be nested for complex scripts, but watch out! Things can get complex very quickly. Be sure you test as you go to make sure things behave as you expect them to.
 
(insert information about tech fields and non-standard fields here)
 
==Intermediate Level==
 
(information about functions to be inserted here)
 
==Default UI Tricks==
 
(information about $tab() and things here)
 
==Proficient Level==
 
(introduce use of variables)
 
==Advanced Level==
 
(complex scripting tricks like advanced use of $meta, alternate scripting interface)
 
==Complex Example Script==
 
Here is the script I use for spamming now-playing information to #noise on freenode:
 
<pre>
$puts(BTRT,$div($mul(%_filesize%,8),%_length_seconds%))
$puts(BTRT,$if2(%__bitrate%kbps,$ifgreater($len($get(BTRT)),4,$div($get(BTRT),1024)kbps,$get(BTRT)bps)))
$puts(RG,$left(%__replaygain_track_gain%,$add($strchr(%__replaygain_track_gain%,.),2))db)
$puts(SEP,$select($add($mod($rand(),5),1),||,'//',\\,>>,**))
 
$puts(DEF,
 
//title/artist stuff
//-=-=-=-=-=-=-=-=-=-
$if(%title%,
$get(SEP) ''%title%'' [by %artist% [feat. %featuring% ]])
 
$if(%rating%,'('Rating: $select(%rating%,Useless,Mediocre,Decent,Good,Excellent,Transcendent)')' )
 
 
 
//album/date/tracknumber stuff
//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
//check to see that tracknumber's greater than
$if($and(%album%%date%%tracknumber%,$and($greater(%tracknumber%,0),$greater(100,%tracknumber%))),
 
//core album/date/tracknumber info
$get(SEP) [$if(%album%,%date%:,date:%date%)]
[%album%]
$if($and(%album artist%,$not($stricmp(%album artist%,%artist%))),'('%album artist%')')
[$if(%album%%date%,/)[%disc%.]$num(%tracknumber%,2)] )
 
//if artist and/or title aren't present, print path info instead
$if($not($and(%artist%,%title%)),$if($stricmp($left(%_path_raw%,7),'http://'),%_path_raw%,$get(SEP) $directory(%_path%)\%_filename_ext% ))
 
//genre/codec info (assert: will always have codec info?)
//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
$get(SEP)
[<$meta_sep(genre,/)> ]
$codec()
$if(%__mod_channels%,'('%__mod_channels% chan'nels)')
$if($or($and(%_length%,%_filesize%),%__bitrate%),@$get(BTRT)
$if($and($stricmp($codec(),MP3),$not(%__extrainfo%)),'(cbr)'))
$if(%__replaygain_track_gain%,@$get(RG))
 
 
//status bar (enabled via display > show dynamic info)
//-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
$if($and(%_time_elapsed_seconds%,%_time_total_seconds%),$get(SEP) $progress(%_time_elapsed_seconds%, %_time_total_seconds%, 20,'['%_time_elapsed%']','='))
 
 
)
 
$select(1,
//1 - default
//2 - Mix .NFO release
//3 - np list
//4 - html version
//5 - caps default
 
/me $lower($get(DEF))
 
,
 
$num(%tracknumber%,2). $if(%album artist%,%artist% - )%title%[ feat. %featuring%] {%_length%}
 
,
 
''%title%'' by %artist% '('%album%')'
 
,
 
<li>%artist% - %title% {%_length%}</li>
 
,
 
/me $get(DEF)
 
)
</pre>
 
For the metadata given, it returns the following:
 
''/me // 'donkey rhubarb' by aphex twin // 1995:donkey rhubarb/01 // <electronic> musepack@150kbps@-6.31db''

Latest revision as of 16:32, 4 July 2012

foobar2000 ideas

  • alter fft window function for less-aliased spectrogram (completed)
  • move folders along with files (completed)
  • close and re-open files for file moves like is done for tag edits (asked, denied)
  • multiple tab orientations for tabs ui element (asked, pending)
  • automatically fill values extensions (asked, pending)
  • auto-detect optimal bit-depth (completed)
  • open containing folder on files in .zips (asked, pending)

foobar2000 bugs

  1. Drag and drop from Default UI to a device causing a copy will lock UI for the length of the file transfer.
  2. Ctrl-Alt-F1 is not bindable in Keyboard Shortcuts (asked, too much work)
  3. TITLE is ignored in Playback Statistics (asked, implementing)

Playback statistics-based autoplaylist order bug (won't fix)

  1. Take an autoplaylist containing "%play_count% IS 0".
  2. Play a song for less than a minute.
  3. Hit next.
  4. Listen to all of the next song.
  5. The song you skipped will be played!

foobar2000 configuration strings

A bunch of random stuff I keep stored to make setup faster. Signed so anyone can see when the last mod time was. Unless otherwise noted: Canar 05:19, 10 April 2011 (UTC)


foo_texttools now-playing spam

http://www.foobar2000.org/components/view/foo_texttools - becuz i am teh lazy

$puts(sep,$select($add($mod($crc32(%playback_time%%title%),14),1),⇌,∿,▶,★,☮,☢,☠,☣,♩,♪,♫,♬,❤,⁂))/me $get(SEP) "%title%[ '['[%remix artist%$if($and(%remix artist%,%remix title%),s) ][%remix title% ]Mix']']" by %artist% $get(SEP) [%date%:]%album%[/[%disc%.]%tracknumber%]$if(%genre%, $get(SEP) %genre%$if(%style%,/$meta_sep(style,/)))$if($or(%publisher%,%catalog number%), $get(SEP) [[%reissue date%:]%catalog number%]$if($and(%catalog number%,%publisher%),@)[%publisher%])

Canar 21:03, 10 April 2011 (UTC) -- FFFFFFFUUUUUUUUUUUU screwed up spacing

capitalization and normalization

This is not exhaustive nor canonical; sometimes it will decapitalize things that I think should be capitalized. Furthermore, due to the nuances of $replace, using this in a masstagger script successfully means running data through it twice.

$replace($caps2(%title%), A , a , An , an , The , the , And , and , But , but , Or , or , Nor , nor , At , at , By , by , For , for , From , from , In , in , Into , into , Of , of , Off , off , On , on , Onto , onto , Out , out , Over , over , To , to , Up , up , With , with , As , as , & , and )


advanced/display

autocomplete fields

ARTIST+ALBUM ARTIST+COMPOSER+PERFORMER+FEATURING+REMIX ARTIST;GENRE+STYLE

properties/standard fields

Album Artist=ALBUM ARTIST;Artist Name=ARTIST;Country=COUNTRY;Album Title=ALBUM;Date=DATE;Reissue Date=REISSUE DATE;Publisher=PUBLISHER;Catalog Number=CATALOG NUMBER;Disc Number=DISCNUMBER;Total Discs=TOTALDISCS;Track Number=TRACKNUMBER;Total Tracks=TOTALTRACKS;Vinyl Track=VINYLTRACK;Media=MEDIATYPE;Track Title=TITLE;Featuring=FEATURING;Remix Artist=REMIX ARTIST;Remix Title=REMIX TITLE;Genre=GENRE;Style=STYLE;Discogs Release ID=DISCOGS_RELEASE_ID;Quality=QUALITY;Comment=COMMENT

default ui columns

track information

[%title% ['['[%remix artist%$if($and(%remix artist%,%remix title%),s) ][%remix title% ]Mix']']][ '//' %track artist%][ feat. %featuring%]

cd sourced

prints cd if likely cd-sourced, ie. number of samples is a multiple of 588, the cd sector size. ~0.2% chance of false positives

$ifequal($mod(%length_samples%,588),0,CD,?)

mp3 sourced

prints mp3 if likely unaccurate-length mp3-sourced, ie. number of samples is a multiple of 1152. ~0.1% chance of false positives. Canar 21:06, 10 April 2011 (UTC) -- fixed incorrect output

$ifequal($mod(%length_samples%,1152),0,MP3,?)

default ui grouping

$puts(SEP,$select($add($mod($crc32(%album%%album artist%),14),1),⇌,∿,▶,★,☮,☢,☠,☣,♩,♪,♫,♬,❤,⁂)) %album artist% $get(SEP) %album% $get(SEP) %date% $get(SEP) [[%reissue date%:]%catalog number%]$if($and(%catalog number%,%publisher%),@)[%publisher%]) $get(SEP) $codec()[, %quality%]

foo_fileops file name pattern

added reissue date, fixed spacing problem 04:03, 6 May 2011 (UTC)

$if2(%publisher%,Unknown or Independent)\[%catalog number% - ][%reissue date% - ]%album artist% - %date% - %album%\[%disc%.]%tracknumber%[ - %track artist%] - %title%[ '['[%remix artist%$if($and(%remix artist%,%remix title%),s) ][%remix title% ]Mix']']

Incomplete nonsense

User:Canar:Titleformat syntax guide User:Canar:hurr