Bug 137916 - amarok assigns wrong deviceid
Summary: amarok assigns wrong deviceid
Status: RESOLVED FIXED
Alias: None
Product: amarok
Classification: Applications
Component: general (show other bugs)
Version: unspecified
Platform: Gentoo Packages Linux
: NOR normal
Target Milestone: ---
Assignee: Amarok Developers
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2006-11-26 16:38 UTC by Dominik Karall
Modified: 2007-02-03 18:11 UTC (History)
0 users

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Dominik Karall 2006-11-26 16:38:43 UTC
Version:           SVN-26.11.2006 (using KDE KDE 3.5.5)
Installed from:    Gentoo Packages

hi,
after updating amarok today I get following entries in my amarokrc:
[Collection Folders]
 -1=./mnt/extHDD1/Music,./mnt/DATA/Public/Musik
 1=./mnt/extHDD1/Music
 3=./Public/Musik

1,3 are correct, those are the deviceids I got before too. but -1 is new and so all my statistics aren't touched any more, because the new deviceid is -1 and the statistics use 1 and 3. I tried to set all my statistics table to -1, but that gave an sql uniqueness error.
btw, I needed to select my collection folders again after the update, because they weren't selected any more.

thx,
dominik
Comment 1 Maximilian Kossick 2006-11-26 17:06:03 UTC
SVN commit 608062 by mkossick:

drop complete tables when clearing tables. Fixes a problem where the statistics rows are not 
updated when deviceid/url when the deviceid/url for a song changed. This code was only 
necessary for CDs/DVDs anyway.
CCBUG: 137916

 M  +13 -20    collectiondb.cpp  


--- trunk/extragear/multimedia/amarok/src/collectiondb.cpp #608061:608062
@@ -763,29 +763,22 @@
 CollectionDB::clearTables( const bool temporary )
 {
     QString clearCommand = "DELETE FROM";
-    //if ( getDbConnectionType() == DbConnection::mysql || getDbConnectionType() == DbConnection::postgresql)
-    //{
-        // TRUNCATE TABLE is faster than DELETE FROM TABLE, so use it when supported.
-    //    clearCommand = "TRUNCATE TABLE";
-    //}
-    IdList list = MountPointManager::instance()->getMountedDeviceIds();
-    QString deviceIds = "";
-    foreachType( IdList, list )
+    if ( getDbConnectionType() == DbConnection::mysql || getDbConnectionType() == DbConnection::postgresql)
     {
-        if ( it != list.begin() ) deviceIds += ',';
-        deviceIds += QString::number(*it);
+        // TRUNCATE TABLE is faster than DELETE FROM TABLE, so use it when supported.
+        clearCommand = "TRUNCATE TABLE";
     }
 
-    query( QString( "%1 tags%2 WHERE deviceid IN (%3);" ).arg( clearCommand ).arg( temporary ? "_temp" : "" ).arg( deviceIds ) );
-    //query( QString( "%1 album%2;" ).arg( clearCommand ).arg( temporary ? "_temp" : "" ) );
-    //query( QString( "%1 artist%2;" ).arg( clearCommand ).arg( temporary ? "_temp" : "" ) );
-    //query( QString( "%1 composer%2;" ).arg( clearCommand ).arg( temporary ? "_temp" : "" ) );
-    //query( QString( "%1 genre%2;" ).arg( clearCommand ).arg( temporary ? "_temp" : "" ) );
-    //query( QString( "%1 year%2;" ).arg( clearCommand ).arg( temporary ? "_temp" : "" ) );
-    query( QString( "%1 images%2 WHERE deviceid IN (%3);" ).arg( clearCommand ).arg( temporary ? "_temp" : "" ).arg( deviceIds ) );
-    query( QString( "%1 embed%2 WHERE deviceid IN (%3);" ).arg( clearCommand ).arg( temporary ? "_temp" : "" ).arg( deviceIds ) );
-    query( QString( "%1 directories%2 WHERE deviceid IN (%3);" ).arg( clearCommand ).arg( temporary ? "_temp" : "" ).arg( deviceIds ) );
-    query( QString( "%1 uniqueid%2 WHERE deviceid IN (%3);" ).arg( clearCommand ).arg( temporary ? "_temp" : "" ).arg( deviceIds ) );
+    query( QString( "%1 tags%2;" ).arg( clearCommand ).arg( temporary ? "_temp" : "" ) );
+    query( QString( "%1 album%2;" ).arg( clearCommand ).arg( temporary ? "_temp" : "" ) );
+    query( QString( "%1 artist%2;" ).arg( clearCommand ).arg( temporary ? "_temp" : "" ) );
+    query( QString( "%1 composer%2;" ).arg( clearCommand ).arg( temporary ? "_temp" : "" ) );
+    query( QString( "%1 genre%2;" ).arg( clearCommand ).arg( temporary ? "_temp" : "" ) );
+    query( QString( "%1 year%2;" ).arg( clearCommand ).arg( temporary ? "_temp" : "" ) );
+    query( QString( "%1 images%2;" ).arg( clearCommand ).arg( temporary ? "_temp" : "" ) );
+    query( QString( "%1 embed%2;" ).arg( clearCommand ).arg( temporary ? "_temp" : "" ) );
+    query( QString( "%1 directories%2;" ).arg( clearCommand ).arg( temporary ? "_temp" : "" ) );
+    query( QString( "%1 uniqueid%2;" ).arg( clearCommand ).arg( temporary ? "_temp" : "" ) );
     if ( !temporary )
     {
         query( QString( "%1 related_artists;" ).arg( clearCommand ) );
Comment 2 Maximilian Kossick 2006-11-26 17:11:01 UTC
It looks like your KDE mediamanager is not working correctly. Therefore Amarok uses the deviceid -1. SVN revision 608062 fixes the problem that your statistics are not updated with the new deviceid/url of your songs.
Comment 3 shattered 2007-02-03 18:11:33 UTC
mediamanager may be stopped by k3b -- see bug 134153