]> git.sesse.net Git - vlc/commitdiff
WebUI: Fix loading playlist regression
authorMark Hassman <mark@hassman.org>
Sun, 5 Aug 2012 22:56:37 +0000 (18:56 -0400)
committerJean-Baptiste Kempf <jb@videolan.org>
Mon, 6 Aug 2012 15:44:10 +0000 (17:44 +0200)
Ref #5583

Also add a fail-safe to refresh playlist from server if local copy doesn't
contain active title.

Signed-off-by: Jean-Baptiste Kempf <jb@videolan.org>
share/lua/http/dialogs/browse_window.html
share/lua/http/index.html
share/lua/http/js/controlers.js

index a2011ed427f06dd9a10cc20caa469dc0f8f8b08a..c66ac49cd8eb69673ce5f530213f55b284014578 100644 (file)
@@ -20,6 +20,7 @@
                                                switch(browse_target){
                                                        default:
                                                                sendCommand('command=in_enqueue&input='+encodeURI(path));
+                                                               setTimeout(function(){updatePlayList(true);},1000);
                                                                break;
                                                }
                                        });
index 258ed2bf2cb0f199d18801219f94e47c1b2dfa9e..c13ac380e0a1c6a9372d6eb30c7a766b96892b33 100644 (file)
                                });
                                $('#buttonPlEmpty').click(function(){
                                        sendCommand({'command':'pl_empty'})
+                                       updatePlayList(true);
                                        return false;
                                });
                                $('#buttonLoop').click(function(){
                                                };
                                        });
                                        $('#libraryTree').jstree('deselect_all');
-                                       setTimeout(updatePlayList,1000);
+                                       setTimeout(function(){updatePlayList(true);},1000);
                                        return false;
                                });
                                $('#buttonStreams, #buttonStreams2').click(function(){
index 9233683d2e63c27afdb6a5502ff2f73c8ce2d1b8..42e1e54fc98fced2443b7693ae7fbacbe9051a47 100644 (file)
@@ -134,6 +134,7 @@ function updatePlayList(force_refresh) {
         $('#libraryTree').jstree('refresh', -1);
     } else {
         //iterate through playlist..
+        var match = false;
         $('.jstree-leaf').each(function(){
             var id = $(this).attr('id');
             if (id != null && id.substr(0,5) == 'plid_') {
@@ -142,6 +143,7 @@ function updatePlayList(force_refresh) {
                     $(this).addClass('ui-state-highlight');
                     $(this).attr('current', 'current');
                     this.scrollIntoView(true);
+                    match = true;
                 } else {
                     $(this).removeClass('ui-state-highlight');
                     $(this).removeAttr('current');
@@ -151,6 +153,8 @@ function updatePlayList(force_refresh) {
                 }
             }
        });
+       //local title wasn't found - refresh playlist..
+       if (!match) updatePlayList(true);
     }
 }
 
@@ -226,6 +230,7 @@ function browse(dir) {
                     break;
                 default:
                     sendCommand('command=in_play&input=' + encodeURIComponent($(this).attr('openfile')));
+                    updatePlayList(true);
                     break;
                 }
                 $('#window_browse').dialog('close');