Summary: | [PATCH] Ignore "DJ " in front of Artist names in id3-database | ||
---|---|---|---|
Product: | [Applications] amarok | Reporter: | jason <virtualXTC> |
Component: | Collection Browser | Assignee: | Amarok Developers <amarok-bugs-dist> |
Status: | RESOLVED FIXED | ||
Severity: | normal | CC: | bl.bugs, mitchell, rlongland |
Priority: | NOR | Keywords: | junior-jobs |
Version: | unspecified | ||
Target Milestone: | 2.3.2 | ||
Platform: | openSUSE | ||
OS: | Linux | ||
Latest Commit: | Version Fixed In: | 2.3.2 |
Description
jason
2009-01-26 06:45:15 UTC
This is a wish, not a bug. Please categorize your reports correctly. 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 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. 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! 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! 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(); } Is there some way to disable this smart sorting? Also, what about artists beginning with "DJ The"? > 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. |