Bug 174444 - [PATCH] Collection import from amarok 1.4 does not import score
Summary: [PATCH] Collection import from amarok 1.4 does not import score
Status: RESOLVED FIXED
Alias: None
Product: amarok
Classification: Applications
Component: Collections/Local (show other bugs)
Version: 2.2.1
Platform: openSUSE Unspecified
: NOR normal
Target Milestone: ---
Assignee: Amarok Developers
URL:
Keywords:
: 184933 (view as bug list)
Depends on:
Blocks:
 
Reported: 2008-11-06 16:41 UTC by Jens
Modified: 2009-12-09 11:34 UTC (History)
12 users (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments
php-script: import score from 1.4sqlite to 2mysql (1007 bytes, application/x-httpd-php)
2009-08-15 20:56 UTC, bassslave
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Jens 2008-11-06 16:41:38 UTC
Version:            (using KDE 4.1.2)
Installed from:    SuSE RPMs

KDE 4.1.3, openSUSE 11.0, amarok 2.0 beta 3

Collection import seems to be working fine for my sqlite 1.4 collection. However, it does not import the "points" (German: "Punkte" in 2.0) that songs receive when they are played (the ones scaling from 0-100).

Btw: The old amarok had stats for the collection ordering files by these points. Would be cool to add some stats again in 2.0. But I should file another report for that.
Comment 1 Mark Kretschmann 2008-11-06 18:41:24 UTC
English word for "points" is score. Fixed it in the subject.
Comment 2 Seb Ruiz 2008-11-06 22:49:39 UTC
Strange, worked fine for me.
Any chance you can email me your collection.db?
Comment 3 Seb Ruiz 2008-11-11 10:01:29 UTC
SVN commit 882682 by seb:

We shouldn't discard statistics rows where the deviceid is -1, where no associated mount point is returned. This is the case for collections which have Amarok 1.4 'dynamic collections' turned off.
BUG: 174444
BUG: 174329


 M  +2 -2      FastForwardWorker.cpp  


WebSVN link: http://websvn.kde.org/?view=rev&revision=882682
Comment 4 soulflyb 2008-12-12 15:11:32 UTC
Mandriva 2009.0, KDE 4.1.3

Score isn't imported from amarok 1.4 sqlite db.
Comment 5 soulflyb 2008-12-12 15:53:29 UTC
(In reply to comment #4)
> Mandriva 2009.0, KDE 4.1.3
> 
> Score isn't imported from amarok 1.4 sqlite db.
> 

version of amarok : 2.0 final
Comment 6 Robert G. Siebeck 2008-12-23 01:32:34 UTC
Same problem here with Amarok 2.0 final on Gentoo.
Comment 7 Mark Kretschmann 2009-02-08 12:00:23 UTC
Reopening as per request from user "roffffel" on our forum. He claims the bug is not yet fixed.

Anyone able to confirm?
Comment 8 Mark Kretschmann 2009-02-08 12:01:21 UTC
Also see here:

http://amarok.kde.org/forum/index.php/topic,16153.0.html
Comment 9 Mark Kretschmann 2009-02-19 14:02:06 UTC
*** Bug 184933 has been marked as a duplicate of this bug. ***
Comment 10 Tristan Miller 2009-02-19 15:56:55 UTC
Confirming bug still exists with Amarok 2.0.1 on openSUSE 11.1 (installed from RPM kde4-amarok-2.0.1.1-20.54).  I can attach my collection.db from 1.4 if it would help.
Comment 11 Myriam Schweingruber 2009-04-24 12:33:06 UTC
Is this bug still present in 2.1 beta1 or SVN? It's unconfirmed since it's report...
Comment 12 Xavier Corredor Llano 2009-04-26 22:26:23 UTC
this bug still present (and confirmed) in amarok 2.1 svn 959286 with ArchLinux
Comment 13 Seb Ruiz 2009-04-28 11:48:04 UTC
Are you all importing from a local sqlite database, or are you using a mysql/psql connection?
Comment 14 Robert G. Siebeck 2009-04-28 11:50:14 UTC
I used an SQLite database.
Comment 15 Xavier Corredor Llano 2009-04-28 20:22:14 UTC
I used too SQLite database
Comment 16 Lukas Jirkovsky 2009-05-21 18:37:28 UTC
I've this problem with MySQL database. I'm using Amarok 2.0.96 (beta 1?) on Arch Linux.
Comment 17 Robert G. Siebeck 2009-06-04 15:48:36 UTC
Issue still exists in Amarok 2.1 on Linux when trying to import from SQLite.
Comment 18 Romain 2009-06-11 22:51:46 UTC
Same issue here on Amarok 2.1 (Kubuntu) when trying to import from SQLite database.
Comment 19 Romain 2009-06-11 23:28:01 UTC
Actually, not only a score problem : I haven't any ratings imported from Amarok 1.4. Any idea ?
Comment 20 Myriam Schweingruber 2009-08-02 12:59:35 UTC
Any news on this?
Comment 21 bassslave 2009-08-06 11:05:52 UTC
Is there any known workaround?
Comment 22 bassslave 2009-08-15 20:56:32 UTC
Created attachment 36181 [details]
php-script: import score from 1.4sqlite to 2mysql
Comment 23 bassslave 2009-08-15 21:00:23 UTC
fyi:

for myself I sovled this problem using a quick and dirty php-script
It comes with absolutely no warranty!
Comment 24 Kuba Serafinowski 2009-08-15 23:16:16 UTC
could someone test it in current GIT master? i have no db to test with, so..
either way it wouldn't be confirmed and require closing
Comment 25 Xavier Corredor Llano 2009-08-16 22:08:48 UTC
yea!! this problem solved, I tested amarok-git 20090816 in ArchLinux importing db (sqlite) from amarok 1.4.10 and import score excelent!!
Comment 26 Kuba Serafinowski 2009-08-16 22:14:25 UTC
gladly closing then :)
Comment 27 Romain 2009-08-17 12:14:24 UTC
Problem solved on amarok-git 20090816 in Kubuntu (importing SQLite DB from Amarok 1.4.10) : all scores and ratings successfully imported :)

