diff --git a/app/cyp.js b/app/cyp.js index d364466..5810b01 100644 --- a/app/cyp.js +++ b/app/cyp.js @@ -1193,16 +1193,18 @@ class Queue extends Component { this._mpd.command(commands.reverse()); // move last first }, {label:"Down", icon:"arrow-down-bold"}); - sel.addCommand(items => { + sel.addCommand(async items => { let name = prompt("Save selected songs as a playlist?", "name"); if (name === null) { return; } name = escape(name); const commands = items.map(item => { - return `playlistadd "${name}" "${escape(item.file)}"`; + return `playlistadd "${escape(name)}" "${escape(item.file)}"`; }); + commands.unshift(`rm "${escape(name)}"`); - this._mpd.command(commands); // FIXME notify? + await this._mpd.command(commands); + sel.clear(); }, {label:"Save", icon:"content-save"}); sel.addCommand(async items => { diff --git a/app/js/elements/queue.js b/app/js/elements/queue.js index 11cf797..9aac8cf 100644 --- a/app/js/elements/queue.js +++ b/app/js/elements/queue.js @@ -91,16 +91,18 @@ class Queue extends Component { this._mpd.command(commands.reverse()); // move last first }, {label:"Down", icon:"arrow-down-bold"}); - sel.addCommand(items => { + sel.addCommand(async items => { let name = prompt("Save selected songs as a playlist?", "name"); if (name === null) { return; } name = escape(name); const commands = items.map(item => { - return `playlistadd "${name}" "${escape(item.file)}"`; + return `playlistadd "${escape(name)}" "${escape(item.file)}"`; }); + commands.unshift(`rm "${escape(name)}"`); - this._mpd.command(commands); // FIXME notify? + await this._mpd.command(commands); + sel.clear(); }, {label:"Save", icon:"content-save"}); sel.addCommand(async items => {