]> git.sesse.net Git - vlc/commitdiff
lua http: fix current int web intf
authorFrancois Cartegnie <fcvlcdev@free.fr>
Sat, 13 Apr 2013 13:51:31 +0000 (15:51 +0200)
committerFrancois Cartegnie <fcvlcdev@free.fr>
Sat, 13 Apr 2013 13:52:57 +0000 (15:52 +0200)
share/lua/http/js/controlers.js
share/lua/intf/modules/httprequests.lua

index 42e1e54fc98fced2443b7693ae7fbacbe9051a47..8c3a419b25232f4c75d23295b7a67c0f9adaca0c 100644 (file)
@@ -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();
index e387d9b9747ca3d7f10272de0b6ba0250714f273..33be631e3dc7a5216d01effe12b3a9059c2b6d19 100644 (file)
@@ -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