Bug 210837

Summary: [PATCH] Add/remove tracks to various artists cause duplicate album entry in collection
Product: [Applications] amarok Reporter: Morten Sjoegren <kdestuff>
Component: Collections/LocalAssignee: Amarok Developers <amarok-bugs-dist>
Status: RESOLVED FIXED    
Severity: normal CC: a.m.p.boelens, durakovic.sanel, mahasamoot, mitchell, sven.burmeister
Priority: NOR    
Version: 2.3-GIT   
Target Milestone: ---   
Platform: Arch Linux   
OS: Linux   
Latest Commit: Version Fixed In:
Attachments: Suggested patch to solve this problem.

Description Morten Sjoegren 2009-10-16 23:19:54 UTC
Version:           2.2-GIT (using KDE 4.3.2)
OS:                Linux
Installed from:    Archlinux Packages

I've two related problem with adding and removing albums from various artists.

Problem one:
When I add an album to various artists and an album with the same same already exists under various, there will be an extra album in the list.

Problem two:
Remove an album from various artists, sometimes result in an empty album under various artists, but the tracks will be under the right artist under the right album.

I've made a patch that should fix this problem and I hope one of the amarok developers will look at it. I'll attach it in a moment.

The problem is caused in SqlAlbum::setCompilation() which are marked AMAROK_NOTIMPLEMENTED.

Solution for problem one:
There is a constraint on album.name and album.artist in the database, but if artist is NULL multiple entries of the same name can exist in the database.
I simply check for existing albums with the same name and artist is null, if such an album exist, add the tracks to that album.

Solution for problem two:
The same constraint as problem one plays in here.
The problems was primarily caused by attempting to update an album to having the same name and artist as another album, and there were no check to prevent this.

But the code also assumed the artist for the first track in the album, was also the artist for all the other tracks. This wasn't the case with tracks I had from four different albums all called "Greatest hits".

I solved these by checking for artist for each track in the album, against other album with the same name and moving the tracks to those albums.
Comment 1 Morten Sjoegren 2009-10-16 23:20:46 UTC
Created attachment 37628 [details]
Suggested patch to solve this problem.
Comment 2 Myriam Schweingruber 2009-10-17 13:39:57 UTC
*** Bug 198861 has been marked as a duplicate of this bug. ***
Comment 3 Mathieu 2009-11-26 18:44:21 UTC
*** This bug has been confirmed by popular vote. ***
Comment 4 Myriam Schweingruber 2009-11-26 19:44:06 UTC
Morten, could you please submit a merge request to git as described in this tutorial: http://techbase.kde.org/Getting_Started/Sources/KDE_git-tutorial#Patch_Contributors so the deveolpers can have a look.
Comment 5 Morten Sjoegren 2009-11-26 19:50:12 UTC
Hi, Myriam.

I've already done that http://gitorious.org/amarok/amarok/merge_requests/2169
Comment 6 Myriam Schweingruber 2009-11-26 20:23:23 UTC
(In reply to comment #5)
> Hi, Myriam.
> 
> I've already done that http://gitorious.org/amarok/amarok/merge_requests/2169

Right, sorry, didn't remember that.
Comment 7 Mikko C. 2009-12-08 18:14:19 UTC
could anyone test this patch and see if it fixes the issues? http://gitorious.org/amarok/amarok/merge_requests/2169
Comment 8 Mikko C. 2009-12-08 19:58:09 UTC
patch merged in master
Comment 9 Myriam Schweingruber 2009-12-11 15:08:57 UTC
*** Bug 218270 has been marked as a duplicate of this bug. ***