mirror of
https://github.com/SuperBFG7/ympd
synced 2024-11-26 14:57:17 +00:00
Merge pull request #87 from BenjaminHae/master
Added the ability to save queue as playlist
This commit is contained in:
commit
6dcb2ad758
@ -149,6 +149,9 @@
|
||||
<button type="button" class="btn btn-default" onclick="socket.send('MPD_API_RM_ALL');">
|
||||
<span class="glyphicon glyphicon-trash"></span> Clear queue
|
||||
</button>
|
||||
<a href="#" data-toggle="modal" data-target="#savequeue" class="btn btn-default">
|
||||
<span class="glyphicon glyphicon-save"></span> Save queue
|
||||
</a>
|
||||
</div>
|
||||
|
||||
<div id="btn-responsive-block" class="btn-group-vertical btn-block btn-group-lg" data-toggle="buttons">
|
||||
@ -242,6 +245,31 @@
|
||||
</div><!-- /.modal-content -->
|
||||
</div><!-- /.modal-dialog -->
|
||||
</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">×</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-dialog">
|
||||
|
@ -586,6 +586,13 @@ function addStream() {
|
||||
$('#addstream').modal('hide');
|
||||
}
|
||||
|
||||
function saveQueue() {
|
||||
if($('#playlistname').val().length > 0) {
|
||||
socket.send('MPD_API_SAVE_QUEUE,'+$('#playlistname').val());
|
||||
}
|
||||
$('#savequeue').modal('hide');
|
||||
}
|
||||
|
||||
function confirmSettings() {
|
||||
if($('#mpd_pw').val().length + $('#mpd_pw_con').val().length > 0) {
|
||||
if ($('#mpd_pw').val() !== $('#mpd_pw_con').val())
|
||||
|
@ -169,6 +169,18 @@ out_play_track:
|
||||
out_playlist:
|
||||
free(p_charbuf);
|
||||
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:
|
||||
p_charbuf = strdup(c->content);
|
||||
if(strcmp(strtok(p_charbuf, ","), "MPD_API_SEARCH"))
|
||||
|
@ -44,6 +44,7 @@
|
||||
X(MPD_API_ADD_PLAY_TRACK) \
|
||||
X(MPD_API_ADD_PLAYLIST) \
|
||||
X(MPD_API_PLAY_TRACK) \
|
||||
X(MPD_API_SAVE_QUEUE) \
|
||||
X(MPD_API_RM_TRACK) \
|
||||
X(MPD_API_RM_ALL) \
|
||||
X(MPD_API_SEARCH) \
|
||||
|
Loading…
Reference in New Issue
Block a user