Bug 292245 - stats lost after changing metadata and moving files within amarok.
Summary: stats lost after changing metadata and moving files within amarok.
Status: RESOLVED FIXED
Alias: None
Product: amarok
Classification: Unclassified
Component: Collections/Local (show other bugs)
Version: 2.5-git
Platform: Ubuntu Packages Linux
: HI normal (vote)
Target Milestone: 2.6
Assignee: Amarok Developers
URL:
Keywords: regression, release_blocker
Depends on:
Blocks:
 
Reported: 2012-01-23 02:04 UTC by Elián Hanisch
Modified: 2012-07-09 11:04 UTC (History)
4 users (show)

See Also:
Latest Commit:
Version Fixed In: 2.6


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Elián Hanisch 2012-01-23 02:04:04 UTC
Version:           2.4.3 (using KDE 4.7.3) 
OS:                Linux

As I understand, Amarok will lose stats (playcount, rating, ...) if an external program changes the metadata (name, artist, album, ...) *and* the file path, however, I have been losing all stats consistently if I change the metadata, and later move the file with the "Organize files" menu, that is, I make all changes with Amarok, and I can never change the metadata and path at the same time, yet stats are lost.

Reproducible: Always

Steps to Reproduce:
- set the rating of a song
- change the artist metadata of the song
- use Organize files dialog and move it in some other place in your collection


Actual Results:  
the song's rating is empty.

Expected Results:  
rating shouldn't be lost

If I don't change the metadata, using the Organize File dialog doesn't cause stats to be lost.
Comment 1 Myriam Schweingruber 2012-01-24 15:02:39 UTC
Could you please try again with Amarok 2.5?
Comment 2 Elián Hanisch 2012-01-24 21:10:12 UTC
not until is available en kubuntu. Have you tried to confirm at the very least?
Comment 3 Myriam Schweingruber 2012-01-25 09:21:38 UTC
Please have a look here: http://www.kubuntu.org/news/amarok-25-backports-ppa

I was not able to reproduce it but that is due to another problem here on my installation, so somebody else needs to confirm it.

FWIW: since we only work on bugs with the latest version the bug reporters should upgrade nonetheless.
Comment 4 Elián Hanisch 2012-01-25 23:30:55 UTC
Thanks for trying to reproduce, I updated from backports, I can still reproduce dataloss when changing metadata and moving the file with the "organize files" dialog.

is probably a different bug, but I also find that sometimes the metadata can't be edited after moving the file, is greyed out, but I can't figure out why it happens with some files and not with others.

Changing metadata and file's path is always done with amarok, not with any external software.
Comment 5 Myriam Schweingruber 2012-01-26 16:44:52 UTC
Thank you for the fast feedback.
Comment 6 Aaron Luchko 2012-02-01 04:45:15 UTC
Using amarok-2.5.0-1.fc16.x86_64 I see the same issue.
Comment 7 Myriam Schweingruber 2012-02-01 21:09:14 UTC
Thank you for the feedback.
Comment 8 Silver Salonen 2012-04-16 14:15:30 UTC
Maybe this use-case is about the same bug:
  1) Drag some folder to playlist
  2) Play the files
  3) Move folder to another location (within the collection folders)
  4) Drag the "new" folder to playlist

After this play count stats of the already played tracks are gone.
Comment 9 Silver Salonen 2012-04-16 14:17:42 UTC
Forgot to mention:
  - I use Amarok 2.5.0 on KDE 4.8.2 and openSuse 12.1
  - I used Konqueror for dragging/moving the folder
Comment 10 Matěj Laitl 2012-05-12 16:37:23 UTC
I can reproduce this, too, and I consider this a major bug -> making it a release blocker.

I'm working on this and I think I know the cause (the urls table is simply not updated with new paths), if nothing goes wrong, the fix should land in 2.6-beta. Related is bug 242350 which will be fixed, too.
Comment 11 Ralf Engels 2012-06-25 13:56:48 UTC
First: it seems to work for me.

Silver Salone: If the tracks are not in the collection then changing the rating might not persist. 
Your step 1) is confusing me. Do you mean "dragging the folder into the collection folder within a file manager"?

