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: sorting artists with 'the' at beginning (Read 27821 times) previous topic - next topic
0 Members and 1 Guest are viewing this topic.

sorting artists with 'the' at beginning

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)

sorting artists with 'the' at beginning

Reply #1
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

 

sorting artists with 'the' at beginning

Reply #2
In your Artist column sort order, replace %artist% with -

Code: [Select]
$if($stricmp($left(%artist%,3),'The'),
$right(%artist%,$sub($len(%artist%),4))
,
[%artist%]
)

sorting artists with 'the' at beginning

Reply #3
Thanks both of you, it worked!


sorting artists with 'the' at beginning

Reply #5
In your Artist column sort order, replace %artist% with -

Code: [Select]
$if($stricmp($left(%artist%,3),'The'),
$right(%artist%,$sub($len(%artist%),4))
,
[%artist%]
)
Ever listened to Therion?

Code: [Select]
$if($stricmp($left(%artist%,4),'The '),
$right(%artist%,$sub($len(%artist%),4))
,
[%artist%]
)

sorting artists with 'the' at beginning

Reply #6
Thanks to all, I had been looking for a way to do this. However, is there a way to do it in the albumlist?

sorting artists with 'the' at beginning

Reply #7
Ever listened to Therion?

Code: [Select]
$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: [Select]
$if($stricmp($left(%artist%,4),'The '),
$right(%artist%,$sub($len(%artist%),5))
,
[%artist%]
)

sorting artists with 'the' at beginning

Reply #8
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: [Select]
$if($stricmp($left(%album artist%,4),'The '),$right(%album artist%,$sub($len(%artist%),4))', 'The,[%album artist%])

sorting artists with 'the' at beginning

Reply #9
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: [Select]
$if($stricmp($left(%album artist%,4),'The '),$right(%album artist%,$sub($len(%artist%),4))', 'The,[%album artist%])



Worked, thank you!

sorting artists with 'the' at beginning

Reply #10
In your Artist column sort order, replace %artist% with -

Code: [Select]
$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: [Select]
$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

sorting artists with 'the' at beginning

Reply #11
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: [Select]
$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: [Select]
$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: [Select]
%ALBUMARTIST% - %DATE% - %ALBUM% - %DISCNUMBER% - %TRACKNUMBER% - %TITLE%

Many thanks.

sorting artists with 'the' at beginning

Reply #12
Quote
$if($stricmp($left(%artist%,4),'The '),$right(%artist%,$sub($len(%artist%),4))', The'


Why not $swapprefix(%artist%) ?

sorting artists with 'the' at beginning

Reply #13
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.
elevatorladylevitateme


sorting artists with 'the' at beginning

Reply #15
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.
elevatorladylevitateme

sorting artists with 'the' at beginning

Reply #16
maybe I'm stupid or yea accentually stupid.

I want to sort without THE in this column.




plz help I'm going nuts

sorting artists with 'the' at beginning

Reply #17
Click Me

sorting artists with 'the' at beginning

Reply #18
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.
It's only audiophile if it's inconvenient.


sorting artists with 'the' at beginning

Reply #20
[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.
elevatorladylevitateme

sorting artists with 'the' at beginning

Reply #21
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.

sorting artists with 'the' at beginning

Reply #22
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: [Select]
$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.

sorting artists with 'the' at beginning

Reply #23
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.

sorting artists with 'the' at beginning

Reply #24
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.