Commit b4cf7a9b authored by Mark Hassman's avatar Mark Hassman Committed by 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: default avatarJean-Baptiste Kempf <jb@videolan.org>
parent d80b0715
...@@ -20,6 +20,7 @@ ...@@ -20,6 +20,7 @@
switch(browse_target){ switch(browse_target){
default: default:
sendCommand('command=in_enqueue&input='+encodeURI(path)); sendCommand('command=in_enqueue&input='+encodeURI(path));
setTimeout(function(){updatePlayList(true);},1000);
break; break;
} }
}); });
......
...@@ -108,6 +108,7 @@ ...@@ -108,6 +108,7 @@
}); });
$('#buttonPlEmpty').click(function(){ $('#buttonPlEmpty').click(function(){
sendCommand({'command':'pl_empty'}) sendCommand({'command':'pl_empty'})
updatePlayList(true);
return false; return false;
}); });
$('#buttonLoop').click(function(){ $('#buttonLoop').click(function(){
...@@ -143,7 +144,7 @@ ...@@ -143,7 +144,7 @@
}; };
}); });
$('#libraryTree').jstree('deselect_all'); $('#libraryTree').jstree('deselect_all');
setTimeout(updatePlayList,1000); setTimeout(function(){updatePlayList(true);},1000);
return false; return false;
}); });
$('#buttonStreams, #buttonStreams2').click(function(){ $('#buttonStreams, #buttonStreams2').click(function(){
......
...@@ -134,6 +134,7 @@ function updatePlayList(force_refresh) { ...@@ -134,6 +134,7 @@ function updatePlayList(force_refresh) {
$('#libraryTree').jstree('refresh', -1); $('#libraryTree').jstree('refresh', -1);
} else { } else {
//iterate through playlist.. //iterate through playlist..
var match = false;
$('.jstree-leaf').each(function(){ $('.jstree-leaf').each(function(){
var id = $(this).attr('id'); var id = $(this).attr('id');
if (id != null && id.substr(0,5) == 'plid_') { if (id != null && id.substr(0,5) == 'plid_') {
...@@ -142,6 +143,7 @@ function updatePlayList(force_refresh) { ...@@ -142,6 +143,7 @@ function updatePlayList(force_refresh) {
$(this).addClass('ui-state-highlight'); $(this).addClass('ui-state-highlight');
$(this).attr('current', 'current'); $(this).attr('current', 'current');
this.scrollIntoView(true); this.scrollIntoView(true);
match = true;
} else { } else {
$(this).removeClass('ui-state-highlight'); $(this).removeClass('ui-state-highlight');
$(this).removeAttr('current'); $(this).removeAttr('current');
...@@ -151,6 +153,8 @@ function updatePlayList(force_refresh) { ...@@ -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) { ...@@ -226,6 +230,7 @@ function browse(dir) {
break; break;
default: default:
sendCommand('command=in_play&input=' + encodeURIComponent($(this).attr('openfile'))); sendCommand('command=in_play&input=' + encodeURIComponent($(this).attr('openfile')));
updatePlayList(true);
break; break;
} }
$('#window_browse').dialog('close'); $('#window_browse').dialog('close');
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment