[prev in list] [next in list] [prev in thread] [next in thread] 

List:       amarok-bugs-dist
Subject:    [Bug 140980] last played track does not get counted and rated
From:       Jeff Mitchell <kde-dev () emailgoeshere ! com>
Date:       2007-04-30 18:40:21
Message-ID: 20070430184021.16083.qmail () ktown ! kde ! org
[Download RAW message or body]

------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.
         
http://bugs.kde.org/show_bug.cgi?id=140980         
kde-dev emailgoeshere com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |FIXED



------- Additional Comments From kde-dev emailgoeshere com  2007-04-30 20:40 -------
SVN commit 659747 by mitchell:

zOMG, the bug that wouldn't die...took forever to figure this one out.  Fixed, \
though.

BUG: 140980


 M  +6 -2      collectiondb.cpp  
 M  +12 -0     enginecontroller.cpp  
 M  +3 -1      enginecontroller.h  
 M  +3 -5      playlist.cpp  


--- branches/stable/extragear/multimedia/amarok/src/collectiondb.cpp #659746:659747
 @ -4842,8 +4842,12  @
     // Don't update statistics if song has been played for less than 15 seconds
     // if ( finalPosition < 15000 ) return;
 
-    const KURL url = EngineController::instance()->bundle().url();
-    debug() << "track ended: " << url.url() << endl;
+    //below check is necessary because if stop after current track is selected,
+    //the url's path will be empty, so check the previous URL for the path that
+    //had just played
+    const KURL url = EngineController::instance()->bundle().url().path().isEmpty() ?
+                            EngineController::instance()->previousURL() :
+                            EngineController::instance()->bundle().url();
     PodcastEpisodeBundle peb;
     if( getPodcastEpisodeBundle( url.url(), &peb ) )
     {
--- branches/stable/extragear/multimedia/amarok/src/enginecontroller.cpp \
#659746:659747  @ -323,6 +323,7  @
 
 void EngineController::next( bool forceNext ) //SLOT
 {
+    m_previousUrl = m_bundle.url();
     m_isTiming = false;
     emit orderNext(forceNext);
 }
 @ -426,6 +427,10  @
     {
         //assign bundle now so that it is available when the engine
         //emits stateChanged( Playing )
+        if( !m_bundle.url().path().isEmpty() ) //wasn't playing before
+            m_previousUrl = m_bundle.url();
+        else
+            m_previousUrl = bundle.url();
         m_bundle = bundle;
 
         if( m_engine->play( offset ) )
 @ -640,6 +645,7  @
 
     m_lastMetadata << bundle;
 
+    m_previousUrl = m_bundle.url();
     m_bundle = bundle;
     m_lastPositionOffset = m_positionOffset;
     if( m_lastFm )
 @ -649,6 +655,12  @
     newMetaDataNotify( m_bundle, false /* not a new track */ );
 }
 
+void EngineController::currentTrackMetaDataChanged( const MetaBundle& bundle )
+{
+    m_previousUrl = m_bundle.url();
+    m_bundle = bundle;
+    newMetaDataNotify( bundle, false /* no track change */ );
+}
 
 //////////////////////////////////////////////////////////////////////////////////////////
  // PRIVATE SLOTS
--- branches/stable/extragear/multimedia/amarok/src/enginecontroller.h #659746:659747
 @ -55,6 +55,7  @
 
     uint trackLength() const { return m_bundle.length() * 1000; }
     const MetaBundle &bundle() const;
+    KURL previousURL() const { return m_previousUrl; }
     KURL playingURL() const { return bundle().url(); }
 
     void restoreSession();
 @ -94,7 +95,7  @
     void playlistChanged() { m_engine->playlistChanged(); }
 
     void slotStreamMetaData( const MetaBundle &bundle );
-    void currentTrackMetaDataChanged( const MetaBundle& bundle ) { m_bundle = \
bundle; newMetaDataNotify( bundle, false /* no track change */ ); } +    void \
currentTrackMetaDataChanged( const MetaBundle& bundle );  
 signals:
     void orderPrevious();
 @ -124,6 +125,7  @
     EngineBase*     m_engine;
     EngineBase*     m_voidEngine;
     MetaBundle      m_bundle;
+    KURL            m_previousUrl;
     BundleList      m_lastMetadata;
     long            m_delayTime;
     int             m_muteVolume;
--- branches/stable/extragear/multimedia/amarok/src/playlist.cpp #659746:659747
 @ -940,8 +940,8  @
             m_dynamicDirt = false;
         }
 
-        setStopAfterMode(DoNotStop);
         EngineController::instance()->stop();
+        setStopAfterMode( DoNotStop );
 
         if( !AmarokConfig::randomMode() ) {
             item = MyIt::nextVisible( item );
 @ -1415,7 +1415,8  @
         prev_stopafter->update();
 }
 
-void Playlist::setStopAfterItem( PlaylistItem *item ) {
+void Playlist::setStopAfterItem( PlaylistItem *item )
+{
     if( !item ) {
         setStopAfterMode( DoNotStop );
         return;
 @ -2057,9 +2058,6  @
 
             PlaylistItem::setPixmapChanged();
 
-            if( stopAfterMode() == StopAfterCurrent )
-                setStopAfterMode( DoNotStop );
-
             //reset glow state
             slotGlowTimer();
         }
_______________________________________________
Amarok-bugs-dist mailing list
Amarok-bugs-dist@kde.org
https://mail.kde.org/mailman/listinfo/amarok-bugs-dist


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic