playlist overwrite

This commit is contained in:
Ondřej Žára 2020-08-23 14:46:35 +02:00
parent d28cc59d08
commit 6bdfb00b69
2 changed files with 10 additions and 6 deletions

View file

@ -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 => {

View file

@ -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 => {