mirror of
https://github.com/SuperBFG7/ympd
synced 2024-11-26 06:47:17 +00:00
Add crossfade support. Not sure about the icon/glyph though
This commit is contained in:
parent
e6e93a08c7
commit
3eb12e6ecd
@ -134,6 +134,9 @@
|
|||||||
<button id="btnsingle" type="button" class="btn btn-default">
|
<button id="btnsingle" type="button" class="btn btn-default">
|
||||||
<span class="glyphicon glyphicon-star"></span> Single
|
<span class="glyphicon glyphicon-star"></span> Single
|
||||||
</button>
|
</button>
|
||||||
|
<button id="btncrossfade" type="button" class="btn btn-default">
|
||||||
|
<span class="glyphicon glyphicon-link"></span> Crossfade
|
||||||
|
</button>
|
||||||
<button id="btnrepeat" type="button" class="btn btn-default">
|
<button id="btnrepeat" type="button" class="btn btn-default">
|
||||||
<span class="glyphicon glyphicon-repeat"></span> Repeat
|
<span class="glyphicon glyphicon-repeat"></span> Repeat
|
||||||
</button>
|
</button>
|
||||||
|
@ -325,6 +325,11 @@ function webSocketConnect() {
|
|||||||
else
|
else
|
||||||
$('#btnsingle').removeClass("active");
|
$('#btnsingle').removeClass("active");
|
||||||
|
|
||||||
|
if(obj.data.crossfade)
|
||||||
|
$('#btncrossfade').addClass("active")
|
||||||
|
else
|
||||||
|
$('#btncrossfade').removeClass("active");
|
||||||
|
|
||||||
if(obj.data.repeat)
|
if(obj.data.repeat)
|
||||||
$('#btnrepeat').addClass("active")
|
$('#btnrepeat').addClass("active")
|
||||||
else
|
else
|
||||||
@ -488,6 +493,9 @@ $('#btnconsume').on('click', function (e) {
|
|||||||
$('#btnsingle').on('click', function (e) {
|
$('#btnsingle').on('click', function (e) {
|
||||||
socket.send("MPD_API_TOGGLE_SINGLE," + ($(this).hasClass('active') ? 0 : 1));
|
socket.send("MPD_API_TOGGLE_SINGLE," + ($(this).hasClass('active') ? 0 : 1));
|
||||||
});
|
});
|
||||||
|
$('#btncrossfade').on('click', function(e) {
|
||||||
|
socket.send("MPD_API_TOGGLE_CROSSFADE," + ($(this).hasClass('active') ? 0 : 1));
|
||||||
|
});
|
||||||
$('#btnrepeat').on('click', function (e) {
|
$('#btnrepeat').on('click', function (e) {
|
||||||
socket.send("MPD_API_TOGGLE_REPEAT," + ($(this).hasClass('active') ? 0 : 1));
|
socket.send("MPD_API_TOGGLE_REPEAT," + ($(this).hasClass('active') ? 0 : 1));
|
||||||
});
|
});
|
||||||
|
@ -102,6 +102,10 @@ int callback_mpd(struct mg_connection *c)
|
|||||||
if(sscanf(c->content, "MPD_API_TOGGLE_SINGLE,%u", &uint_buf))
|
if(sscanf(c->content, "MPD_API_TOGGLE_SINGLE,%u", &uint_buf))
|
||||||
mpd_run_single(mpd.conn, uint_buf);
|
mpd_run_single(mpd.conn, uint_buf);
|
||||||
break;
|
break;
|
||||||
|
case MPD_API_TOGGLE_CROSSFADE:
|
||||||
|
if(sscanf(c->content, "MPD_API_TOGGLE_CROSSFADE,%u", &uint_buf))
|
||||||
|
mpd_run_crossfade(mpd.conn, uint_buf);
|
||||||
|
break;
|
||||||
case MPD_API_SET_VOLUME:
|
case MPD_API_SET_VOLUME:
|
||||||
if(sscanf(c->content, "MPD_API_SET_VOLUME,%ud", &uint_buf) && uint_buf <= 100)
|
if(sscanf(c->content, "MPD_API_SET_VOLUME,%ud", &uint_buf) && uint_buf <= 100)
|
||||||
mpd_run_set_volume(mpd.conn, uint_buf);
|
mpd_run_set_volume(mpd.conn, uint_buf);
|
||||||
@ -335,7 +339,7 @@ int mpd_put_state(char *buffer, int *current_song_id, unsigned *queue_version)
|
|||||||
len = snprintf(buffer, MAX_SIZE,
|
len = snprintf(buffer, MAX_SIZE,
|
||||||
"{\"type\":\"state\", \"data\":{"
|
"{\"type\":\"state\", \"data\":{"
|
||||||
" \"state\":%d, \"volume\":%d, \"repeat\":%d,"
|
" \"state\":%d, \"volume\":%d, \"repeat\":%d,"
|
||||||
" \"single\":%d, \"consume\":%d, \"random\":%d, "
|
" \"single\":%d, \"crossfade\":%d, \"consume\":%d, \"random\":%d, "
|
||||||
" \"songpos\": %d, \"elapsedTime\": %d, \"totalTime\":%d, "
|
" \"songpos\": %d, \"elapsedTime\": %d, \"totalTime\":%d, "
|
||||||
" \"currentsongid\": %d"
|
" \"currentsongid\": %d"
|
||||||
"}}",
|
"}}",
|
||||||
@ -343,6 +347,7 @@ int mpd_put_state(char *buffer, int *current_song_id, unsigned *queue_version)
|
|||||||
mpd_status_get_volume(status),
|
mpd_status_get_volume(status),
|
||||||
mpd_status_get_repeat(status),
|
mpd_status_get_repeat(status),
|
||||||
mpd_status_get_single(status),
|
mpd_status_get_single(status),
|
||||||
|
mpd_status_get_crossfade(status),
|
||||||
mpd_status_get_consume(status),
|
mpd_status_get_consume(status),
|
||||||
mpd_status_get_random(status),
|
mpd_status_get_random(status),
|
||||||
mpd_status_get_song_pos(status),
|
mpd_status_get_song_pos(status),
|
||||||
|
@ -60,6 +60,7 @@
|
|||||||
X(MPD_API_TOGGLE_RANDOM) \
|
X(MPD_API_TOGGLE_RANDOM) \
|
||||||
X(MPD_API_TOGGLE_CONSUME) \
|
X(MPD_API_TOGGLE_CONSUME) \
|
||||||
X(MPD_API_TOGGLE_SINGLE) \
|
X(MPD_API_TOGGLE_SINGLE) \
|
||||||
|
X(MPD_API_TOGGLE_CROSSFADE) \
|
||||||
X(MPD_API_TOGGLE_REPEAT)
|
X(MPD_API_TOGGLE_REPEAT)
|
||||||
|
|
||||||
enum mpd_cmd_ids {
|
enum mpd_cmd_ids {
|
||||||
|
Loading…
Reference in New Issue
Block a user