Help - Search - Members - Calendar
Full Version: Finding the ideal sort string
Hydrogenaudio Forums > Hosted Forums > foobar2000 > Support - (fb2k)
mutok
I'm trying to get my playlist sorted properly and I haven't been able to get it where I want it in 0.9. I used to use something like
CODE
$if(%album artist%,%album artist%|%date%|%album%|$num(%tracknumber%,3)|%title%,$if($strcmp($left(%artist%,4),The ),$right(%artist%,$sub($len(%artist%),4))', 'The,%artist%)|%DATE%|%ALBUM%|$num(%TRACKNUMBER%,3)|%TITLE%)

but it's not working properly now.

Sort hierarchy should be like this:

1. Album artist, disregarding an initial "The " (A-Z)
2. Artist, disregarding an initial "The " (A-Z. For instance, The Beatles should come before Beck)
3. Composer (A-Z)
4. Date (old-new)
5. Album title (A-Z)
6. Tracknumber with padding zeros (001-xxx)
7. Title
(and maybe, 8. Filename, if all else fails)

Any suggestions? What sort strings do you use?

Thanks!
lav-chan
I didn't test, but this might do what you want (remove the line breaks when you try to use it, obviously):

$if($meta(album artist,0),$if($stricmp($left($meta(album artist,0),4),'the '),
$substr($meta(album artist,0),5,$len($meta(album artist,0))),$meta(album artist,0)),
$if($meta(artist,0),$if($stricmp($left($meta(artist,0),4),'the '),$substr($meta(artist,0),5,$len($meta(artist,0)))
,$meta(artist,0)),$meta(composer,0)) %date% %album% $num(%tracknumber%,3) %title% %_filename_ext%





I personally use this:

$if($or($or($stricmp(%codec%,MID),$stricmp($codec,MIDI)),%garbage%),garbage)
$if($meta(album artist),$meta(album artist),$if(%DBARTIST%,%DBARTIST%,$meta(artist)))
%ALBUM% %disc% %_directoryname% $num(%TRACKNUMBER%,3) %_filename% %TITLE%


(the garbage tag just means it's a crappy rip or whatever that i don't consider part of my 'official' music collection)
mutok
Thanks, but unless I did something incorrectly in implementing it, that's not working. It sorted things very very strangely.
user posted image

Also, if anyone wants to give it a shot, I'd like my title column to display both the artist and title if there is an album artist. How do you identify tags without having it go down the substitution chain?
Fifoxtasy
QUOTE(mutok @ Apr 2 2006, 12:12 AM)
Also, if anyone wants to give it a shot, I'd like my title column to display both the artist and title if there is an album artist.


how about $if(%albumartist%,%artist% - %title%,%title%)
mutok
QUOTE(Fifoxtasy @ Apr 1 2006, 02:59 PM)
QUOTE(mutok @ Apr 2 2006, 12:12 AM)
Also, if anyone wants to give it a shot, I'd like my title column to display both the artist and title if there is an album artist.


how about $if(%albumartist%,%artist% - %title%,%title%)
*



Well, %album artist% now goes to %artist% if there isn't any contents of the field, and that leads to redundancy. I just don't know how to do that.
david_dl
The sort string I used for 0.8.3 (similar to yours) still works fine in 0.9, but I can't for the life of me work out how to get the album list to use it (the albumlist panel in 0.8.3 has a 'custom sort order' option, the new one doesn't seem to.
lav-chan
QUOTE(mutok @ Apr 1 2006, 02:12 PM)
Thanks, but unless I did something incorrectly in implementing it, that's not working. It sorted things very very strangely.
*

Oh, sorry, i forgot a parenthesis. Stick a ) at the end of the first long string (so instead of ...$meta(composer,0)) %date%... it should be ...$meta(composer,0))) %date%...). That should fix it.

Also i suppose you might want to replace the %title% in the string i gave you before with $meta(title,0) ('cause otherwise foobar will return the file name if the title isn't present).

QUOTE(mutok @ Apr 1 2006, 02:12 PM)
Also, if anyone wants to give it a shot, I'd like my title column to display both the artist and title if there is an album artist. How do you identify tags without having it go down the substitution chain?
*

I don't use multiple values for the same field name, so what works for me is just using $meta(YOURFIELD,0), which tells foobar to specifically pick the first (and, on my files, the only) value of YOURFIELD and then do no remapping. So instead of using %album artist%, use $meta(album artist,0).

