1
0
mirror of https://github.com/SuperBFG7/ympd synced 2024-11-26 23:07:17 +00:00

Merge remote-tracking branch 'origin/send-message'

This commit is contained in:
SuperBFG7 2017-03-18 13:41:32 +01:00
commit 4f64061286
4 changed files with 37 additions and 0 deletions

View File

@ -56,6 +56,11 @@
</button> </button>
</div> </div>
<!-- <!--
<div class="btn-group">
<button id="btnlove" type="button" class="btn btn-default" onclick="clickLove();">
<span class="glyphicon glyphicon-heart"></span>
</button>
</div>
<div class="btn-group"> <div class="btn-group">
<div class="btn btn-toolbar btn-default"> <div class="btn btn-toolbar btn-default">
<span id="volume-icon" class="glyphicon glyphicon-volume-up"></span> <span id="volume-icon" class="glyphicon glyphicon-volume-up"></span>

View File

@ -561,6 +561,8 @@ function webSocketConnect() {
$('#album').text(""); $('#album').text("");
$('#artist').text(""); $('#artist').text("");
$('#btnlove').removeClass("active");
$('#currenttrack').text(" " + obj.data.title); $('#currenttrack').text(" " + obj.data.title);
var notification = "<strong><h4>" + obj.data.title + "</h4></strong>"; var notification = "<strong><h4>" + obj.data.title + "</h4></strong>";
@ -759,6 +761,14 @@ function basename(path) {
return path.split('/').reverse()[0]; return path.split('/').reverse()[0];
} }
function clickLove() {
socket.send("MPD_API_SEND_MESSAGE,mpdas," + ($('#btnlove').hasClass('active') ? "unlove" : "love"));
if ( $('#btnlove').hasClass('active') )
$('#btnlove').removeClass("active");
else
$('#btnlove').addClass("active");
}
$('#btnrandom').on('click', function (e) { $('#btnrandom').on('click', function (e) {
socket.send("MPD_API_TOGGLE_RANDOM," + ($(this).hasClass('active') ? 0 : 1)); socket.send("MPD_API_TOGGLE_RANDOM," + ($(this).hasClass('active') ? 0 : 1));

View File

@ -237,6 +237,27 @@ out_save_queue:
out_search: out_search:
free(p_charbuf); free(p_charbuf);
break; break;
case MPD_API_SEND_MESSAGE:
p_charbuf = strdup(c->content);
if(strcmp(strtok(p_charbuf, ","), "MPD_API_SEND_MESSAGE"))
goto out_send_message;
if((token = strtok(NULL, ",")) == NULL)
goto out_send_message;
free(p_charbuf);
p_charbuf = strdup(get_arg1(c->content));
if ( strtok(p_charbuf, ",") == NULL )
goto out_send_message;
if ( (token = strtok(NULL, ",")) == NULL )
goto out_send_message;
mpd_run_send_message(mpd.conn, p_charbuf, token);
out_send_message:
free(p_charbuf);
break;
#ifdef WITH_MPD_HOST_CHANGE #ifdef WITH_MPD_HOST_CHANGE
/* Commands allowed when disconnected from MPD server */ /* Commands allowed when disconnected from MPD server */
case MPD_API_SET_MPDHOST: case MPD_API_SET_MPDHOST:

View File

@ -49,6 +49,7 @@
X(MPD_API_RM_ALL) \ X(MPD_API_RM_ALL) \
X(MPD_API_MOVE_TRACK) \ X(MPD_API_MOVE_TRACK) \
X(MPD_API_SEARCH) \ X(MPD_API_SEARCH) \
X(MPD_API_SEND_MESSAGE) \
X(MPD_API_SET_VOLUME) \ X(MPD_API_SET_VOLUME) \
X(MPD_API_SET_PAUSE) \ X(MPD_API_SET_PAUSE) \
X(MPD_API_SET_PLAY) \ X(MPD_API_SET_PLAY) \