Eli´an:
I can't reproduce your problem.
Can you get into more details. Moving a single song or a whole directory of songs? Moving inside the collections folder or into and out-of the collection? Did you swith on the "Write statistics to file" setting?
Comment 12 Silver Salonen 2012-06-25 14:05:46 UTC
In my use-case I drag folders to playlist from filemanager (Konqueror), not from collection browser.
Comment 13 Matěj Laitl 2012-06-25 14:09:09 UTC
(In reply to comment #12)
> In my use-case I drag folders to playlist from filemanager (Konqueror), not
> from collection browser.

And the folders, are these under your collection? (as defined in Amarok config)
Comment 14 Elián Hanisch 2012-06-26 00:28:24 UTC
> Eli´an:
> I can't reproduce your problem.
> Can you get into more details. Moving a single song or a whole directory of
> songs? Moving inside the collections folder or into and out-of the
> collection? Did you swith on the "Write statistics to file" setting?
I don't use "Write statistics to file", moving files is done with Amarok's 
"Organise Files" dialog always, so is within the collection, with music in the 
collection. I didn't use dolphin or other file manager for move them.

The steps for reproduce the bug are the listed in the bug's description, 
moving one song or many have the same result.
Comment 15 Silver Salonen 2012-06-26 08:34:42 UTC
(In reply to comment #13)
> (In reply to comment #12)
> > In my use-case I drag folders to playlist from filemanager (Konqueror), not
> > from collection browser.
> 
> And the folders, are these under your collection? (as defined in Amarok
> config)

Yes :)
Comment 16 Myriam Schweingruber 2012-06-28 17:31:48 UTC
Thank you all for the fast feedback.
Comment 17 Ralf Engels 2012-07-02 15:47:27 UTC
Elián,
can we go into details:
Steps to Reproduce: 
- set the rating of a song
Is this a song from the collection or one from the filebrowser or even something more exotic?

- change the artist metadata of the song
Could you also try it with rating and the album cover? Both are using slightly different mechanisms.

 - use Organize files dialog and move it in some other place in your collection 
Is the meta data only lost if using the organize dialog or also if you move the file by hand?
Comment 18 Elián Hanisch 2012-07-07 21:50:30 UTC
(In reply to comment #17)
> Elián,
> can we go into details:
> Steps to Reproduce: 
> - set the rating of a song
> Is this a song from the collection or one from the filebrowser or even
> something more exotic?
As I said a couple of times already, the song is from the collection.

> - change the artist metadata of the song
> Could you also try it with rating and the album cover? Both are using
> slightly different mechanisms.
No. Changing rating or album cover naturally won't trigger the bug because that metadata isn't normally used for updating the file's path. Only things like artist's name, song's name or album's name.

>  - use Organize files dialog and move it in some other place in your
> collection 
> Is the meta data only lost if using the organize dialog or also if you move
> the file by hand?
If I move the file by hand, like with dolphin, amarok loses track of the song and stats are lost because both path and name metadata changed.

As I understand this is a limitation of Amarok: losing track of a song when path and name metadata change at the same time. The point of this bug is that if you change path and name metadata with Amarok, not with any other external software, and you still lose stats. Amarok should update the collection to ensure that the path and name metadata doesn't change at the same time between updates.
Comment 19 Myriam Schweingruber 2012-07-07 23:12:30 UTC
Thank you for the fast feedback, Elián. Normally the AFT should prevent such data losses IIRC.
Comment 20 Matěj Laitl 2012-07-09 11:04:14 UTC
Git commit b108bd655d2759bd2aca6f8f7392c482684d69bb by Matěj Laitl.
Committed on 09/07/2012 at 12:47.
Pushed by laitl into branch 'master'.

SqlTrack: update uidUrl in db if it changes on metadata change

Following scenario lead to statistics, lyrics and labels loss:
 1. make sure a track in local collection is not tagged by
    amarok_afttagger or with musicbrainz uid
 2. turn off "Watch folders for changes" (or work fast)
 3. change title of the track within Amarok
 4. move the file within collection folders using Dolphin
 5. hit "Update Collection"
 6. the stats are lost; normally Amarok should match the track by
    uidUrl, but it isn't updated in the db in step 3., so it doesn't
    find the old track and removes the entry for it.

[Reporters: ^^^ see a nice example of "steps to reproduce"]

This patch changes step 3 to reread and update uidUrl in the database
if necessary.

BUGFIXES:
 * Don't loose statictis, labels and lyrics when changing metadata of a
   track (not tagged by afttagger) followed by moving it.
CCMAIL: Ralf Engels <ralf-engels@gmx.de>
FIXED-IN: 2.6

M  +2    -0    ChangeLog
M  +15   -16   src/core-impl/collections/db/sql/SqlMeta.cpp
M  +0    -1    src/core-impl/collections/db/sql/SqlMeta.h

http://commits.kde.org/amarok/b108bd655d2759bd2aca6f8f7392c482684d69bb