var current_id = 1;
var currentArt = null;
var current_que = 'main';
+var previous_title = null;
+var current_title = null;
function updateArt(url) {
$('#albumArt').fadeOut(500, function () {
currentArt = 'images/vlc-48.png';
updateArt(currentArt);
}
+
+ current_title = $('[name="filename"]', data).text();
+ if (previous_title != current_title) {
+ updatePlayList();
+ }
+ previous_title = current_title;
+
if (pollStatus) {
setTimeout(updateStatus, 1000);
}
});
}
-function updatePlayList() {
- $('#libraryTree').jstree('refresh', -1);
+function updatePlayList(force_refresh) {
+ if (force_refresh) {
+ //refresh playlist..
+ $('#libraryTree').jstree('refresh', -1);
+ } else {
+ //iterate through playlist..
+ $('.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) {
+ $(this).addClass('ui-state-highlight');
+ $(this).attr('current', 'current');
+ this.scrollIntoView(true);
+ } else {
+ $(this).removeClass('ui-state-highlight');
+ $(this).removeAttr('current');
+ }
+ if ($(this).children('a').size() > 0) {
+ $($(this).children('a')[0]).removeClass('ui-state-active');
+ }
+ }
+ });
+ }
}
function sendCommand(params, append) {
eval(append);
}
updateStatus();
- updatePlayList();
}
});
} else {
if (append != undefined) {
eval(append);
}
- updatePlayList();
}
});
}
event.preventDefault();
current_id = $(this).parent().attr('id').substr(5);
sendCommand('command=pl_play&id=' + current_id);
- updatePlayList();
});
updateStatus();
updateStreams();