You could close
Comment 28 Lukas Jirkovsky 2009-09-08 18:07:40 UTC
It still doesn't work here with MySQL and Amarok 2.2 beta1. Everything is imported except of scores.
Comment 29 Lukas Jirkovsky 2009-09-08 19:18:39 UTC
I can upload dump of my MySQL database somewhere if you want to.
Comment 30 Lukas Jirkovsky 2009-09-08 19:27:59 UTC
Anyway, it seems that some scores are imported but unfortunately it's only 29 tracks from more than 4 thousands.
Comment 31 Lukas Jirkovsky 2009-09-12 14:08:08 UTC
Here is dump of my MySQL database:
http://blender6xx.ic.cz/pub/amarok.mysql
Comment 32 Lukas Jirkovsky 2009-09-15 18:18:50 UTC
Strange enough that even the php workaround doesn't actually import anything even though that it claims that everything have been imported.
Comment 33 Lukas Jirkovsky 2009-09-21 09:41:54 UTC
It seems that problem is caused by non integral numbers.
Comment 34 Michal Ziabkowski 2009-10-15 17:49:02 UTC
Indeed. I've encountered the same problem during my migration to Amarok 2.2.0 and it seems all scores which didn't get imported were floats. 

Thankfully, resolving this was a cinch:

diff -Nur amarok-2.2.0.orig/src/databaseimporter/amarok14/FastForwardWorker.cpp amarok-2.2.0/src/databaseimporter/amarok14/FastForwardWorker.cpp
--- amarok-2.2.0.orig/src/databaseimporter/amarok14/FastForwardWorker.cpp	2009-09-28 19:34:03.000000000 +0200
+++ amarok-2.2.0/src/databaseimporter/amarok14/FastForwardWorker.cpp	2009-10-15 01:29:39.395024662 +0200
@@ -163,7 +163,7 @@
 
         uint firstPlayed = query.value( index++ ).toUInt();
         uint lastPlayed  = query.value( index++ ).toUInt();
-        uint score       = query.value( index++ ).toInt();
+        uint score       = query.value( index++ ).toDouble();
         int rating       = query.value( index++ ).toInt();
         int playCount    = query.value( index++ ).toInt();
         QString lyrics   = query.value( index++ ).toString();

After applying this, I can confirm scores are imported as intended.
Comment 35 Mark Kretschmann 2009-10-15 20:03:13 UTC
Seb, could you please look at the one-liner patch in comment #34? Does it make sense?
Comment 36 Myriam Schweingruber 2009-11-16 13:38:11 UTC
AFAIK this is solved in Amarok 2.2.1
Comment 37 Lukas Jirkovsky 2009-11-20 20:07:00 UTC
Could someone reopen this? This bug is not fixed in 2.2.1. Patch from comment #34 fixes the problem.
Comment 38 Michal Ziabkowski 2009-11-20 20:34:46 UTC
Indeed. I'd like to point out the problem is likely limited to importing from sqlite used by 1.x. A quick look at the old database dump shows that I have a lot of fractional scores. For whatever reason, those are being decoded as zero, not truncated to an int. Changing that one instance of toInt into toDouble fixes the problem.
Comment 39 Myriam Schweingruber 2009-11-20 22:27:29 UTC
Michal, could you please make a merge request on Gitorious so the developers can check that patch? You can find the necessary instructions here:
http://techbase.kde.org/Getting_Started/Sources/Amarok_Git_Tutorial
Thank you.
Comment 40 Lukas Jirkovsky 2009-11-21 08:51:37 UTC
It's also problem with MySQL database from Amarok 1.x (see my database dump from comment #34). I don't know why but almost all (let's say 95%) scores are floats. Maybe it's a relict from older versions of amarok because this collection exists since Amarok 1.1 or so.
Comment 41 Marten Seemann 2009-11-23 08:30:58 UTC
It stills doesn't function in the amarok nightly build (project neon).
Comment 42 Myriam Schweingruber 2009-12-07 21:19:28 UTC
(In reply to comment #38)
> Indeed. I'd like to point out the problem is likely limited to importing from
> sqlite used by 1.x. A quick look at the old database dump shows that I have a
> lot of fractional scores. For whatever reason, those are being decoded as zero,
> not truncated to an int. Changing that one instance of toInt into toDouble
> fixes the problem.

Did you submit a merge request for this change as asked in comment #39?
Comment 43 Michal Ziabkowski 2009-12-07 22:34:46 UTC
Just did. Sorry for the delay, it's been a little hectic.
Comment 44 Mark Kretschmann 2009-12-08 08:39:27 UTC
I've just pushed Michael's commit to Git mainline. Please test (and thanks Michael!):


commit 28b6182eeccf953fdb82473ae3146741ff2101e6
Author: mziab <mziab@dual.(none)>
Date:   Mon Dec 7 22:26:51 2009 +0100

    Fix the problem of fractional scores being imported as zero by using toDouble instead of toInt on the field in question.