Bug 316216

Summary: Collection scanner scans whole file system (or a home folder) instead of assigned directories sometimes
Product: [Applications] amarok Reporter: Rudolf Leitgeb <Rudolf.Leitgeb>
Component: Collections/LocalAssignee: Amarok Developers <amarok-bugs-dist>
Status: RESOLVED FIXED    
Severity: normal CC: esteinma, info, matej, pofigoon, ralf-engels, robert, tamius.han
Priority: NOR Keywords: release_blocker
Version: 2.6.0   
Target Milestone: 2.8   
Platform: Ubuntu   
OS: Linux   
Latest Commit: Version Fixed In: 2.7.1
Sentry Crash Report:
Attachments: amarok settings, after HD unplug
amarokrc, after HD unplug
amarok settings, after HD plug in
amarokrc, after HD plug in

Description Rudolf Leitgeb 2013-03-06 10:11:11 UTC
My "Local Collection" is pretty much useless because amarok scans the whole root file system instead of the directories assigned in the Settings->Local Collection menu. This gives me so many sound files (like system sounds), all sorted into individual branches that it becomes hard to look for music I actually put into that collection. Even disabling all directories in the Local Collection configuration menu gives me all these files.

Reproducible: Always

Steps to Reproduce:
1. Open amarok
2. watch the Local Collection grow beyond recognition

Actual Results:  
Local Collection filled with sound files nobody wants

Expected Results:  
Local Collection filled with sound files from directies I chose for that purpose
Comment 1 Myriam Schweingruber 2013-03-06 10:25:48 UTC
Please upgrade to Amarok 2.7 and try again, see http://kubuntu.org/news/amarok-27
Comment 2 Ralf Engels 2013-03-06 10:30:03 UTC
I second Myriams suggestion.

Also give us some hints what might be wrong. Do you have a special setup? Can you look at the amarok debug output (start amarok with --debug).
Comment 3 Rudolf Leitgeb 2013-03-06 12:16:06 UTC
First: I just upgraded to amarok 2.7.0 as provided by the Ubuntu ppa for 12.10, and the issue is still there.

Second: the issue pops up when I rip a CD to my local collection. When the scanning process is complete, I seem to have every music file on my file system show up in Local Collection. I can't get rid of these extries except by deleting the data base.
Comment 4 Matěj Laitl 2013-03-06 12:29:44 UTC
Could you please paste the whole [Collection Folders] section of your .kde/share/config/amarokrc?
Comment 5 Rudolf Leitgeb 2013-03-06 13:47:25 UTC
Sure:
==============================SNIP=========================================
[Collection Folders]
1=./rlp/Music
2=./home/rudolf/Musik
3=./rudolf/Musik
Use MusicLocation=true
==============================SNIP=========================================

These folders should actually refer to the following directories:
/home/rlp/Music
/Archive/home/rudolf/Musik
/Public/rudolf/Musik

