Skip to main content

Topic: Ignore leading "the" when sorting and removing splitter (0.9 (Read 8556 times) previous topic - next topic

0 Members and 1 Guest are viewing this topic.
Ignore leading "the" when sorting and removing splitter (0.9
I have a quick question... how does one sort artists in order to bypass "the" in the beginning? I know where to place it, just not the code. Thanks in advance!!!

Ignore leading "the" when sorting and removing splitter (0.9
Reply #1
After reading the feature request topic and all 10 pages of this topic, and I apologize if this feature has been discussed and/or denied before in another topic, but personally this is an annoying pet peeve of mine. Whether I make a splitter for my configuration, and I decide I do not want the splitter after all, I cannot just remove it at all. In fact, one must literally start from scratch just to remove said splitter. This also effects Scratchbox as well.  I would really love to have an option while editing the layout to remove a splitter... that would be lovely!!!


Also, I mentioned this quite a while ago, and although I've read a response to my following question somewhere by picmixer, foosion, or Frank that this would make things more complex for the novice user...,
I have a quick question... how does one sort artists in order to bypass "the" in the beginning? I know where to place it, just not the code. Thanks in advance!!!

  • Frank Bicking
  • [*][*][*][*][*]
  • Global Moderator
Ignore leading "the" when sorting and removing splitter (0.9
Reply #2
Quote
I would really love to have an option while editing the layout to remove a splitter...

Please read this post.

  • fbuser
  • [*][*][*][*][*]
  • Developer
Ignore leading "the" when sorting and removing splitter (0.9
Reply #3
Also, I mentioned this quite a while ago, and although I've read a response to my following question somewhere by picmixer, foosion, or Frank that this would make things more complex for the novice user...,

I have a quick question... how does one sort artists in order to bypass "the" in the beginning? I know where to place it, just not the code. Thanks in advance!!!



The best solution for album list (and facets, too) would be, if there was a separation between display and sorting. I use for sorting an extra field %artist sort%. So there is no need for complicated title formatting and I can sort all artists the way I want. For example: I want to sort "Ludwig van Beethoven" under the letter B, but display it as I wrote before. I use "BEETHOVEN LUDWIG" as sortstring and get the desired result. It's a little bit more work while tagging, but it's worth it.

  • Frank Bicking
  • [*][*][*][*][*]
  • Global Moderator
Ignore leading "the" when sorting and removing splitter (0.9
Reply #4
The best solution for album list (and facets, too) would be, if there was a separation between display and sorting. I use for sorting an extra field %artist sort%. So there is no need for complicated title formatting and I can sort all artists the way I want. For example: I want to sort "Ludwig van Beethoven" under the letter B, but display it as I wrote before. I use "BEETHOVEN LUDWIG" as sortstring and get the desired result. It's a little bit more work while tagging, but it's worth it.

While it's not a bad idea per se, making it fully configureable doesn't make much sense.

It allows too many nonsensical combinations. How would you sort %artist% by %tracknumber%, for example?

In Facets, you can already add both Artist and Artist Sort columns, sort by the Artist Sort column, and finally hide the column by resizing it to a width of 0px.

  • unkwn
  • [*][*]
Ignore leading "the" when sorting and removing splitter (0.9
Reply #5
I have a quick question... how does one sort artists in order to bypass "the" in the beginning? I know where to place it, just not the code. Thanks in advance!!!

Code: [Select]
$replace(%artist%,'The ',)
Ignorance is bliss.

Ignore leading "the" when sorting and removing splitter (0.9
Reply #6
Quote
I would really love to have an option while editing the layout to remove a splitter...

Please read this post.


Oh, believe me, I did read that very post... I just hoped that it'll be a simpler method than the one proposed. However, doing that does eliminate the splitter altogether, and I am happy with that. Thanks for showing that post though!


I have a quick question... how does one sort artists in order to bypass "the" in the beginning? I know where to place it, just not the code. Thanks in advance!!!
Code: [Select]
$replace(%artist%,'The ',)


YEAH! That worked perfectly... no more having the multitude of "The" artists cluttering anymore. Thanks unkwn!
  • Last Edit: 02 November, 2007, 06:32:37 PM by TheSaneLunatic

  • Jose Hidalgo
  • [*][*][*][*]
  • Banned
Ignore leading "the" when sorting and removing splitter (0.9
Reply #7
May I ask where exactly this code must be placed in order to ignore the leading "The" in Playlist View ? Is it in Prefs > Default UI > Playlist View > Custom Grouping Schemes, or is it somewhere else ?

BTW, it would be even better if the leading "The" wasn't ignored but placed at the end of the string. e.g. "The Alan Parsons Project" becomes "Alan Parsons Project (The)". Can somebody help me with this one ?

Thanks.

  • unkwn
  • [*][*]
Ignore leading "the" when sorting and removing splitter (0.9
Reply #8
you would replace it anywhere you use %artist% either in your grouping scheme or columns.

to make The Artist becoem Artist, The use this code instead

Code: [Select]
$if($strcmp($left(%artist%,4),The ),$right(%artist%,$sub($len(%artist%),4))', 'The,%artist%)
Ignorance is bliss.

  • Paws
  • [*][*][*]
Ignore leading "the" when sorting and removing splitter (0.9
Reply #9
Sorry to but in, unkwn thanks for the code works like a charm.

  • unkwn
  • [*][*]
Ignore leading "the" when sorting and removing splitter (0.9
Reply #10
Sorry to but in, unkwn thanks for the code works like a charm.

it's just copied from the wiki 
Ignorance is bliss.

  • Jose Hidalgo
  • [*][*][*][*]
  • Banned
Ignore leading "the" when sorting and removing splitter (0.9
Reply #11
Thanks unkwn ! 

One question : wouldn't it be more appropriate to have this code ?

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

EDIT 1 : yes, I have tested and I can confirm : this code seems more appropriate for displaying "VA" albums correctly. It should work even better than the previous code. 

EDIT 2 : unkwn, your code doesn't seem to work in the Custom Grouping Schemes. What have I done wrong ?

EDIT 3 : fixed (syntax error), but I have another problem : "The Artists" shows well as "Artist, The" in the Playlist View, but it's still sorted alphabetically as "T", not as "A" ! It looks like Facets is doing the sorting well ("The Artist" is sorted as "A"), but not the Playlist View... any ideas ? 

EDIT 4 : I found it ! You have to enter the code at Preferences > General > "Sort incoming files by" !  This handles the sorting itself, while the Custom Grouping Schemes handle the apparence. Silly me ! 
  • Last Edit: 22 November, 2007, 12:38:49 AM by Jose Hidalgo

  • unkwn
  • [*][*]
Ignore leading "the" when sorting and removing splitter (0.9
Reply #12
EDIT 1 : yes, I have tested and I can confirm : this code seems more appropriate for displaying "VA" albums correctly. It should work even better than the previous code.

I don't have any VA albums so it's never been an issue for me 
EDIT 3 : fixed (syntax error), but I have another problem : "The Artists" shows well as "Artist, The" in the Playlist View, but it's still sorted alphabetically as "T", not as "A" ! It looks like Facets is doing the sorting well ("The Artist" is sorted as "A"), but not the Playlist View... any ideas ? 

you need to put the code in your sort string
  • Last Edit: 22 November, 2007, 12:39:51 AM by unkwn
Ignorance is bliss.

  • Jose Hidalgo
  • [*][*][*][*]
  • Banned
Ignore leading "the" when sorting and removing splitter (0.9
Reply #13
Yes, I've just found it (I've just edited my previous post). Thanks !

  • Jose Hidalgo
  • [*][*][*][*]
  • Banned
Ignore leading "the" when sorting and removing splitter (0.9
Reply #14
Me again.  Just to improve it a bit more :

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

What if I wanted to take into account several articles ? "The ", "Los " and "Les " for instance. I guess I could just write this :

Code: [Select]
[$if($strcmp($left(%album artist%,4),The ),$right(%album artist%,$sub($len(%album artist%),4))' ('The')',%album artist%)][$if($strcmp($left(%album artist%,4),Los ),$right(%album artist%,$sub($len(%album artist%),4))' ('Los')',%album artist%)][$if($strcmp($left(%album artist%,4),Les ),$right(%album artist%,$sub($len(%album artist%),4))' ('Les')',%album artist%)]

But something tells me that there's got to be a simpler way to script this... can someone help ? 

  • pozp
  • [*]
Ignore leading "the" when sorting and removing splitter (0.9
Reply #15
Try this (though maybe not a simpler way).

Code: [Select]
$put(b,$replace($put(a,$cut(%album artist%,4)),The ,,Los ,,Les ,)$substr(%album artist%,5,999))
$iflonger(%album artist%,$len($get(b)),' ('$trim($get(a))')',)

(1st line: remove "The ", "Los " and "Les ". 2nd line: append these)

If you want to remove leading {A,B,C,D,E} from %field% and append {", A",", B",", C",", D",", E"}, use this.

Code: [Select]
$put(c,$replace($put(b,$cut(%field%,$put(a,$strchr(%field%, )))),A ,,B ,,C ,,D ,,E ,)$substr(%field%,$add($get(a),1),999))$iflonger(%field%,$len($get(c)),', '$trim($get(b)),)


Edit: removed useless strings and added generic approach
  • Last Edit: 24 November, 2007, 03:52:31 PM by pozp

  • Jose Hidalgo
  • [*][*][*][*]
  • Banned
Ignore leading "the" when sorting and removing splitter (0.9
Reply #16
Hi pozp, thank you very much.

I've tried it... but it doesn't seem to work. What have I done wrong ?

Prefs > General > Sort incoming files by :

Code: [Select]
$put(c,$replace($put(b,$cut(%album artist%,$put(a,$strchr(%album artist%, )))),The ,,Le ,,Les ,,La ,,Las ,,Los  ,)$substr(%album artist%,$add($get(a),1),999))$iflonger(%album artist%,$len($get(c)),' ('$trim($get(b))')',) $num($sub(3000,%date%),4) [%album%] [%disc%.] [$num(%tracknumber%,2).] $if2(%title%,%_filename_ext%)

  • pozp
  • [*]
Ignore leading "the" when sorting and removing splitter (0.9
Reply #17
Perhaps removing unnecessary space in "Los  " would help.

  • Jose Hidalgo
  • [*][*][*][*]
  • Banned
Ignore leading "the" when sorting and removing splitter (0.9
Reply #18
I got it pozp ! 

I had simply forgotten to do the same thing with the Custom grouping schemes. So now I have the following TWO codes :

Prefs > General :

Code: [Select]
$put(c,$replace($put(b,$cut(%album artist%,$put(a,$strchr(%album artist%, )))),The ,,Le ,,Les ,,La ,,Las ,,Los ,)$substr(%album artist%,$add($get(a),1),999))$iflonger(%album artist%,$len($get(c)),' ('$trim($get(b))')',) $num($sub(3000,%date%),4) [%album%] [%disc%.] [$num(%tracknumber%,2).] $if2(%title%,%filename_ext%)


Prefs > Display > Default UI > Playlist view > Custom grouping schemes :

Code: [Select]
$put(c,$replace($put(b,$cut(%album artist%,$put(a,$strchr(%album artist%, )))),The ,,Le ,,Les ,,La ,,Las ,,Los ,)$substr(%album artist%,$add($get(a),1),999))$iflonger(%album artist%,$len($get(c)),' ('$trim($get(b))')',) - '['%date%']' %album%[' ('CD %discnumber%')']


The first code is slightly different because it sorts albums by date in inverse chronological order (I like that, shows latest albums first). The second code only handles the way albums are presented in the  Playlist view.

What do you think ? Is it perfect or can it be improved ?

Thanks again !

Jose
  • Last Edit: 02 December, 2007, 09:07:54 PM by Jose Hidalgo

  • Jose Hidalgo
  • [*][*][*][*]
  • Banned
Ignore leading "the" when sorting and removing splitter (0.9
Reply #19
I think I've managed to improve it a bit :

Code: [Select]
$put(c,$replace($put(b,$cut(%album artist%,$put(a,$strchr(%album artist%, )))),The ,,Le ,,Les ,,La ,,Las ,,Los ,)$substr(%album artist%,$add($get(a),1),999))$iflonger(%album artist%,$len($get(c)),' ('$trim($get(b))')',) $num($sub(3000,%date%),4) [%album%] [%disc%] [$num($left(%tracknumber%,2),2)$num($right(%tracknumber%,$sub($len(%tracknumber%),3)),2)] $if2(%title%,%filename_ext%)

The leading "The " part is unchanged, but now the code is also able to handle unusual track numbers that are more than 2 digits long (e.g. for some audiobooks, track numbers such as "14.14"), so that the sorting can be made accordingly. Now the code should be able to handle 2-digit (03), 3-digit (03.2), 4-digit (03.25, 11.42) track numbers, and even more.

Question : are both $num functions mandatory, or can they removed in order to simplify the code ? (it's getting a bit long now, I'd like to keep it as short as possible).
  • Last Edit: 02 December, 2007, 09:07:35 PM by Jose Hidalgo

  • Jose Hidalgo
  • [*][*][*][*]
  • Banned
Ignore leading "the" when sorting and removing splitter (0.9
Reply #20
Another small improvement :

Code: [Select]
$put(c,$replace($put(b,$cut(%album artist%,$put(a,$strchr(%album artist%, )))),The ,,Le ,,Les  ,,La ,,Las ,,Los ,)$substr(%album artist%,$add($get(a),1),999))$iflonger(%album  artist%,$len($get(c)),' ('$trim($get(b))')',) $num($sub(3000,%date%),4) [%album%] [%discnumber%]  [$num($left(%tracknumber%,3),2)$num($right(%tracknumber%,$sub($len(%tracknumber%),$strchr(%tracknumber%,.))),2)]  $if2(%title%,%filename_ext%)

Now it should work for all %tracknumber% formats, may them be #, ##, #.##, ##.# or ##.##.

  • jmlane
  • [*]
Ignore leading "the" when sorting and removing splitter (0.9
Reply #21
I got it pozp ! 

I had simply forgotten to do the same thing with the Custom grouping schemes. So now I have the following TWO codes :

Prefs > General :

Code: [Select]
$put(c,$replace($put(b,$cut(%album artist%,$put(a,$strchr(%album artist%, )))),The ,,Le ,,Les ,,La ,,Las ,,Los ,)$substr(%album artist%,$add($get(a),1),999))$iflonger(%album artist%,$len($get(c)),' ('$trim($get(b))')',) $num($sub(3000,%date%),4) [%album%] [%disc%.] [$num(%tracknumber%,2).] $if2(%title%,%filename_ext%)


Prefs > Display > Default UI > Playlist view > Custom grouping schemes :
Code: [Select]
$put(c,$replace($put(b,$cut(%album artist%,$put(a,$strchr(%album artist%, )))),The ,,Le ,,Les ,,La ,,Las ,,Los ,)$substr(%album artist%,$add($get(a),1),999))$iflonger(%album artist%,$len($get(c)),' ('$trim($get(b))')',) - '['%date%']' %album%[' ('CD %discnumber%')']
I don't seem to have the same list structure as this. I am using v0.9.4.5, and I have Preferences > Display > Title Formatting > Playlist.

Is this the same thing, or am I missing a component for foobar?

Thanks for the script!
jmlane

  • Jose Hidalgo
  • [*][*][*][*]
  • Banned
Ignore leading "the" when sorting and removing splitter (0.9
Reply #22
Why don't you just upgrade to 0.9.5 ?

  • sidewalking
  • [*][*][*]
Ignore leading "the" when sorting and removing splitter (0.9
Reply #23
Sorry to resurrect, but I didn't see anything else in my searches...

The examples here show a display/sort of 'Artist, The' or 'Artist (The)', but is there a way to change only the sorting, and not the display?  For example, the artist value of The Jesus and Mary Chain will show 'The Jesus and Mary Chain', but would sort on 'Jesus and Mary Chain'?

Ignore leading "the" when sorting and removing splitter (0.9
Reply #24
Sorry to resurrect, but I didn't see anything else in my searches...

The examples here show a display/sort of 'Artist, The' or 'Artist (The)', but is there a way to change only the sorting, and not the display?  For example, the artist value of The Jesus and Mary Chain will show 'The Jesus and Mary Chain', but would sort on 'Jesus and Mary Chain'?

Same as sidewalking, I hate to resurrect as well, but it would be good to know if this can be done (especially if it's just in a script that could be used in Columns UI's filters).