1
0
mirror of https://github.com/SuperBFG7/ympd synced 2024-12-27 03:10:26 +00:00

Use queue version for song change in http streams

This commit is contained in:
jcorporation 2018-06-11 19:34:45 +01:00
parent 332855bcf4
commit d674ae5f13
2 changed files with 9 additions and 6 deletions

View File

@ -114,11 +114,11 @@ app.route=function() {
app.current.filter = params[6];
app.current.search = params[7];
} else {
app.goto("Playback");
app.goto("Playback");
return;
}
app.prepare();
if (app.current.app == 'Playback') {
socket.send('MPD_API_GET_CURRENT_SONG');
}
@ -672,8 +672,9 @@ function webSocketConnect() {
$('#QueueList > tbody > tr[trackid='+obj.data.currentsongid+'] > td').eq(4).text(counterText);
$('#QueueList > tbody > tr[trackid='+obj.data.currentsongid+'] > td').eq(0).addClass('material-icons').text('play_arrow');
$('#QueueList > tbody > tr[trackid='+obj.data.currentsongid+']').addClass('active').addClass("font-weight-bold");
if ($('#currenttrack').text() != $('#QueueList > tbody > tr[trackid='+obj.data.currentsongid+'] > td').eq(1).text()) {
//Get current song on queue change for http streams
//Get current song on queue change for http streams
if (last_state == undefined || obj.data.queue_version != last_state.data.queue_version) {
socket.send('MPD_API_GET_CURRENT_SONG');
}

View File

@ -709,7 +709,8 @@ int mpd_put_state(char *buffer, int *current_song_id, int *next_song_id, unsign
"\"state\":%d, \"volume\":%d, \"songpos\": %d, \"elapsedTime\": %d, "
"\"totalTime\":%d, \"currentsongid\": %d, \"kbitrate\": %d, "
"\"audioformat\": { \"sample_rate\": %d, \"bits\": %d, \"channels\": %d}, "
"\"queue_length\": %d, \"nextsongpos\": %d, \"nextsongid\": %d"
"\"queue_length\": %d, \"nextsongpos\": %d, \"nextsongid\": %d, "
"\"queue_version\": %d"
"}}",
mpd_status_get_state(status),
mpd_status_get_volume(status),
@ -723,7 +724,8 @@ int mpd_put_state(char *buffer, int *current_song_id, int *next_song_id, unsign
audioformat ? audioformat->channels : 0,
mpd_status_get_queue_length(status),
mpd_status_get_next_song_pos(status),
mpd_status_get_next_song_id(status)
mpd_status_get_next_song_id(status),
mpd_status_get_queue_version(status)
);
*current_song_id = mpd_status_get_song_id(status);