HydrogenAudio

Hosted Forums => foobar2000 => General - (fb2k) => Topic started by: dmented7 on 2007-01-11 18:05:41

Title: sorting artists with 'the' at beginning
Post by: dmented7 on 2007-01-11 18:05:41
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)
Title: sorting artists with 'the' at beginning
Post by: Octavian on 2007-01-11 18:28:36
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
Title: sorting artists with 'the' at beginning
Post by: wraithdu on 2007-01-11 18:36:47
In your Artist column sort order, replace %artist% with -

Code: [Select]
$if($stricmp($left(%artist%,3),'The'),
$right(%artist%,$sub($len(%artist%),4))
,
[%artist%]
)
Title: sorting artists with 'the' at beginning
Post by: dmented7 on 2007-01-11 20:09:27
Thanks both of you, it worked!
Title: sorting artists with 'the' at beginning
Post by: 2Pacalypse on 2007-01-12 09:20:17
Thanks both of you, it worked!


hmm i tried in on the group display in scpl and it didnt work
Title: sorting artists with 'the' at beginning
Post by: Hakubo on 2007-01-12 10:06:40
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%]
)
Title: sorting artists with 'the' at beginning
Post by: Funkdude on 2007-01-12 17:45:11
Thanks to all, I had been looking for a way to do this. However, is there a way to do it in the albumlist?
Title: sorting artists with 'the' at beginning
Post by: Valdoran on 2007-01-12 17:46:22
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%]
)
Title: sorting artists with 'the' at beginning
Post by: Hakubo on 2007-01-12 21:46:50
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%])
Title: sorting artists with 'the' at beginning
Post by: Funkdude on 2007-01-13 02:49:24
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!
Title: sorting artists with 'the' at beginning
Post by: tool++ on 2007-01-13 09:29:48
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%
Title: sorting artists with 'the' at beginning
Post by: David Heath on 2009-01-04 15:20:26
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.
Title: sorting artists with 'the' at beginning
Post by: lvqcl on 2009-01-04 15:28:46
Quote
$if($stricmp($left(%artist%,4),'The '),$right(%artist%,$sub($len(%artist%),4))', The'


Why not $swapprefix(%artist%) ?
Title: sorting artists with 'the' at beginning
Post by: shakey_snake on 2009-01-04 20:38:20
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.
Title: sorting artists with 'the' at beginning
Post by: David Heath on 2009-01-04 21:51:08

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?
Title: sorting artists with 'the' at beginning
Post by: shakey_snake on 2009-01-04 22:07:33
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.
Title: sorting artists with 'the' at beginning
Post by: Klaustrofobia on 2009-03-21 17:15:53
maybe I'm stupid or yea accentually stupid.

I want to sort without THE in this column.

(http://img26.imageshack.us/img26/3739/foo.jpg)


plz help I'm going nuts
Title: sorting artists with 'the' at beginning
Post by: MasterT on 2009-03-21 17:42:30
Click Me (http://wiki.hydrogenaudio.org/index.php?title=Foobar2000:Titleformat_Reference#.24stripprefix.28x.29)
Title: sorting artists with 'the' at beginning
Post by: Kohlrabi on 2009-04-04 14:35:57
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.
Title: sorting artists with 'the' at beginning
Post by: Klaustrofobia on 2009-04-05 17:32:58
Click Me (http://wiki.hydrogenaudio.org/index.php?title=Foobar2000:Titleformat_Reference#.24stripprefix.28x.29)


The problem for me, I have no idea were to put the $swapprefix(%artist%) I just began using foobar still finding my way around
Title: sorting artists with 'the' at beginning
Post by: shakey_snake on 2009-04-05 18:16:08
[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.
Title: sorting artists with 'the' at beginning
Post by: novembre on 2009-04-05 19:38:58
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.
Title: sorting artists with 'the' at beginning
Post by: Soviet Commissar on 2009-11-13 21:55:47
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.
Title: sorting artists with 'the' at beginning
Post by: TomBarlow on 2009-11-13 22:12:57
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.
Title: sorting artists with 'the' at beginning
Post by: Soviet Commissar on 2009-11-14 20:14:26
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.
Title: sorting artists with 'the' at beginning
Post by: hibby50 on 2010-07-06 17:16:09
can this be done in the filter view as well?
Title: sorting artists with 'the' at beginning
Post by: Spoonie_B on 2010-07-12 21:06:42
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.



I'm new at this, but I believe you could also select all your tracks, go to Properties, select %artist% and right-click to Edit, CTRL-A to select all, and paste into Excel.  This will create a one column display of all your artists.  Then you can use Excel functions to create your LAST, FIRST protocol and when this is done for all artists and in one column, copy the column.  Back in foobar, go back to Properties, add a field called ARTIST SORTNAME or whatever, right-click it and choose Automatically Fill Values.  Select "Clipboard: Line Per Track" from "Source" and type in %ARTIST SORTNAME% in Pattern.  As long as your selection for Properties is exactly the same as it was when you copied out the %artist% field, everything should match up.  If something goes wrong, you could just remove or clear the field and try again.

I might give this a shot.
Title: sorting artists with 'the' at beginning
Post by: 3thereal on 2010-07-14 16:20:17
can this be done in the filter view as well?


That's the same reason I found this post. Anyone? The playlist view in columns UI already organizes things fine, but anything that starts with "The" gets sorted into the T's in filter view, which seems like a huge oversight. I can't see a way to modify how the filters sort, I just started trying out foobar2000 today.
Title: Re: sorting artists with 'the' at beginning
Post by: belphegore on 2016-04-26 18:38:01
Any ideas how it is possible to expand this:
Quote
$if($stricmp($left(%album artist%,4),'The '),
$right(%artist%,$sub($len(%album artist%),4))', The'
,
[%album artist%]
)
so that "Die" or "Das", for german bands, also moved to the end of the name?
Title: Re: sorting artists with 'the' at beginning
Post by: davideleo on 2016-04-26 19:49:46
Any ideas how it is possible to expand this:
Quote
$if($stricmp($left(%album artist%,4),'The '),
$right(%artist%,$sub($len(%album artist%),4))', The'
,
[%album artist%]
)
so that "Die" or "Das", for german bands, also moved to the end of the name?


Use the $swapprefix (http://wiki.hydrogenaud.io/index.php?title=Foobar2000:Title_Formatting_Reference#.24swapprefix.28x.2Cprefix1.2Cprefix2.2C....29) function:

Code: [Select]
$swapprefix(%album artist%,The,Die,Das)
Title: Re: sorting artists with 'the' at beginning
Post by: belphegore on 2016-04-26 20:46:31
Works nicely. Thank you very much!

I also would like see this sorting over UPnP.  ;)  Do you know how the Media Libery Tree must be edited for this?
"The" and "A" is no problem, because Foobar already has a swap option for this in artist names under the UPnP/Server/Contents section. But of course there is nothing for "Die" or "Das"
 
Title: Re: sorting artists with 'the' at beginning
Post by: davideleo on 2016-04-26 21:01:01
I also would like see this sorting over UPnP.  ;)

I don't know what you mean. Are you talking about the foo_upnp component?
Title: Re: sorting artists with 'the' at beginning
Post by: belphegore on 2016-04-27 18:37:32
Yes, I'm using Foobar also as Media Server.
Title: Re: sorting artists with 'the' at beginning
Post by: Daeron on 2016-04-27 19:38:19
As I recall you can edit '<foobar2000 directory>\foo_upnp_ml_tree.xml' to dictate what is shown in the (upnp) library tree.
Title: Re: sorting artists with 'the' at beginning
Post by: belphegore on 2016-04-28 20:11:47
I'm not familiar with the structure of the libary tree xml.  The question is were and how to add the right lines.
I'm so disangeged to post my libary tree here ;) I hope someone could help me:
<MediaLibraryTree>
   <SubTree label="Albums">
      <spec type="object.container.album.musicAlbum">%album%[ '['%album artist%']']</spec>
   </SubTree>
   <SubTree label="Artists">
      <spec type="object.container.person.musicArtist">%artist%</spec>
      <spec type="object.container.album.musicAlbum">%album%</spec>
   </SubTree>
   <SubTree label="Album Artists">
      <spec type="object.container.album.musicAlbum">[%album artist% - ]['['%date%']' ]%album%</spec>
   </SubTree>
   <SubTree label="Genres">
      <spec type="object.container.genre.musicGenre">%&lt;genre&gt;%</spec>
      <spec type="object.container.album.musicAlbum">[%album artist% - ]%album%</spec>
   </SubTree>
   <SubTree label="Years">
      <spec>%date%</spec>
      <spec type="object.container.album.musicAlbum">[%album artist% - ]%album%</spec>
   </SubTree>
   <SubTree label="Compilations" query="compilation PRESENT">
      <spec type="object.container.album.musicAlbum">[%album artist% - ]%album%</spec>
   </SubTree>
   <SubTree label="Codecs">
      <spec>%codec%</spec>
      <spec type="object.container.album.musicAlbum">[%album artist% - ]%album%</spec>
   </SubTree>
   <SubTree label="Folders" type="filesystem"/>
   </SubTree>
   <SubTree label="Label">
      <spec>%publisher%</spec>
      <spec type="object.container.person.musicArtist">%artist%</spec>
      <spec type="object.container.album.musicAlbum">%album%</spec>
</MediaLibraryTree>   

I also tried before to add the "Label" entry, but it isn't working :(
Title: Re: sorting artists with 'the' at beginning
Post by: 80sMetalForever on 2016-04-28 21:08:30
Ever listened to Therion?


Lepaca \m/
Title: Re: sorting artists with 'the' at beginning
Post by: marc2003 on 2016-04-29 04:51:45
I also tried before to add the "Label" entry, but it isn't working :(

Looks like you didn't close it with </SubTree> at the end.
Title: Re: sorting artists with 'the' at beginning
Post by: belphegore on 2016-04-29 12:56:36
Thanks, marc2003!
I closed it with that line and I also changed %publisher% to %<publisher>%. But this whole entry still won't appear at my Pioneer.  :(
Any ideas how I could use this swapperprefix line from davideleo here too?