Bug 126548 - always show an album's total play time
Summary: always show an album's total play time
Status: RESOLVED FIXED
Alias: None
Product: amarok
Classification: Applications
Component: general (show other bugs)
Version: 1.4-SVN
Platform: unspecified Linux
: NOR wishlist
Target Milestone: ---
Assignee: Amarok Developers
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2006-05-01 00:14 UTC by camico
Modified: 2008-09-13 01:24 UTC (History)
1 user (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments
Adds Lengths to the Context Browser (7.13 KB, patch)
2006-05-01 12:39 UTC, Peter C. Ndikuwera
Details

Note You need to log in before you can comment on or make changes to this bug.
Description camico 2006-05-01 00:14:57 UTC
Version:           1.4-SVN (using KDE KDE 3.5.2)

There's no direct way to read the total play time of an album. Which IMO is an essential piece of information. (that's why most CD players, HiFi systems,.. show it.)
Currently I have to either set a playlist filter that matches the album, or select all tracks of an album (point, click, point, press shift, click - complicated.)
I'd suggest to put the information in the "Albums By ..."-box just below "xx Tracks".
And/Or, for the currently playing album, next to the large cover (if the album's got more than one track).
Comment 1 Peter C. Ndikuwera 2006-05-01 12:39:27 UTC
Created attachment 15869 [details]
Adds Lengths to the Context Browser

Here you go.

Still ironing out some alignment issues but works fine for me.

If it's ok, will submit to SVN later today.
Comment 2 Peter C. Ndikuwera 2006-05-01 18:01:50 UTC
SVN commit 536196 by pndiku:

CCBUG: 126548
Add total track times for Albums.

NOTE: This is easily backed out! Seems not to look too neat with certain long
album names.


 M  +26 -7     contextbrowser.cpp  
 M  +1 -0      htmlview.cpp  


--- trunk/extragear/multimedia/amarok/src/contextbrowser.cpp #536195:536196
@@ -1077,17 +1077,22 @@
         QStringList albumValues = qb.run();
 
         QString albumYear;
+		uint i_albumLength = 0;
         if ( !albumValues.isEmpty() )
         {
             albumYear = albumValues[ 3 ];
-            for ( uint j = 0; j < albumValues.count(); j += 7 )
+            for ( uint j = 0; j < albumValues.count(); j += 7 ) {
+				i_albumLength += QString(albumValues[j + 4]).toInt();
                 if ( albumValues[j + 3] != albumYear || albumYear == "0" )
                 {
                     albumYear = QString::null;
                     break;
                 }
+			}
         }
 
+		QString albumLength = MetaBundle::prettyTime( i_albumLength, true );
+
         htmlCode.append( QStringx (
                     "<tr class='" + QString( (i % 4) ? "box-row-alt" : "box-row" ) + "'>"
                     "<td>"
@@ -1156,15 +1161,17 @@
                         << albumName ) );
         }
 
-        // Tracks number and year
+        // Tracks number, year and length
         htmlCode.append( QStringx (
                     "<span class='album-info'>%1</span> "
                     "<br />"
                     "<span class='album-year'>%2</span>"
+                    "<span class='album-length'>%3</span>"
                     "</td>")
                 .args( QStringList()
                     << i18n( "Single", "%n Tracks",  albumValues.count() / qb.countReturnValues() )
-                    << albumYear) );
+                    << albumYear
+					<< albumLength) );
 
         // Begining of the 'toggleable div' that contains the songs
         htmlCode.append( QStringx (
@@ -2094,17 +2101,21 @@
             usleep( 10000 );
 
             QString albumYear;
+            uint i_albumLength = 0;
             if ( !albumValues.isEmpty() )
             {
                 albumYear = albumValues[ 3 ];
-                for ( uint j = 0; j < albumValues.count(); j += qb.countReturnValues() )
+                for ( uint j = 0; j < albumValues.count(); j += qb.countReturnValues() ) {
+                    i_albumLength += QString(albumValues[j + 4]).toInt();
                     if ( albumValues[j + 3] != albumYear || albumYear == "0" )
                     {
                         albumYear = QString::null;
                         break;
                     }
+                }
             }
 
+            QString albumLength = MetaBundle::prettyTime( i_albumLength, true );
             QString albumImage = CollectionDB::instance()->albumImage( artist, values[ i ], 50 );
             QString albumImageTitleAttr = albumImageTitle( albumImage, 50 );
             albumImage = ContextBrowser::makeShadowedImage( albumImage );
@@ -2125,11 +2136,12 @@
                         "<a href='album:%7 @@@ %8'><span class='album-title'>%9</span></a>"
                         "<br />"
                         "<span class='album-year'>%10</span>"
+                        "<span class='album-length'>%11</span>"
                         "</td>"
                         "</tr>"
                         "</table>"
                         "</div>"
-                        "<div class='album-body' style='display:%11;' id='IDA%12'>" )
+                        "<div class='album-body' style='display:%12;' id='IDA%13'>" )
                     .args( QStringList()
                         << values[ i + 1 ]
                         << escapeHTMLAttr( artist ) // artist name
@@ -2141,6 +2153,7 @@
                         << values[ i + 1 ] //album.id
                         << escapeHTML( values[ i ].isEmpty() ? i18n( "Unknown" ) : values[ i ] )
                         << albumYear
+                        << albumLength
                         << ( i!=vectorPlace ? "none" : "block" ) /* shows it if it's the current track album */
                         << values[ i + 1 ] ) );
 
