Bug 181955 - [PATCH] Ignore "DJ " in front of Artist names in id3-database
Summary: [PATCH] Ignore "DJ " in front of Artist names in id3-database
Status: RESOLVED FIXED
Alias: None
Product: amarok
Classification: Applications
Component: Collection Browser (show other bugs)
Version: unspecified
Platform: openSUSE Linux
: NOR normal
Target Milestone: 2.3.2
Assignee: Amarok Developers
URL:
Keywords: junior-jobs
Depends on:
Blocks:
 
Reported: 2009-01-26 06:45 UTC by jason
Modified: 2010-08-18 14:08 UTC (History)
3 users (show)

See Also:
Latest Commit:
Version Fixed In: 2.3.2


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description jason 2009-01-26 06:45:15 UTC
Version:           KDE 3.5.10 release 21.11 - Build Date: Dec 3, 2008 (using KDE 4.1.4)
OS:                Linux
Installed from:    SuSE RPMs

I'm re-opening Bug 85959 because I didn't see valid reason for a "won't fix"

Organizing all artists that brand them selves as a DJ or MC under D or M respectively is not only annoying, but a flaw,  Walking into any music store proves this is contrary to convention.

In fact, the developer calling for a won't fix him self admits this is a 'Branding issue'

As for "What to do with Dj, dj, D.J. or DJ" once again, Amazon, lastFM and allmusic prove, convention is DJ all caps, no periods.

Finally, the last argument that since DJ has meaning isn't an article like "the" means we should on it is just another false premise.  DJ is simply a salutation no different than Mr Ms and Dr, all of which we wouldn't dream of sorting a phone book by.

The code change is rather simple, one just needs to add a switch or repeat the code listed in bug 136233; I'd do it my self, but I'm unfamiliar with using SVN.
Comment 1 Mark Kretschmann 2009-01-27 17:47:48 UTC
This is a wish, not a bug. Please categorize your reports correctly.
Comment 2 Richard Longland 2010-05-26 17:56:20 UTC
Hi,

This also affects me, so I thought I could dig around in the code. It turns out that there is a sortableName that's used for this sort of thing. I added a simple if statement and created a patch. I've never done this sort of thing before, so please forgive me if I'm doing something wrong. The patch was created from Amarok 1.3-GIT (up-to-date as of this morning).

---
 src/core/meta/Meta.cpp |    8 ++++++--
 1 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/src/core/meta/Meta.cpp b/src/core/meta/Meta.cpp
index e61f9b3..0870db2 100644
--- a/src/core/meta/Meta.cpp
+++ b/src/core/meta/Meta.cpp
@@ -417,9 +417,13 @@ Meta::Artist::sortableName() const
             QString begin = name().left( 3 );
             m_sortableName = QString( "%1, %2" ).arg( name(), begin );
             m_sortableName = m_sortableName.mid( 4 );
-        }
+        } else if ( name().startsWith( "dj ", Qt::CaseInsensitive ) ) {
+	  QString begin = name().left( 2 );
+	  m_sortableName = QString( "%1, %2" ).arg( name(), begin );
+	  m_sortableName = m_sortableName.mid( 3 );
+	}
         else
-            m_sortableName = name();
+	  m_sortableName = name();
     }
     return m_sortableName;
 }
-- 
1.6.3.3


Cheers,
Rich
Comment 3 Jeff Mitchell 2010-05-26 18:30:46 UTC
Seems pretty reasonable to me at a quick glance. This could go in for 2.3.2, once our freeze is over. A dev should obviously check if it works.

Note to whoever applies it: as pasted above it has whitespacing issues, so please fix it.
Comment 4 Richard Longland 2010-05-26 19:35:20 UTC
Jeff, just to improve anything I do in the future, what whitespace issues does the patch have? How would I go about formatting it properly? I generated the patch using:
git format-patch origin --stdout > DJIgnored.patch

As I said, I'm new to this so I just want to make sure I can help more effectively in the future. Cheers!
Comment 5 Jeff Mitchell 2010-05-27 13:15:38 UTC
Ah, we use spaces instead of tabs, with each tab being four spaces. From the way the patch you pasted looks it looks like this isn't the case. It's hard to tell from a paste though. In the future if you want to submit a patch, please add it as an attachment and mark it as a patch.

Thanks!
Comment 6 Sven Krohlas 2010-05-28 22:51:56 UTC
commit aa59de3eb50f123c3316a12a31eaf2d13623135d
Author: Sven Krohlas <sven@asbest-online.de>
Date:   Fri May 28 22:44:05 2010 +0200

    Ignore "DJ" prefix when sorting in collection browser.
    Patch by Richard Longland <rlongland@hotmail.com>.
    
    BUG: 181955
    CCMAIL: rlongland@hotmail.com

diff --git a/ChangeLog b/ChangeLog
index bbcba4f..650b21f 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -7,6 +7,7 @@ VERSION 2.3.2-Beta 1
   FEATURES:
 
   CHANGES:
+    * Ignore "DJ" prefix when sorting in collection browser. (BR 181955)
 
   BUGFIXES:
     * Fixed usability issue with regards to context menu item order when right
diff --git a/src/core/meta/Meta.cpp b/src/core/meta/Meta.cpp
index e61f9b3..460c3f7 100644
--- a/src/core/meta/Meta.cpp
+++ b/src/core/meta/Meta.cpp
@@ -412,12 +412,16 @@ Meta::Artist::operator==( const Meta::Artist &artist ) const
 QString
 Meta::Artist::sortableName() const
 {
-    if ( m_sortableName.isEmpty() && !name().isEmpty() ) {
-        if ( name().startsWith( "the ", Qt::CaseInsensitive ) ) {
+    if( m_sortableName.isEmpty() && !name().isEmpty() ) {
+        if( name().startsWith( "the ", Qt::CaseInsensitive ) ) {
             QString begin = name().left( 3 );
             m_sortableName = QString( "%1, %2" ).arg( name(), begin );
             m_sortableName = m_sortableName.mid( 4 );
-        }
+        } else if( name().startsWith( "dj ", Qt::CaseInsensitive ) ) {
+            QString begin = name().left( 2 );
+            m_sortableName = QString( "%1, %2" ).arg( name(), begin );
+            m_sortableName = m_sortableName.mid( 3 );
+    }
         else
             m_sortableName = name();
     }
Comment 7 Ben Laenen 2010-08-18 13:03:40 UTC
Is there some way to disable this smart sorting?

Also, what about artists beginning with "DJ The"?
Comment 8 Sven Krohlas 2010-08-18 14:08:52 UTC
> Is there some way to disable this smart sorting?

No. There has never been a way to disable this. Iirc there was a discussion about it, but that was ages ago, and i don't know where that took place anymore.


> Also, what about artists beginning with "DJ The"?

That's an interesting and a little obscure case, those should end up in the section "t" in an alphabetically by artist sorted collection.