artist_alphabetical is always same as artist (and other)

Fixed and closed topics
Locked
Superlexx
User
Posts: 45
Joined: Thu Feb 10, 2005 8:51 pm

artist_alphabetical is always same as artist (and other)

Post by Superlexx »

in update.php, about line 392:

Code: Select all

$temp = explode(', ', $artist_alphabetic);
should be

Code: Select all

$temp = split('[, ]', $artist_alphabetic);
, because explode will only split the string on exact ', ' match and not on any of the contained characters.

it would also be better to do instead of

Code: Select all

if (in_array ($temp[1], array('The', 'De', 'Het', 'Van', 'Le', 'Les', 'Die')))
the following:

Code: Select all

if (in_array (strtolower($temp[1]), array('a', 'the', 'de', 'het', 'van', 'le', 'les', 'die')))
Also, a feature request: set the album year to the year of the most tracks in it if it's not already set (or to the year of the first track for simplicity).

CU
Superlexx
User
Posts: 45
Joined: Thu Feb 10, 2005 8:51 pm

Post by Superlexx »

hm, I'm afraid I've misunderstood the purpose of artist_alphabetical and artist ;).

What I expected from it was to allow sorting like WMP9/10 does, but it seems that it's for converting "Cure, The" to "The Cure", my folder names are all like "The Cure" anyway :D.

So I modified the code to allow WMP-like sorting :D

and, there's a typo in browse.php, just search for "Arist" ;)
User avatar
wbartels
netjukebox developer
Posts: 872
Joined: Thu Nov 04, 2004 3:12 pm
Location: Netherlands
Contact:

Post by wbartels »

Code: Select all

if (in_array (strtolower($temp[1]), array('a', 'the', 'de', 'het', 'van', 'le', 'les', 'die')))
That is a good tip to lowercase first.
I will use it on the next version.
Superlexx wrote:So I modified the code to allow WMP-like sorting :D
Can you give me an example how WMP sorts?
Superlexx
User
Posts: 45
Joined: Thu Feb 10, 2005 8:51 pm

Post by Superlexx »

wbartels wrote:Can you give me an example how WMP sorts?
it sorts like

Code: Select all

Anathema
The Beatles
Caliban
The Doors
Eminem
A Perfect Circle
Tool
and the modified PHP code in update.php is:

Code: Select all

$temp = explode(' ', $artist);
@array_walk($temp, 'trim'); // removes traling and leading white spaces
if ( count($temp) >= 2 && in_array (strtolower($temp[0]), array('a', 'the', 'de', 'het', 'van', 'le', 'les', 'die')) )
{
	$article = array_shift($temp);
	$artist_alphabetic = strtolower(implode(" ", $temp) . ", $article");
}
else 
	$artist_alphabetic = strtolower($artist);

$artist_alphabetic = str_replace('ä', 'ae', $artist_alphabetic);
$artist_alphabetic = str_replace('ö', 'oe', $artist_alphabetic);
$artist_alphabetic = str_replace('ü', 'ue', $artist_alphabetic);
$artist_alphabetic = str_replace('ß', 'ss', $artist_alphabetic);
also code in other files like browse.php needs to be modified to output $artist istead of $artist_alphabetic
User avatar
wbartels
netjukebox developer
Posts: 872
Joined: Thu Nov 04, 2004 3:12 pm
Location: Netherlands
Contact:

Post by wbartels »

Sorry, but I don't like the WMA sorting order.
I have done something similar with two columns for artist.
Than it will look like this:

Code: Select all

    Anathema 
The Beatles 
    Caliban 
The Doors 
    Eminem 
  A Perfect Circle 
    Tool
Locked