Commit 216c18bd authored by Matěj Laitl's avatar Matěj Laitl

Drop support for treating MusicBrainz ids as track unique ids

No comments on my mail inquiry, which I treat as a consent. Since 2.6
the SqlScanResultProcessor should cope with changed track ids just fine.

CHANGES:
 * Problematic support for treating MusicBrainz ids as track unique ids
   was dropped; should avoid surprising "Duplicate Tracks Found" errors.

@Alberto, you'll probably need to rebase your patch as I've touched
MusicBrainzFinder.cpp

BUG: 315329
GUI: Mentions of MusicBrainz ids being useful for AFT (Amarok File Tracking)
     in various documentation need to be removed
CCMAIL: amarok-devel@kde.org
CCMAIL: Alberto Villa <avilla@FreeBSD.org>
parent 914c24e8
......@@ -12,6 +12,8 @@ VERSION 2.8-Beta 1
* Added Ctrl+H shortcut to randomize playlist, patch by Harsh Gupta. (BR 208061)
CHANGES:
* Problematic support for treating MusicBrainz ids as track unique ids was dropped;
should avoid surprising "Duplicate Tracks Found" errors. (BR 315329)
* Fancy behavior of some context menus showing different actions when Shift
key is held has been reverted. All entries are now shown all the time.
* The dynamic playlist behaviour has changed. It will not longer
......
......@@ -40,7 +40,6 @@ APETagHelper::APETagHelper( TagLib::Tag *tag, TagLib::APE::Tag *apeTag, Amarok::
m_fieldMap.insert( Meta::valScore, TagLib::String( "FMPS_RATING_AMAROK_SCORE" ) );
m_uidFieldMap.insert( UIDAFT, TagLib::String( "Amarok 2 AFTv1 - amarok.kde.org" ) );
m_uidFieldMap.insert( UIDMusicBrainz, TagLib::String( "MusicBrainz Track Id" ) );
}
Meta::FieldHash
......@@ -64,11 +63,6 @@ APETagHelper::tags() const
}
else if( it->first == uidFieldName( UIDAFT ) && isValidUID( value, UIDAFT ) )
data.insert( Meta::valUniqueId, value );
else if( it->first == uidFieldName( UIDMusicBrainz ) && isValidUID( value, UIDMusicBrainz ) )
{
if( !data.contains( Meta::valUniqueId ) ) // we prefer AFT uids
data.insert( Meta::valUniqueId, value.prepend( "mb-" ) );
}
}
return data;
......
......@@ -43,7 +43,6 @@ ASFTagHelper::ASFTagHelper( TagLib::Tag *tag, TagLib::ASF::Tag *asfTag, Amarok::
m_fieldMap.insert( Meta::valScore, TagLib::String( "FMPS/Rating_Amarok_Score" ) );
m_uidFieldMap.insert( UIDAFT, TagLib::String( "Amarok/AFTv1" ) );
m_uidFieldMap.insert( UIDMusicBrainz, TagLib::String( "MusicBrainz/Track Id" ) );
}
Meta::FieldHash
......@@ -94,11 +93,6 @@ ASFTagHelper::tags() const
}
else if( it->first == uidFieldName( UIDAFT ) && isValidUID( strValue, UIDAFT ) )
data.insert( Meta::valUniqueId, strValue );
else if( it->first == uidFieldName( UIDMusicBrainz ) && isValidUID( strValue, UIDMusicBrainz ) )
{
if( !data.contains( Meta::valUniqueId ) ) // we prefer AFT uids
data.insert( Meta::valUniqueId, strValue.prepend( "mb-" ) );
}
}
return data;
......
......@@ -55,7 +55,6 @@ ID3v2TagHelper::ID3v2TagHelper( TagLib::Tag *tag, TagLib::ID3v2::Tag *id3v2Tag,
m_fmpsFieldMap.insert( FMPSScore, TagLib::String( "FMPS_Rating_Amarok_Score" ) );
m_uidFieldMap.insert( UIDAFT, TagLib::String( "Amarok 2 AFTv1 - amarok.kde.org" ) );
m_uidFieldMap.insert( UIDMusicBrainz, TagLib::String( "http://musicbrainz.org" ) );
}
Meta::FieldHash
......@@ -85,11 +84,6 @@ ID3v2TagHelper::tags() const
if( frame->owner() == uidFieldName( UIDAFT ) && isValidUID( identifier, UIDAFT ) )
data.insert( Meta::valUniqueId, identifier );
else if( frame->owner() == uidFieldName( UIDMusicBrainz ) && isValidUID( identifier, UIDMusicBrainz ) )
{
if( !data.contains( Meta::valUniqueId ) ) // we prefer AFT uids
data.insert( Meta::valUniqueId, identifier.prepend( "mb-" ) );
}
continue;
}
else if( field == Meta::valHasCover )
......
......@@ -46,7 +46,6 @@ MP4TagHelper::MP4TagHelper( TagLib::Tag *tag, TagLib::MP4::Tag *mp4Tag, Amarok::
m_fieldMap.insert( Meta::valScore, TagLib::String( "----:com.apple.iTunes:FMPS_Rating_Amarok_Score" ) );
m_uidFieldMap.insert( UIDAFT, TagLib::String( "----:com.apple.iTunes:Amarok 2 AFTv1 - amarok.kde.org" ) );
m_uidFieldMap.insert( UIDMusicBrainz, TagLib::String( "----:com.apple.iTunes:MusicBrainz Track Id" ) );
}
Meta::FieldHash
......@@ -92,11 +91,6 @@ MP4TagHelper::tags() const
}
else if( it->first == uidFieldName( UIDAFT ) && isValidUID( value, UIDAFT ) )
data.insert( Meta::valUniqueId, value );
else if( it->first == uidFieldName( UIDMusicBrainz ) && isValidUID( value, UIDMusicBrainz ) )
{
if( !data.contains( Meta::valUniqueId ) ) // we prefer AFT uids
data.insert( Meta::valUniqueId, value.prepend( "mb-" ) );
}
}
return data;
......
......@@ -179,13 +179,7 @@ TagHelper::splitUID( const QString &uidUrl ) const
if( uid.startsWith( "amarok-" ) )
uid = uid.remove( QRegExp( "^(amarok-\\w+://).+$" ) );
if( uid.startsWith( "mb-" ) )
{
uid = uid.mid( 3 );
if( isValidUID( uid, UIDMusicBrainz ) )
type = UIDMusicBrainz;
}
else if( isValidUID( uid, UIDAFT ) )
if( isValidUID( uid, UIDAFT ) )
type = UIDAFT;
return qMakePair( type, uid );
......@@ -224,8 +218,6 @@ TagHelper::isValidUID( const QString &uid, const TagHelper::UIDType type ) const
if( type == UIDAFT )
regexp.setPattern( "^[0-9a-fA-F]{32}$" );
else if( type == UIDMusicBrainz )
regexp.setPattern( "^[0-9a-fA-F]{8}(-[0-9a-fA-F]{4}){3}-[0-9a-fA-F]{12}$" );
return regexp.exactMatch( uid );
}
......
......@@ -43,7 +43,6 @@ namespace Meta
enum UIDType
{
UIDInvalid = 0,
UIDMusicBrainz = 1,
UIDAFT = 3
};
......
......@@ -51,7 +51,6 @@ VorbisCommentTagHelper::VorbisCommentTagHelper( TagLib::Tag *tag, TagLib::Ogg::X
m_fieldMap.insert( Meta::valScore, TagLib::String( "FMPS_RATING_AMAROK_SCORE" ) );
m_uidFieldMap.insert( UIDAFT, TagLib::String( "AMAROK 2 AFTV1 - AMAROK.KDE.ORG" ) );
m_uidFieldMap.insert( UIDMusicBrainz, TagLib::String( "MUSICBRAINZ_TRACKID" ) );
}
VorbisCommentTagHelper::VorbisCommentTagHelper( TagLib::Tag *tag, TagLib::Ogg::XiphComment *commentsTag, TagLib::FLAC::File *file, Amarok::FileType fileType )
......@@ -69,7 +68,6 @@ VorbisCommentTagHelper::VorbisCommentTagHelper( TagLib::Tag *tag, TagLib::Ogg::X
m_fieldMap.insert( Meta::valScore, TagLib::String( "FMPS_RATING_AMAROK_SCORE" ) );
m_uidFieldMap.insert( UIDAFT, TagLib::String( "AMAROK 2 AFTV1 - AMAROK.KDE.ORG" ) );
m_uidFieldMap.insert( UIDMusicBrainz, TagLib::String( "MUSICBRAINZ_TRACKID" ) );
}
static inline bool
......@@ -135,11 +133,6 @@ VorbisCommentTagHelper::tags() const
}
else if( it->first == uidFieldName( UIDAFT ) && isValidUID( value, UIDAFT ) )
data.insert( Meta::valUniqueId, value );
else if( it->first == uidFieldName( UIDMusicBrainz ) && isValidUID( value, UIDMusicBrainz ) )
{
if( !data.contains( Meta::valUniqueId ) ) // we prefer AFT uids
data.insert( Meta::valUniqueId, value.prepend( "mb-" ) );
}
else if( it->first == VORBIS_PICTURE_TAG )
{
if( parsePictureBlock( it->second ) )
......
......@@ -204,10 +204,11 @@ namespace Meta
virtual KUrl playableUrl() const = 0;
/** an url for display purposes */
virtual QString prettyUrl() const = 0;
/** an url which is unique for this track. Use this if you need a key for the track.
Actually this is not guaranteed to be an url at all and could be something like
mb-f5a3456bb0 for a MusicBrainz id.
*/
/**
* A fake url which is unique for this track. Use this if you need a key for
* the track.
*/
virtual QString uidUrl() const = 0;
/** Returns whether playableUrl() will return a playable Url
......
......@@ -409,8 +409,6 @@ MusicBrainzFinder::sendTrack( const Meta::TrackPtr track, const QVariantMap &inf
}
}
tags.insert( Meta::Field::UNIQUEID, tags.value( MusicBrainz::TRACKID ).toString().prepend( "mb-" ) );
//Clean metadata from unused fields
tags.remove( Meta::Field::LENGTH );
tags.remove( Meta::Field::SCORE );
......
......@@ -217,11 +217,6 @@ ScrobblerAdapter::copyTrackMetadata( lastfm::MutableTrack &to, const Meta::Track
if( track->trackNumber() >= 0 )
to.setTrackNumber( track->trackNumber() );
static const QString mbidUrlStart( "amarok-sqltrackuid://mb-" );
QString uid = track->uidUrl();
if( uid.startsWith( mbidUrlStart ) )
to.setMbid( lastfm::Mbid( uid.mid( mbidUrlStart.length() ) ) );
lastfm::Track::Source source = lastfm::Track::Player;
if( track->type() == "stream/lastfm" )
source = lastfm::Track::LastFmRadio;
......
......@@ -268,7 +268,7 @@ TestSqlTrack::testSetAllValuesSingleNotExisting()
{
{
// get a new track
Meta::TrackPtr track1 = m_collection->registry()->getTrack( -1, "./IamANewTrack.mp3", 0, "mb-1e34fb213489" );
Meta::TrackPtr track1 = m_collection->registry()->getTrack( -1, "./IamANewTrack.mp3", 0, "1e34fb213489" );
QSignalSpy spy( m_collection, SIGNAL(updated()));
MetaNotificationSpy metaSpy;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment