Bug 138150 - 'synchronize' with amarok statistics for iPod actually WIPES all iPod ratings
Summary: 'synchronize' with amarok statistics for iPod actually WIPES all iPod ratings
Status: RESOLVED FIXED
Alias: None
Product: amarok
Classification: Applications
Component: general (show other bugs)
Version: unspecified
Platform: Ubuntu Linux
: NOR normal
Target Milestone: ---
Assignee: Amarok Developers
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2006-11-30 13:34 UTC by Michiel
Modified: 2006-11-30 19:29 UTC (History)
0 users

See Also:
Latest Commit:
Version Fixed In:
Sentry Crash Report:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Michiel 2006-11-30 13:34:07 UTC
Version:            (using KDE KDE 3.5.2)
Installed from:    Ubuntu Packages
OS:                Linux

Maybe I misunderstand the meaning of 'synchronize'.

I have previously used Amarok but went back to windows (for reasons unrelated to Amarok, it is stil a kickass audio player). Now I have installed Ubuntu. Installed Amarok.

Connected my ipod, and it was properly recognised. I went into the settings to 'configure media device' and saw the 'synchronize' option. I checked it. Fiddled around for a bit, rated some songs, and then synced with the ipod. Disconnected the ipod, success! My ratings had propagated.
Then I went to one of my rating-based playlists and everything was gone.
Why? Because Amarok has just wiped out all existing ratings.

I suggest that if you find a rating on the ipod and no rating exists on Amarok you should probably set the Amarok rating to the ipod one, not remove the ipod rating.

I spent a lot of time rating those songs so I am a little ticked off.
Comment 1 Martin Aumueller 2006-11-30 18:12:41 UTC
SVN commit 609407 by aumuell:

only synchronize already set values to media devices
BUG: 138150


 M  +1 -0      ChangeLog  
 M  +20 -11    src/mediabrowser.cpp  
 M  +1 -0      src/mediabrowser.h  


--- trunk/extragear/multimedia/amarok/ChangeLog #609406:609407
@@ -47,6 +47,7 @@
     * Amarok now saves playlists with relative paths by default.
 
   BUGFIXES:
+    * Only synchronize already set values to media devices. (BR 138150)
     * Correctly update total playlist play time when removing last.fm
       streams. Patch by Modestas Vainius <geromanas@mailas.com>. (BR 134333)
     * File organization jobs could not be canceled. Patch by Wenli Liu
--- trunk/extragear/multimedia/amarok/src/mediabrowser.cpp #609406:609407
@@ -2803,6 +2803,24 @@
 }
 
 void
+MediaItem::syncStatsFromPath( const QString &url )
+{
+    if( url.isEmpty() )
+        return;
+
+    // copy Amarok rating, play count and last played time to device
+    int rating = CollectionDB::instance()->getSongRating( url )*10;
+    if( rating )
+        setRating( rating );
+    int playcount = CollectionDB::instance()->getPlayCount( url );
+    if( playcount > played() )
+        setPlayCount( playcount );
+    QDateTime lastplay = CollectionDB::instance()->getLastPlay( url );
+    if( lastplay > playTime() )
+        setLastPlayed( lastplay.toTime_t() );
+}
+
+void
 MediaDevice::syncStatsToDevice( MediaItem *root )
 {
     MediaItem *it = static_cast<MediaItem *>( m_view->firstChild() );
@@ -2820,15 +2838,7 @@
             {
                 const MetaBundle *bundle = it->bundle();
                 QString url = CollectionDB::instance()->getURL( *bundle );
-
-                if( url != QString::null )
-                {
-                    // copy Amarok rating, play count and last played time to device
-                    int rating = CollectionDB::instance()->getSongRating( url )*10;
-                    it->setRating( rating );
-                    it->setPlayCount( CollectionDB::instance()->getPlayCount( url ) );
-                    it->setLastPlayed( CollectionDB::instance()->getLastPlay( url ).toTime_t() );
-                }
+                it->syncStatsFromPath( url );
             }
             break;
 
@@ -3015,8 +3025,7 @@
             if( !item )
                 continue;
 
-            int rating = CollectionDB::instance()->getSongRating( (*it).url().path() ) * 10;
-            item->setRating( rating );
+            item->syncStatsFromPath( (*it).url().path() );
 
             if( m_playlistItem && !playlist.isEmpty() )
             {
--- trunk/extragear/multimedia/amarok/src/mediabrowser.h #609406:609407
@@ -81,6 +81,7 @@
         virtual void setRating( int /*rating*/ ) {}
         virtual bool ratingChanged()  const { return false; }
         virtual void setLastPlayed( uint ) {}
+        virtual void syncStatsFromPath( const QString &path );
         virtual long size()           const;
         virtual MediaDevice *device() const { return m_device; }
         virtual bool listened()       const { return m_listened; }
Comment 2 Michiel 2006-11-30 19:29:02 UTC
wow, that was fast!