]> git.sesse.net Git - vlc/commitdiff
Only reload album art in the HTTP interface if the track id changes (or if the user...
authorAntoine Cellerier <dionoea@videolan.org>
Sun, 19 Aug 2007 17:48:28 +0000 (17:48 +0000)
committerAntoine Cellerier <dionoea@videolan.org>
Sun, 19 Aug 2007 17:48:28 +0000 (17:48 +0000)
share/http/dialogs/main
share/http/js/functions.js

index 49086d4d34abb9d608a46abc8c66cf1b1cfc5054..ecf038a0766b9ef7aef3ab5d59440e3f3e9fa37e 100644 (file)
@@ -106,7 +106,7 @@ sout and playlist .
     <img src="images/slider_left.png" alt="slider left" /><span id="progressbar" style="background-image: url( 'images/slider_bar.png' ); width: 408px; height:16px; position:absolute;" onclick="slider_seek( event, this );" onmousemove="slider_move( event, this );"><img src="images/slider_point.png" alt="slider point" style="position:relative; left:0px;" id="main_slider_point" onmousedown="slider_down( event, this );" onmouseup="slider_up( event, this.parentNode );" onmouseout="slider_up( event, this.parentNode );"/></span><img src="images/slider_right.png" alt="slider right" style="position:relative;left:408px;" />
     <br/>
     <span id="nowplaying">(?)</span>
-    <img id="albumart" alt="Album art" src="/art" style="float: right" onclick="refresh_albumart();"/>
+    <img id="albumart" alt="" src="/art" style="float: right" onclick="refresh_albumart(true);"/>
   </div>
 </div>
 
index 7f2db21ab2ca17b14aa7b061838b443ceb2b79e7..e1dfe79a2417f377bc221ee9ba90fa6083eb6f51 100644 (file)
@@ -27,6 +27,7 @@
 
 var old_time = 0;
 var pl_cur_id;
+var albumart_id = -1;
 
 /**********************************************************************
  * Slider functions
@@ -1039,11 +1040,15 @@ function browse_path( p )
     hide( 'browse' );
     document.getElementById( value( 'browse_dest' ) ).focus();
 }
-function refresh_albumart()
+function refresh_albumart( force )
 {
-    var now = new Date();
-    var albumart = document.getElementById( 'albumart' );
-    albumart.src = '/art?timestamp=' + now.getTime();
+    if( albumart_id != pl_cur_id || force )
+    {
+        var now = new Date();
+        var albumart = document.getElementById( 'albumart' );
+        albumart.src = '/art?timestamp=' + now.getTime();
+        albumart_id = pl_cur_id;
+    }
 }
 /**********************************************************************
  * Periodically update stuff in the interface
@@ -1060,8 +1065,8 @@ function loop_refresh_playlist()
 }
 function loop_refresh_albumart()
 {
-    setTimeout( 'loop_refresh_albumart()', 10000 );
-    refresh_albumart();
+    setTimeout( 'loop_refresh_albumart()', 1000 );
+    refresh_albumart( false );
 }
 function loop_refresh()
 {