Hope that helps.
Comment 6 Matěj Laitl 2013-03-06 14:10:37 UTC
(In reply to comment #5)
> [Collection Folders]
> 1=./rlp/Music
> 2=./home/rudolf/Musik
> 3=./rudolf/Musik
> 
> These folders should actually refer to the following directories:
> /home/rlp/Music
> /Archive/home/rudolf/Musik
> /Public/rudolf/Musik

This is okay as long as /home, /Archive, /Public are separate mount points.

> Use MusicLocation=true

Is this intentional? Please try setting this to false, followed starting Amarok and a Full Rescan. If you go to KDE System Settings -> Account Details -> Paths, what is your music folder there?
Comment 7 Rudolf Leitgeb 2013-03-06 14:51:07 UTC
Yes, /home, /Archive and /Public are indeed separate mount points, even on different disks.

About MusicLocation: is there a menu item in the amarok config menu or do I have to go through the text file? Anyway, I just set this item to false and the whole list of junk files is still in the Local Collection.

The path in KDE System Settings -> Account Details -> Paths looks correct: /home/rlp/Music
Comment 8 Matěj Laitl 2013-03-06 14:59:55 UTC
(In reply to comment #7)
> About MusicLocation: is there a menu item in the amarok config menu or do I
> have to go through the text file? Anyway, I just set this item to false and
> the whole list of junk files is still in the Local Collection.

Have you performed a full rescan after starting Amarok?

It it doesn't help, does renaming .kde/share/apps/amarok/mysqle folder help? (wait for the scanning to finish in this case)
Comment 9 Rudolf Leitgeb 2013-03-06 15:26:16 UTC
I just cleaned out the data base by typing 
    rm ~/.kde/share/apps/amarok/mysqle/amarok/*
and sure enough, after a full rescan the junk files were gone. As soon as I ripped a CD, though, the junk files were back in full glory. The CD rip itself ended up incomplete, out of five songs only one made it into Local Collection.
Comment 10 Matěj Laitl 2013-03-06 15:32:35 UTC
Thanks for the quick info. We'll need to think about this more and perhaps provide a debugging patch. Are you able to apply a patch and build Amarok from sources? (we have tutorials)
Comment 11 Rudolf Leitgeb 2013-03-06 15:44:22 UTC
Assuming the patch applies more or less cleanly to the Ubuntu Quantal Kde PPA sources I'm quite confident I can help with testing. Could you tell me which package I will need to patch, so I can get prepared?
Comment 12 robert marshall 2013-03-06 20:40:40 UTC
I'm sure I posted a similar bug to this a bit back but at the moment I can't find it! Was it closed because I couldn't replicate it?
Comment 13 Matěj Laitl 2013-03-15 17:08:54 UTC
*** Bug 316754 has been marked as a duplicate of this bug. ***
Comment 14 Matěj Laitl 2013-04-19 18:11:41 UTC
*** Bug 318602 has been marked as a duplicate of this bug. ***
Comment 15 Alex 2013-04-19 19:02:43 UTC
I had similar problem : Amarok does not remove files that were added to the local collection but then the source folder was changed and these files should not appear in collection anymore.

Removing ~/.kde/share/apps/amarok/mysqle/amarok/ is the only thing that solved the problem for me
Comment 16 Matěj Laitl 2013-05-06 12:07:06 UTC
Changing the bug title, Ripping a CD into Local Collection may not be the only trigger.
Comment 17 thomi_ch 2013-05-06 12:36:14 UTC
Hey all

I also have the same issue.
Amarok 2.7.0
KDE 4.10.2
Kubuntu 13.04 64bit
External USB HD with all my sound

1. Amarok started, only folders on external USB HD configured as collection folders
2. unplug external USB HD
3. Amarok recognized it and disabled the collection
4. check settings in Amarok and amarokrc
Amarok preferences: http://i.imgur.com/dQsg3Gk.png
amarokrc: http://i.imgur.com/E5FbT08.png
Amarok added automatically folder "/home/thomi/Temp" as another collection folder !!!???
5. plug in external USB HD
Amarok preferences: http://i.imgur.com/YAz2OZc.png (same in amarokrc)
6. disable "/home/thomi/Temp" and check
amarokrc: http://i.imgur.com/qrVE0O6.png

Now if i repeat above, it happens each time, when i unplug external USB HD or if it is not available.

What we expect:
Amarok should not add collection folders automatically..

Thanks for fixing that..

Have a nice day
thomi
Comment 18 thomi_ch 2013-05-06 12:44:13 UTC
Created attachment 79729 [details]
amarok settings, after HD unplug
Comment 19 thomi_ch 2013-05-06 12:44:37 UTC
Created attachment 79730 [details]
amarokrc, after HD unplug
Comment 20 thomi_ch 2013-05-06 12:45:00 UTC
Created attachment 79731 [details]
amarok settings, after HD plug in
Comment 21 thomi_ch 2013-05-06 12:45:20 UTC
Created attachment 79732 [details]
amarokrc, after HD plug in
Comment 22 Matěj Laitl 2013-05-12 20:05:46 UTC
Git commit bbbf5abc82b3b470d92b78b591487732310f8428 by Matěj Laitl.
Committed on 12/05/2013 at 21:24.
Pushed by laitl into branch 'master'.

MountPointManager: fix inability to deselect "Use MusicLocation"

...and also inability to clear the Local Collection if collection
folders are cleared.

BUGFIXES:
 * Fix inability to reverse "Use Music Location" decision and inability
   to clear database once all collection directories have been unset.

This patch is a candidate for inclusion into 2.7.1
FIXED-IN: 2.8
CCMAIL: amarok-devel@kde.org

M  +2    -0    ChangeLog
M  +16   -20   src/App.cpp
M  +31   -19   src/core-impl/collections/db/MountPointManager.cpp
M  +7    -0    src/core-impl/collections/db/MountPointManager.h
M  +2    -1    src/scanner/GenericScanManager.cpp

http://commits.kde.org/amarok/bbbf5abc82b3b470d92b78b591487732310f8428
Comment 23 Matěj Laitl 2013-05-14 21:25:30 UTC
Git commit 7fae7ef4cf8cb872270943c04ca5ff228bb35239 by Matěj Laitl.
Committed on 12/05/2013 at 21:24.
Pushed by laitl into branch 'v2.7.x'.

MountPointManager: fix inability to deselect "Use MusicLocation"

...and also inability to clear the Local Collection if collection
folders are cleared.

BUGFIXES:
 * Fix inability to reverse "Use Music Location" decision and inability
   to clear database once all collection directories have been unset.

This patch is a candidate for inclusion into 2.7.1
FIXED-IN: 2.8

M  +2    -0    ChangeLog
M  +16   -20   src/App.cpp
M  +31   -19   src/core-impl/collections/db/MountPointManager.cpp
M  +7    -0    src/core-impl/collections/db/MountPointManager.h
M  +4    -3    src/core-impl/collections/db/ScanManager.cpp

http://commits.kde.org/amarok/7fae7ef4cf8cb872270943c04ca5ff228bb35239
Comment 24 Erik 2013-06-11 19:42:20 UTC
Same situation as comment #3 here: https://bugs.kde.org/show_bug.cgi?id=316216#c3 Amarok's collection (nicely limited to my Music folder) was fine untill I tried to rip a CD (copy it to my library). For now I deleted (renamed) the database and started fresh. Great to hear that it was not just me and that this issue is resolved now :)