To display artist and track for files with album artist you could do:

$if($meta(album artist,0),$meta(artist,0)' - '$meta(title,0),$meta(title,0))
Sverae
QUOTE(lav-chan @ Apr 1 2006, 09:59 AM)
I didn't test, but this might do what you want (remove the line breaks when you try to use it, obviously):

CODE
$if($meta(album artist,0),$if($stricmp($left($meta(album artist,0),4),'the '),
$substr($meta(album artist,0),5,$len($meta(album artist,0))),$meta(album artist,0)),
$if($meta(artist,0),$if($stricmp($left($meta(artist,0),4),'the '),$substr($meta(artist,0),5,$len($meta(artist,0)))
,$meta(artist,0)),$meta(composer,0))) %date% %album% $num(%tracknumber%,3) %title% %_filename_ext%

*



Coincidentally, I was having the issue of sorting my music in 0.9. This string worked pretty well for a number of my albums, but there's one problem, and I'm not entirely certain as to how to tackle it.

I have one soundtrack, 'Kong in Concert', which has numerous artists who have worked together on it.
Unfortunately for me, that sort string won't pull the albums together if they have different artist names, and instead, just leaves them scattered everywhere.

This issue also affects a few of my other albums.

I'm not all that good with the formatting strings, though, so I'm not entirely sure what I'd be changing so that it would sort by album, disc number, track number, rather than by whatever means is above.

I've been trying to figure it out, but ended up manually sorting them back before 0.9... and that gets tiring. smile.gif
lav-chan
Do you not use the %album artist% field then? Or do you use another tag for various artists? 'Cause it seems to me if you had 'ALBUM ARTIST=various artists' in there it'd work fine.

If you want it to sort by album name, though, just use:

%album% $num(%tracknumber%,3) %title% %_filename_ext%


edit: wrong tag wups
Insolent
Try this (if I understand correctly what you're trying to do):

CODE
$if($stricmp($cut(%album artist%,4),'The '),$cut(%album artist%,4),%album artist%) - [%composer% - ]%date% - %album% - $num(%tracknumber%,3) - %title%


%title% already falls back to filename if the TITLE tag isn't present.

QUOTE(mutok @ Apr 2 2006, 10:28 AM)
QUOTE(Fifoxtasy @ Apr 1 2006, 02:59 PM)
QUOTE(mutok @ Apr 2 2006, 12:12 AM)
Also, if anyone wants to give it a shot, I'd like my title column to display both the artist and title if there is an album artist.


how about $if(%albumartist%,%artist% - %title%,%title%)
*



Well, %album artist% now goes to %artist% if there isn't any contents of the field, and that leads to redundancy. I just don't know how to do that.
*


%album artist% = $if3($meta(album artist),$meta(artist),$meta(composer),$meta(performer),)

Basically, %album artist% checks for the ALBUM ARTIST, ARTIST, COMPOSER and PERFORMER tags (in that order) and displays the first one it finds.

%track artist% = $if($meta(album artist),[$meta(artist)])

This tag displays the ARTIST tag if the ALBUM ARTIST tag is present. So, to display the artist if album artist is present:

CODE
[%track artist% - ]%title%
mutok
Worked great, thanks!
acedriver
In 0.8.3, I use %singletrack% to specify a single. when i use $if(%singletrack%,0,1) infront of a sort string, foobar will list singles above a full album tracks.

But in 0.9 this method does not work. Any suggestion?

I did try this:
CODE
$meta(singletrack,0) $if($meta(album artist,0),$meta(album artist,0),$meta(artist,0)) $num(%date%,4) %album% %disc% %_directoryname% $num(%tracknumber%,3) %_filename% %title%

anything wrong with it?
Audionut
%PATH% - %ALBUM% - %DISCNUMBER% - %TRACKNUMBER%

I have all of my music collection sorted by artist and album, under the one directory. I also have all files properly tagged.

user posted image
david_dl
CODE
$if($stricmp($left(%artist%,4),The ),$right(%artist%,$sub($len(%artist%),4)),%artist%) - %date% - %album% - $num(%discnumber%,3) - $num(%tracknumber%,3) - %title%


Works perfectly for me. I have no 'various artists' stuff, for classical music I use the COMPOSER tag, but this is not used for sorting, only for display next to TITLE in my playlist view.
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.