Bug 138292

Summary: Smart Playlist Option - Sort by - Random - RATING weighted
Product: [Applications] amarok Reporter: HairMetalAddict <hairmetaladdict>
Component: Playlists/Saved PlaylistsAssignee: Amarok Developers <amarok-bugs-dist>
Status: RESOLVED FIXED    
Severity: wishlist    
Priority: NOR    
Version: unspecified   
Target Milestone: ---   
Platform: Compiled Sources   
OS: Linux   
Latest Commit: Version Fixed In:

Description HairMetalAddict 2006-12-03 13:42:59 UTC
Version:           SVN061203 (using KDE Devel)
Installed from:    Compiled sources
OS:                Linux

Ratings have been around long enough for this...

For Smart Playlists, the Order By -> Random option gives options for:

- Completely Random
- Score Weighted

Being a having Rating user, I'd like to see a third option for "Rating Weighted". 

Allowing for a high number of 5.0 tracks, a bit less of 4.5, less of 4... down to (almost) never played 1.0 tracks.

Essentially similar to Score Weighted, just using Ratings instead.



(Was considering an option for this to limit it to ratings higher than "x" to not play unrated/1.0 or whatever tracks, but that can be done with a filter, so not applicable.)
Comment 1 Alexandre Oliveira 2006-12-31 14:53:02 UTC
SVN commit 618179 by aoliveira:

Rating weighted random order for smart playlists
BUG: 138292


 M  +3 -1      playlistbrowseritem.cpp  
 M  +11 -1     smartplaylisteditor.cpp  


--- trunk/extragear/multimedia/amarok/src/playlistbrowseritem.cpp #618178:618179
@@ -3256,7 +3256,9 @@
         {
             // shuffle
             if ( orderby.attribute("order" ) == "weighted" )
-                qb.shuffle( QueryBuilder::tabStats, QueryBuilder::valForFavoriteSorting() );
+                qb.shuffle( QueryBuilder::tabStats, QueryBuilder::valPercentage );
+            else if ( orderby.attribute("order" ) == "ratingweighted" )
+                qb.shuffle( QueryBuilder::tabStats, QueryBuilder::valRating );
             else
                 qb.shuffle();
         } else {
--- trunk/extragear/multimedia/amarok/src/smartplaylisteditor.cpp #618178:618179
@@ -127,6 +127,8 @@
         updateOrderTypes( dbfield );
         if ( orderby.attribute( "order" ) == "DESC" || orderby.attribute( "order" ) == "weighted" )
             m_orderTypeCombo->setCurrentItem( 1 );
+        else if ( orderby.attribute( "order" ) == "ratingweighted" )
+            m_orderTypeCombo->setCurrentItem( 2 );
         else
             m_orderTypeCombo->setCurrentItem( 0 );
     }
@@ -309,6 +311,7 @@
         m_orderTypeCombo->clear();
         m_orderTypeCombo->insertItem( i18n("Completely Random") );
         m_orderTypeCombo->insertItem( i18n("Score Weighted") );
+        m_orderTypeCombo->insertItem( i18n("Rating Weighted") );
     }
     else {  // ordinary order column selected
         m_orderTypeCombo->clear();
@@ -372,7 +375,14 @@
             orderby.setAttribute( "order", m_orderTypeCombo->currentItem() == 1 ? "DESC" : "ASC" );
         } else {
             orderby.setAttribute( "field", "random" );
-            orderby.setAttribute( "order", m_orderTypeCombo->currentItem() == 1 ? "weighted" : "random" );
+            QString order;
+            if ( m_orderTypeCombo->currentItem() == 0 )
+                order = "random";
+            else if ( m_orderTypeCombo->currentItem() == 1 )
+                order = "weighted";
+            else
+                order = "ratingweighted";
+            orderby.setAttribute( "order", order );
         }
 
         smartplaylist.appendChild( orderby );
Comment 2 HairMetalAddict 2007-01-03 09:35:48 UTC
Beautiful! Thanks a million. :-)