Bug 115212

Summary: Last.FM/scrobbler queue contents not saved to disk
Product: [Applications] amarok Reporter: John Patterson <kde-bugs>
Component: generalAssignee: Amarok Developers <amarok-bugs-dist>
Status: RESOLVED FIXED    
Severity: normal CC: andi
Priority: NOR    
Version: 1.3.5   
Target Milestone: ---   
Platform: Slackware   
OS: Linux   
Latest Commit: Version Fixed In:
Attachments: Patch to import submitQueue after adding queue entries

Description John Patterson 2005-10-27 20:02:24 UTC
Version:           1.3.5 (using KDE KDE 3.4.2)
Installed from:    Slackware Packages
Compiler:          GCC 3.3.6 
OS:                Linux

When a track submission to Last.FM fails, amaroK places it in a queue.  This queue is saved to disk, but unfortunately (since version 1.3.3 or earlier) amaroK fails to add the details of the queued items to the actual document it saves out.

The change that broke this seems to be that instead of appending submitQueue to newdoc directly, it is imported (via importNode) as submitNode, which is then appended to newdoc - however the import is done before the queue items have been added to submitQueue.
Comment 1 John Patterson 2005-10-27 20:05:08 UTC
Created attachment 13182 [details]
Patch to import submitQueue after adding queue entries

With this patch added, amaroK saves the submissions queue properly, and queued
submissions aren't lost when the app is closed and restarted.
Comment 2 Andreas Heinz 2005-10-29 01:21:12 UTC
havent applied the patch, but for me it looks good ;) and i experience the same, submit.xml stays empty even when submits fail
Comment 3 Alexandre Oliveira 2005-10-29 03:58:33 UTC
SVN commit 475384 by aoliveira:

last.fm queue wouldn't be saved to disk. 
Patch by John Patterson  <kde-bugs@ninecats.org>. 
BUG: 115212



 M  +2 -0      ChangeLog  
 M  +3 -2      src/scrobbler.cpp  


--- branches/stable/extragear/multimedia/amarok/ChangeLog #475383:475384
@@ -5,6 +5,8 @@
 
 VERSION 1.3.6:
   BUGFIXES:
+    * last.fm queue wouldn't be saved to disk. Patch by John Patterson
+      <kde-bugs@ninecats.org>. (BR 115212)
     * Podcast download directory would only be effective next time
       the application started.
     * Don't crash when attempting to save an empty playlist from the
--- branches/stable/extragear/multimedia/amarok/src/scrobbler.cpp #475383:475384
@@ -986,8 +986,6 @@
     QDomElement submitQueue = newdoc.createElement( "submit" );
     submitQueue.setAttribute( "product", "amaroK" );
     submitQueue.setAttribute( "version", APP_VERSION );
-    QDomNode submitNode = newdoc.importNode( submitQueue, true );
-    newdoc.appendChild( submitNode );
 
     m_submitQueue.first();
     for ( uint idx = 0; idx < m_submitQueue.count(); idx++ )
@@ -997,6 +995,9 @@
         submitQueue.appendChild( i );
     }
 
+    QDomNode submitNode = newdoc.importNode( submitQueue, true );
+    newdoc.appendChild( submitNode );
+
     QTextStream stream( &file );
     stream.setEncoding( QTextStream::UnicodeUTF8 );
     stream << "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n";
Comment 4 Alexandre Oliveira 2005-10-29 04:00:14 UTC
SVN commit 475385 by aoliveira:

last.fm queue wouldn't be saved to disk.
Patch by John Patterson <kde-bugs@ninecats.org>.	
CCBUG: 115212


 M  +3 -2      scrobbler.cpp  


--- trunk/extragear/multimedia/amarok/src/scrobbler.cpp #475384:475385
@@ -986,8 +986,6 @@
     QDomElement submitQueue = newdoc.createElement( "submit" );
     submitQueue.setAttribute( "product", "amaroK" );
     submitQueue.setAttribute( "version", APP_VERSION );
-    QDomNode submitNode = newdoc.importNode( submitQueue, true );
-    newdoc.appendChild( submitNode );
 
     m_submitQueue.first();
     for ( uint idx = 0; idx < m_submitQueue.count(); idx++ )
@@ -997,6 +995,9 @@
         submitQueue.appendChild( i );
     }
 
+    QDomNode submitNode = newdoc.importNode( submitQueue, true );
+    newdoc.appendChild( submitNode );
+
     QTextStream stream( &file );
     stream.setEncoding( QTextStream::UnicodeUTF8 );
     stream << "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n";