[vlc-commits] lua http: fix current int web intf

Francois Cartegnie git at videolan.org
Sat Apr 13 15:54:05 CEST 2013


vlc | branch: master | Francois Cartegnie <fcvlcdev at free.fr> | Sat Apr 13 15:51:31 2013 +0200| [cce2adb3b8266790a194ce5f617e66880a765ef4] | committer: Francois Cartegnie

lua http: fix current int web intf

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=cce2adb3b8266790a194ce5f617e66880a765ef4
---

 share/lua/http/js/controlers.js         |   22 ++++++++++------------
 share/lua/intf/modules/httprequests.lua |    2 ++
 2 files changed, 12 insertions(+), 12 deletions(-)

diff --git a/share/lua/http/js/controlers.js b/share/lua/http/js/controlers.js
index 42e1e54..8c3a419 100644
--- a/share/lua/http/js/controlers.js
+++ b/share/lua/http/js/controlers.js
@@ -1,8 +1,7 @@
-var current_id = 1;
 var currentArt = null;
 var current_que = 'main';
-var previous_title = null;
-var current_title = null;
+var current_playlist_id = -1;
+var previous_playlist_id = -1;
 
 function updateArt(url) {
     $('#albumArt').fadeOut(500, function () {
@@ -75,11 +74,11 @@ function updateStatus() {
                     updateArt(currentArt);
                 }
 
-                current_title = $('[name="filename"]', data).text();
-                if (previous_title != current_title) {
+                current_playlist_id = parseInt($('currentplid', data).text());
+                if (previous_playlist_id != current_playlist_id) {
                     updatePlayList();
+                    previous_playlist_id = current_playlist_id;
                 }
-                previous_title = current_title;
 
                 if (pollStatus) {
                     setTimeout(updateStatus, 1000);
@@ -138,8 +137,7 @@ function updatePlayList(force_refresh) {
         $('.jstree-leaf').each(function(){
             var id = $(this).attr('id');
             if (id != null && id.substr(0,5) == 'plid_') {
-                var name = $(this).attr('name');
-                if (name != null && name == current_title) {
+                if ( id.substr(5) == current_playlist_id ) {
                     $(this).addClass('ui-state-highlight');
                     $(this).attr('current', 'current');
                     this.scrollIntoView(true);
@@ -513,17 +511,17 @@ $(function () {
     }).bind("loaded.jstree", function (event, data) {
         $('[current]', '[id^="plid_"]').each(function () {
             $(this).addClass('ui-state-highlight');
-            current_id = $(this).attr('id').substr(5);
+            current_playlist_id = $(this).attr('id').substr(5);
         });
     }).bind("refresh.jstree", function (event, data) {
         $('[current]', '[id^="plid_"]').each(function () {
             $(this).addClass('ui-state-highlight');
-            current_id = $(this).attr('id').substr(5);
+            current_playlist_id = $(this).attr('id').substr(5);
         });
     }).delegate("#plid_2 li.jstree-leaf a", "click", function (event, data) {
         event.preventDefault();
-        current_id = $(this).parent().attr('id').substr(5);
-        sendCommand('command=pl_play&id=' + current_id);
+        current_playlist_id = $(this).parent().attr('id').substr(5);
+        sendCommand('command=pl_play&id=' + current_playlist_id);
     });
     updateStatus();
     updateStreams();
diff --git a/share/lua/intf/modules/httprequests.lua b/share/lua/intf/modules/httprequests.lua
index e387d9b..33be631 100644
--- a/share/lua/intf/modules/httprequests.lua
+++ b/share/lua/intf/modules/httprequests.lua
@@ -455,6 +455,7 @@ getstatus = function (includecategories)
         s.length=math.floor(vlc.var.get(input,"length"))
         s.time=math.floor(vlc.var.get(input,"time"))
         s.position=vlc.var.get(input,"position")
+        s.currentplid=vlc.playlist.current()
         s.audiodelay=vlc.var.get(input,"audio-delay")
         s.rate=vlc.var.get(input,"rate")
         s.subtitledelay=vlc.var.get(input,"spu-delay")
@@ -462,6 +463,7 @@ getstatus = function (includecategories)
         s.length=0
         s.time=0
         s.position=0
+        s.currentplid=-1
         s.audiodelay=0
         s.rate=1
         s.subtitledelay=0



More information about the vlc-commits mailing list