[vlc-commits] WebUI: Fix loading playlist regression

Mark Hassman git at videolan.org
Mon Aug 6 22:45:28 CEST 2012


vlc | branch: master | Mark Hassman <mark at hassman.org> | Sun Aug  5 18:56:37 2012 -0400| [b4cf7a9b5b5c568dd2cec85ff880f92703999814] | committer: Jean-Baptiste Kempf

WebUI: Fix loading playlist regression

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 at videolan.org>

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

 share/lua/http/dialogs/browse_window.html |    1 +
 share/lua/http/index.html                 |    3 ++-
 share/lua/http/js/controlers.js           |    5 +++++
 3 files changed, 8 insertions(+), 1 deletion(-)

diff --git a/share/lua/http/dialogs/browse_window.html b/share/lua/http/dialogs/browse_window.html
index a2011ed..c66ac49 100644
--- a/share/lua/http/dialogs/browse_window.html
+++ b/share/lua/http/dialogs/browse_window.html
@@ -20,6 +20,7 @@
 						switch(browse_target){
 							default:
 								sendCommand('command=in_enqueue&input='+encodeURI(path));
+								setTimeout(function(){updatePlayList(true);},1000);
 								break;
 						}
 					});
diff --git a/share/lua/http/index.html b/share/lua/http/index.html
index 258ed2b..c13ac38 100644
--- a/share/lua/http/index.html
+++ b/share/lua/http/index.html
@@ -108,6 +108,7 @@
 				});
 				$('#buttonPlEmpty').click(function(){
 					sendCommand({'command':'pl_empty'})
+					updatePlayList(true);
 					return false;
 				});
 				$('#buttonLoop').click(function(){
@@ -143,7 +144,7 @@
 						};
 					});
 					$('#libraryTree').jstree('deselect_all');
-					setTimeout(updatePlayList,1000);
+					setTimeout(function(){updatePlayList(true);},1000);
 					return false;
 				});
 				$('#buttonStreams, #buttonStreams2').click(function(){
diff --git a/share/lua/http/js/controlers.js b/share/lua/http/js/controlers.js
index 9233683..42e1e54 100644
--- a/share/lua/http/js/controlers.js
+++ b/share/lua/http/js/controlers.js
@@ -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');



More information about the vlc-commits mailing list