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 @@
switch(browse_target){
default:
sendCommand('command=in_enqueue&input='+encodeURI(path));
setTimeout(function(){updatePlayList(true);},1000);
break;
}
});
......
......@@ -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(){
......
......@@ -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');
......
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