@@ -2240,17 +2253,21 @@
             usleep( 10000 );
 
             QString albumYear;
+            uint i_albumLength = 0;
             if ( !albumValues.isEmpty() )
             {
                 albumYear = albumValues[ 3 ];
-                for ( uint j = 0; j < albumValues.count(); j += qb.countReturnValues() )
+                for ( uint j = 0; j < albumValues.count(); j += qb.countReturnValues() ) {
+                    i_albumLength += QString(albumValues[j + 4]).toInt();
                     if ( albumValues[j + 3] != albumYear || albumYear == "0" )
                     {
                         albumYear = QString::null;
                         break;
                     }
+				}
             }
 
+            QString albumLength = MetaBundle::prettyTime( i_albumLength, true );
             QString albumImage = CollectionDB::instance()->albumImage( artist, values[ i ], 50 );
             QString albumImageTitleAttr = albumImageTitle( albumImage, 50 );
             albumImage = ContextBrowser::makeShadowedImage( albumImage );
@@ -2271,11 +2288,12 @@
                         "<a href='compilation:%6'><span class='album-title'>%7</span></a>"
                         "<br />"
                         "<span class='album-year'>%8</span>"
+                        "<span class='album-length'>%9</span>"
                         "</td>"
                         "</tr>"
                         "</table>"
                         "</div>"
-                        "<div class='album-body' style='display:%9;' id='IDA%10'>" )
+                        "<div class='album-body' style='display:%10;' id='IDA%11'>" )
                     .args( QStringList()
                         << values[ i + 1 ]
                         << escapeHTMLAttr( values[ i ].isEmpty() ? i18n( "Unknown" ) : values[ i ] ) // album.name
@@ -2285,6 +2303,7 @@
                         << values[ i + 1 ] //album.id
                         << escapeHTML( values[ i ].isEmpty() ? i18n( "Unknown" ) : values[ i ] )
                         << albumYear
+                        << albumLength
                         << ( i!=vectorPlace ? "none" : "block" ) /* shows it if it's the current track album */
                         << values[ i + 1 ] ) );
 
--- trunk/extragear/multimedia/amarok/src/htmlview.cpp #536195:536196
@@ -195,6 +195,7 @@
         styleSheet += QString( ".album-body { background-color: %1; border-bottom: solid %2 1px; border-top: solid %3 1px; }" ).arg( ContextBrowser::instance()->colorGroup().base().name() ).arg( bg ).arg( bg );
         styleSheet += QString( ".album-title { font-weight: bold; }" );
         styleSheet += QString( ".album-info { float:right; padding-right:4px; font-size: %1px }" ).arg( pxSize );
+        styleSheet += QString( ".album-length { float:right; padding-right:4px; font-size: %1px; clear:right; }" ).arg( pxSize );
         styleSheet += QString( ".album-image { padding-right: 4px; }" );
         styleSheet += QString( ".album-song a { display: block; padding: 1px 2px; font-weight: normal; text-decoration: none; }" );
         styleSheet += QString( ".album-song a:hover { color: %1; background-color: %2; }" ).arg( fg ).arg( bg );
Comment 3 Seb Ruiz 2006-05-03 14:01:22 UTC
this is fixed, i believe
Comment 4 a thing 2008-09-13 01:24:50 UTC
How about bringing this back in Amarok 2?