sorting artists with 'the' at beginning |
This is NOT a tech support forum.
Tech support questions go to foobar2000 Tech Support forum instead.
See also: Hydrogenaudio Terms of Service.
![]() ![]() |
sorting artists with 'the' at beginning |
Jan 11 2007, 19:05
Post
#1
|
|
|
Group: Members Posts: 2 Joined: 22-December 06 Member No.: 38907 |
Hi.. I am trying to find out how foobar can display artist who have 'the' at the beginning, e.g. The Smiths, to display at 'S' rather than 'T', like iTunes does.
I'm sure it's quite a simple fix... but I just cant seem to find out how to do it.... GRRR Anyone have any ideas ...? (apart from having to change to 'Smiths, The) |
|
|
|
Jan 11 2007, 19:28
Post
#2
|
|
|
Group: Members Posts: 22 Joined: 20-November 06 Member No.: 37798 |
Hi.. I am trying to find out how foobar can display artist who have 'the' at the beginning, e.g. The Smiths, to display at 'S' rather than 'T', like iTunes does. I'm sure it's quite a simple fix... but I just cant seem to find out how to do it.... GRRR Anyone have any ideas ...? (apart from having to change to 'Smiths, The) I have made something like this: I created a tag named: %THE% with the value "The". The tag I applied only for the artist with The, like THE Prodigy, THE Cranberries, etc... In the tag field named %ARTIST% I deleted "The". So for "The Prodigy" I have only "Prodigy". Than in the ARTIST column for ColumnUI I have this scripts codes: For DISPLAY: [%THE% ]%artist% For SORT field: %artist%%album%%DISCNUMBER% Sorry my English, is not my native language |
|
|
|
Jan 11 2007, 19:36
Post
#3
|
|
|
Group: Members Posts: 382 Joined: 20-December 06 Member No.: 38861 |
In your Artist column sort order, replace %artist% with -
CODE $if($stricmp($left(%artist%,3),'The'),
$right(%artist%,$sub($len(%artist%),4)) , [%artist%] ) This post has been edited by wraithdu: Jan 11 2007, 19:39 |
|
|
|
Jan 11 2007, 21:09
Post
#4
|
|
|
Group: Members Posts: 2 Joined: 22-December 06 Member No.: 38907 |
Thanks both of you, it worked!
|
|
|
|
Jan 12 2007, 10:20
Post
#5
|
|
|
Group: Members Posts: 257 Joined: 27-September 05 Member No.: 24739 |
|
|
|
|
Jan 12 2007, 11:06
Post
#6
|
|
|
Group: Members Posts: 253 Joined: 20-April 06 Member No.: 29815 |
In your Artist column sort order, replace %artist% with - Ever listened to Therion? CODE $if($stricmp($left(%artist%,3),'The'), $right(%artist%,$sub($len(%artist%),4)) , [%artist%] ) CODE $if($stricmp($left(%artist%,4),'The '),
$right(%artist%,$sub($len(%artist%),4)) , [%artist%] ) |
|
|
|
Jan 12 2007, 18:45
Post
#7
|
|
|
Group: Members Posts: 37 Joined: 7-September 04 Member No.: 16848 |
Thanks to all, I had been looking for a way to do this. However, is there a way to do it in the albumlist?
|
|
|
|
Jan 12 2007, 18:46
Post
#8
|
|
|
Group: Members Posts: 24 Joined: 1-August 06 Member No.: 33526 |
Ever listened to Therion? CODE $if($stricmp($left(%artist%,4),'The '), $right(%artist%,$sub($len(%artist%),4)) , [%artist%] ) Shouldn't you then take the substring of %artist% starting at 5, instead of 4? CODE $if($stricmp($left(%artist%,4),'The '),
$right(%artist%,$sub($len(%artist%),5)) , [%artist%] ) |
|
|
|
Jan 12 2007, 22:46
Post
#9
|
|
|
Group: Members Posts: 253 Joined: 20-April 06 Member No.: 29815 |
QUOTE Shouldn't you then take the substring of %artist% starting at 5, instead of 4? $sub != substring. It's "subtract". This operator is used here for evaluating the number of symbols we take from the original string (starting from the right, hence the $right operator).QUOTE Thanks to all, I had been looking for a way to do this. However, is there a way to do it in the albumlist? I think so.Replace the %album artist% in the desired view strings with CODE $if($stricmp($left(%album artist%,4),'The '),$right(%album artist%,$sub($len(%artist%),4))', 'The,[%album artist%])
This post has been edited by Hakubo: Jan 12 2007, 22:50 |
|
|
|
Jan 13 2007, 03:49
Post
#10
|
|
|
Group: Members Posts: 37 Joined: 7-September 04 Member No.: 16848 |
QUOTE Shouldn't you then take the substring of %artist% starting at 5, instead of 4? $sub != substring. It's "subtract". This operator is used here for evaluating the number of symbols we take from the original string (starting from the right, hence the $right operator).QUOTE Thanks to all, I had been looking for a way to do this. However, is there a way to do it in the albumlist? I think so.Replace the %album artist% in the desired view strings with CODE $if($stricmp($left(%album artist%,4),'The '),$right(%album artist%,$sub($len(%artist%),4))', 'The,[%album artist%]) Worked, thank you! |
|
|
|
Jan 13 2007, 10:29
Post
#11
|
|
![]() Group: Members Posts: 959 Joined: 27-May 05 Member No.: 22329 |
In your Artist column sort order, replace %artist% with - CODE $if($stricmp($left(%artist%,4),'The '), $right(%artist%,$sub($len(%artist%),4))', The' , [%artist%] ) Edited for betterness. :] Because your previous code include anything that stated with "The" like These or Their or whatever. CODE $if($stricmp($left(%album artist%,4),'The '), $right(%artist%,$sub($len(%album artist%),4))', The' , [%album artist%] ) Also for sorting you'd want to use album artist, because that defaults to %artist% if there's no actualy %album artist% -------------------- hi
|
|
|
|
Jan 4 2009, 16:20
Post
#12
|
|
|
Group: Members Posts: 64 Joined: 25-March 08 Member No.: 52287 |
I actually can't get this code to work. I wonder if someone can help?
I've input the following into the 'Sort' tab section of my 'Artist Name' column: CODE $if($stricmp($left(%artist%,4),'The '), $right(%artist%,$sub($len(%artist%),4))', The' , [%artist%] ) ... and I've made sure the 'Use custom sort spec' checkbox is ticked for that one column only. The 'Meta field to edit' value of the column is 'ARTIST', and the 'Display' tab looks like this: CODE $if($strcmp(%albumartist%,'Various Artists'), 'Various -' [%album%] , [%albumartist%] ) Clicking Apply and/or Save All does nothing. The custom 'Sort by ...' code I am using from the edit menu looks like this: CODE %ALBUMARTIST% - %DATE% - %ALBUM% - %DISCNUMBER% - %TRACKNUMBER% - %TITLE% Many thanks. This post has been edited by David Heath: Jan 4 2009, 16:21 -------------------- "The more emotion I put into it, the harder I rock ..."
|
|
|
|
Jan 4 2009, 16:28
Post
#13
|
|
![]() Group: Developer Posts: 2977 Joined: 2-December 07 Member No.: 49183 |
QUOTE $if($stricmp($left(%artist%,4),'The '),$right(%artist%,$sub($len(%artist%),4))', The' Why not $swapprefix(%artist%) ? |
|
|
|
Jan 4 2009, 21:38
Post
#14
|
|
![]() Group: FB2K Moderator Posts: 4321 Joined: 1-November 06 From: Cincinnati Member No.: 37036 |
I actually can't get this code to work. I wonder if someone can help? Things have been added to make this easier since two years ago. -------------------- "It must be 'Take A Worm For A Walk' week!"
|
|
|
|
Jan 4 2009, 22:51
Post
#15
|
|
|
Group: Members Posts: 64 Joined: 25-March 08 Member No.: 52287 |
I actually can't get this code to work. I wonder if someone can help? Things have been added to make this easier since two years ago. Ah. Would you mind pointing me in the right direction? -------------------- "The more emotion I put into it, the harder I rock ..."
|
|
|
|
Jan 4 2009, 23:07
Post
#16
|
|
![]() Group: FB2K Moderator Posts: 4321 Joined: 1-November 06 From: Cincinnati Member No.: 37036 |
No need to repeat what lvqcl already said.
I was just explaining why the earlier posters in this thread didn't use the very-simple-to-use $swapprefix() function. This post has been edited by shakey_snake: Jan 5 2009, 03:06 -------------------- "It must be 'Take A Worm For A Walk' week!"
|
|
|
|
Mar 21 2009, 18:15
Post
#17
|
|
|
Group: Members Posts: 2 Joined: 21-March 09 Member No.: 68234 |
maybe I'm stupid or yea accentually stupid.
I want to sort without THE in this column. ![]() plz help I'm going nuts |
|
|
|
Mar 21 2009, 18:42
Post
#18
|
|
![]() Group: Members Posts: 20 Joined: 27-October 07 From: Langenargen Member No.: 48247 |
|
|
|
|
Apr 4 2009, 14:35
Post
#19
|
|
![]() Group: Members (Donating) Posts: 757 Joined: 12-March 05 From: Kiel, Germany Member No.: 20561 |
I had the same need, but I also wanted to have surnames in front of first names for sorting, e.g. "Dylan, Bob" instead of "Bob Dylan". My only solution so far is to use a ARTIST SORTNAME meta field (like proposed by musicbrainz, if I remember correctly). For "The" bands I can fill ARTIST SORTNAME easily with the swapprefix command.
-------------------- Audiophiles live in constant fear of jitter.
|
|
|
|
Apr 5 2009, 17:32
Post
#20
|
|
|
Group: Members Posts: 2 Joined: 21-March 09 Member No.: 68234 |
The problem for me, I have no idea were to put the $swapprefix(%artist%) I just began using foobar still finding my way around |
|
|
|
Apr 5 2009, 18:16
Post
#21
|
|
![]() Group: FB2K Moderator Posts: 4321 Joined: 1-November 06 From: Cincinnati Member No.: 37036 |
[main menu]->Edit->sort->sort by
or [Preferences]->Display->Default User interface->Playlist View->Columns, then add the column to your view, then click that column's header to sort by it. This post has been edited by shakey_snake: Apr 5 2009, 18:17 -------------------- "It must be 'Take A Worm For A Walk' week!"
|
|
|
|
Apr 5 2009, 19:38
Post
#22
|
|
|
Group: Members Posts: 132 Joined: 6-December 08 From: Italy Member No.: 63998 |
I had the same need, but I also wanted to have surnames in front of first names for sorting, e.g. "Dylan, Bob" instead of "Bob Dylan". My only solution so far is to use a ARTIST SORTNAME meta field (like proposed by musicbrainz, if I remember correctly). For "The" bands I can fill ARTIST SORTNAME easily with the swapprefix command. That's impossible to achieve automatically, since FB2K doesn't see name and surname, but a series of words. It would be very simple if all your artists have one word for name and one word for surname, but that's not the totality of the possibilities. But since this is the majority, you could set a script for this type of artists to fill ARTIST SORTNAME, and then manually fill the field for the remaining ones. |
|
|
|
Nov 13 2009, 22:55
Post
#23
|
|
![]() Group: Members Posts: 39 Joined: 8-October 08 From: Virginia, USA Member No.: 59765 |
Here's a script I came up with; I don't know its usability outside of Columns UI filter panels, which is where I'm using it, but all the same:
CODE $if($stricmp($left(%band%,4),'The '),$right(%band%,$sub($len(%band%),4))', The',[%band%]) It takes the first four characters, looking for "The" followed by a single space to avoid messing up bands whose first word begins with "The", and if found, it renders %BAND% (replace with the field of your choice) with a trailing ", The". For example, "The Birthday Massacre" would become "Birthday Massacre, The". Seems to be working pretty well, and I haven't noticed any adverse effects so far. No way I can find to display one thing and sort by another using a single script. |
|
|
|
Nov 13 2009, 23:12
Post
#24
|
|
|
Group: Members Posts: 585 Joined: 30-July 07 Member No.: 45750 |
By the way if you're using an up to date version you can just use %swapprefix(%artist%) or $swapprefix(%artist%,The) if you want to just swap 'The ' and not 'A '.
One way to have independent sort and display is to use facets (for default UI only), where you can create a second column with your sort script and shrink it down so you can't see it. Another way is to use the library tree component and its $nodisplay() function. If you want to use filters you can do something with the colour codes, you can make the text you want to sort by invisible, although it will still have the same width- but you can probably take the first 3 or 4 characters of that without effecting your sorting. |
|
|
|
Nov 14 2009, 21:14
Post
#25
|
|
![]() Group: Members Posts: 39 Joined: 8-October 08 From: Virginia, USA Member No.: 59765 |
By the way if you're using an up to date version you can just use %swapprefix(%artist%) or $swapprefix(%artist%,The) if you want to just swap 'The ' and not 'A '. One way to have independent sort and display is to use facets (for default UI only), where you can create a second column with your sort script and shrink it down so you can't see it. Another way is to use the library tree component and its $nodisplay() function. If you want to use filters you can do something with the colour codes, you can make the text you want to sort by invisible, although it will still have the same width- but you can probably take the first 3 or 4 characters of that without effecting your sorting. Yes, I'm aware of the $swapprefix function, but I thought I would post the full script for those that may not be able to use the "easy" way, since I saw somewhere in the thread "I was just explaining why the earlier posters in this thread didn't use the very-simple-to-use $swapprefix() function" and assumed it wasn't an option. |
|
|
|
![]() ![]() |
|
Lo-Fi Version | Time is now: 18th May 2013 - 11:43 |