Commit cce2adb3 authored by Francois Cartegnie's avatar Francois Cartegnie

lua http: fix current int web intf

parent f5e71e2a
var current_id = 1;
var currentArt = null;
var current_que = 'main';
var previous_title = null;
var current_title = null;
var current_playlist_id = -1;
var previous_playlist_id = -1;
function updateArt(url) {
$('#albumArt').fadeOut(500, function () {
......@@ -75,11 +74,11 @@ function updateStatus() {
updateArt(currentArt);
}
current_title = $('[name="filename"]', data).text();
if (previous_title != current_title) {
current_playlist_id = parseInt($('currentplid', data).text());
if (previous_playlist_id != current_playlist_id) {
updatePlayList();
previous_playlist_id = current_playlist_id;
}
previous_title = current_title;
if (pollStatus) {
setTimeout(updateStatus, 1000);
......@@ -138,8 +137,7 @@ function updatePlayList(force_refresh) {
$('.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) {
if ( id.substr(5) == current_playlist_id ) {
$(this).addClass('ui-state-highlight');
$(this).attr('current', 'current');
this.scrollIntoView(true);
......@@ -513,17 +511,17 @@ $(function () {
}).bind("loaded.jstree", function (event, data) {
$('[current]', '[id^="plid_"]').each(function () {
$(this).addClass('ui-state-highlight');
current_id = $(this).attr('id').substr(5);
current_playlist_id = $(this).attr('id').substr(5);
});
}).bind("refresh.jstree", function (event, data) {
$('[current]', '[id^="plid_"]').each(function () {
$(this).addClass('ui-state-highlight');
current_id = $(this).attr('id').substr(5);
current_playlist_id = $(this).attr('id').substr(5);
});
}).delegate("#plid_2 li.jstree-leaf a", "click", function (event, data) {
event.preventDefault();
current_id = $(this).parent().attr('id').substr(5);
sendCommand('command=pl_play&id=' + current_id);
current_playlist_id = $(this).parent().attr('id').substr(5);
sendCommand('command=pl_play&id=' + current_playlist_id);
});
updateStatus();
updateStreams();
......
......@@ -455,6 +455,7 @@ getstatus = function (includecategories)
s.length=math.floor(vlc.var.get(input,"length"))
s.time=math.floor(vlc.var.get(input,"time"))
s.position=vlc.var.get(input,"position")
s.currentplid=vlc.playlist.current()
s.audiodelay=vlc.var.get(input,"audio-delay")
s.rate=vlc.var.get(input,"rate")
s.subtitledelay=vlc.var.get(input,"spu-delay")
......@@ -462,6 +463,7 @@ getstatus = function (includecategories)
s.length=0
s.time=0
s.position=0
s.currentplid=-1
s.audiodelay=0
s.rate=1
s.subtitledelay=0
......
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