1
0
mirror of https://github.com/SuperBFG7/ympd synced 2024-10-31 20:16:17 +00:00

Save Queue

This commit is contained in:
Benjamin Häublein 2015-09-02 19:24:52 +02:00
parent f2164b382a
commit 4f138c0986
4 changed files with 48 additions and 0 deletions

View File

@ -144,6 +144,9 @@
<button type="button" class="btn btn-default" onclick="socket.send('MPD_API_RM_ALL');"> <button type="button" class="btn btn-default" onclick="socket.send('MPD_API_RM_ALL');">
<span class="glyphicon glyphicon-trash"></span> Clear queue <span class="glyphicon glyphicon-trash"></span> Clear queue
</button> </button>
<a href="#" data-toggle="modal" data-target="#savequeue" class="btn btn-default">
<span class="glyphicon glyphicon-save"></span> Save queue
</a>
</div> </div>
<div id="btn-responsive-block" class="btn-group-vertical btn-block btn-group-lg" data-toggle="buttons"> <div id="btn-responsive-block" class="btn-group-vertical btn-block btn-group-lg" data-toggle="buttons">
@ -238,6 +241,31 @@
</div><!-- /.modal-dialog --> </div><!-- /.modal-dialog -->
</div><!-- /.modal --> </div><!-- /.modal -->
<div class="modal fade" id="savequeue" tabindex="-1" role="dialog" aria-labelledby="savequeueLabel" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
<h2 class="modal-title" id="savequeueLabel"><span class="glyphicon glyphicon-wrench"></span> Save Queue</h2>
</div>
<div class="modal-body">
<form role="form">
<div class="row">
<div class="form-group col-md-9">
<label class="control-label" for="playlistname">Playlist Name</label>
<input type="text" class="form-control" id="playlistname" />
</div>
</div>
</form>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">Cancel</button>
<button type="button" class="btn btn-default" onclick="saveQueue();">Save Queue</button>
</div>
</div><!-- /.modal-content -->
</div><!-- /.modal-dialog -->
</div><!-- /.modal -->
<div class="modal fade bs-example-modal-sm" id="wait" tabindex="-1" role="dialog" data-backdrop="static" data-keyboard="false" aria-hidden="true"> <div class="modal fade bs-example-modal-sm" id="wait" tabindex="-1" role="dialog" data-backdrop="static" data-keyboard="false" aria-hidden="true">
<div class="modal-dialog"> <div class="modal-dialog">
<div class="modal-content"> <div class="modal-content">

View File

@ -576,6 +576,13 @@ function addStream() {
$('#addstream').modal('hide'); $('#addstream').modal('hide');
} }
function saveQueue() {
if($('#playlistname').val().length > 0) {
socket.send('MPD_API_SAVE_QUEUE,'+$('#playlistname').val());
}
$('#savequeue').modal('hide');
}
function confirmSettings() { function confirmSettings() {
if($('#mpd_pw').val().length + $('#mpd_pw_con').val().length > 0) { if($('#mpd_pw').val().length + $('#mpd_pw_con').val().length > 0) {
if ($('#mpd_pw').val() !== $('#mpd_pw_con').val()) if ($('#mpd_pw').val() !== $('#mpd_pw_con').val())

View File

@ -169,6 +169,18 @@ out_play_track:
out_playlist: out_playlist:
free(p_charbuf); free(p_charbuf);
break; break;
case MPD_API_SAVE_QUEUE:
p_charbuf = strdup(c->content);
if(strcmp(strtok(p_charbuf, ","), "MPD_API_SAVE_QUEUE"))
goto out_save_queue;
if((token = strtok(NULL, ",")) == NULL)
goto out_save_queue;
mpd_run_save(mpd.conn, token);
out_save_queue:
free(p_charbuf);
break;
case MPD_API_SEARCH: case MPD_API_SEARCH:
p_charbuf = strdup(c->content); p_charbuf = strdup(c->content);
if(strcmp(strtok(p_charbuf, ","), "MPD_API_SEARCH")) if(strcmp(strtok(p_charbuf, ","), "MPD_API_SEARCH"))

View File

@ -44,6 +44,7 @@
X(MPD_API_ADD_PLAY_TRACK) \ X(MPD_API_ADD_PLAY_TRACK) \
X(MPD_API_ADD_PLAYLIST) \ X(MPD_API_ADD_PLAYLIST) \
X(MPD_API_PLAY_TRACK) \ X(MPD_API_PLAY_TRACK) \
X(MPD_API_SAVE_QUEUE) \
X(MPD_API_RM_TRACK) \ X(MPD_API_RM_TRACK) \
X(MPD_API_RM_ALL) \ X(MPD_API_RM_ALL) \
X(MPD_API_SEARCH) \ X(MPD_API_SEARCH) \