[vlc-devel] [PATCH 3/3] http-interface: playlist with channels name

Rustem Valeev r-green at mail.ru
Sat Mar 12 09:00:12 CET 2011


---
 share/http/js/functions.js |   24 +++++++++++++++++++++---
 1 files changed, 21 insertions(+), 3 deletions(-)

diff --git a/share/http/js/functions.js b/share/http/js/functions.js
index c09222c..b881f64 100644
--- a/share/http/js/functions.js
+++ b/share/http/js/functions.js
@@ -553,6 +553,23 @@ function parse_status()
     }
 }
 
+/* get child first text */
+function getChildText(o, name, defValue)
+{
+  for(var c=o.firstChild; c; c=c.nextSibling)
+  {
+    if(c.nodeName == name)
+    {
+      try
+      {  
+        return c.firstChild.textContent;
+      }
+      catch(x) {}
+    }
+  }
+  return defValue;
+}
+
 /* parse playlist.xml */
 function parse_playlist()
 {
@@ -620,8 +637,9 @@ function parse_playlist()
                         pl.appendChild( document.createTextNode( '' ));
                         pl_cur_id = elt.getAttribute( 'id' );
                     }
-                    pl.setAttribute( 'title', elt.getAttribute( 'uri' ));
-                    pl.appendChild( document.createTextNode( elt.getAttribute( 'name' ) ) );
+                    pl.setAttribute( 'title', getChildText( elt, 'description', elt.getAttribute( 'uri' )) );
+
+                    pl.appendChild( document.createTextNode( getChildText(elt,'title',elt.getAttribute('name') ) ) );
                     var duration = elt.getAttribute( 'duration' );
                     if( duration > 0 )
                         pl.appendChild( document.createTextNode( " (" + format_time( elt.getAttribute( 'duration' ) / 1000000 ) + ")" ) );
@@ -1140,7 +1158,7 @@ function refresh_albumart( force )
  *********************************************************************/
 function loop_refresh_status()
 {
-    setTimeout( 'loop_refresh_status()', 1000 );
+    /* setTimeout( 'loop_refresh_status()', 1000 ); */
     update_status();
 }
 function loop_refresh_playlist()
-- 
1.7.1




More information about the vlc-devel mailing list