From bbdeb4d63809cc527400f7d4b571d31a4b724e87 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ond=C5=99ej=20=C5=BD=C3=A1ra?= Date: Fri, 25 Dec 2020 20:53:59 +0100 Subject: [PATCH] playlist fix, retina art size --- app/cyp.js | 13 ++++++++----- app/js/conf.js | 2 +- app/js/elements/queue.js | 11 +++++++---- 3 files changed, 16 insertions(+), 10 deletions(-) diff --git a/app/cyp.js b/app/cyp.js index 154bbe8..5bd02d1 100644 --- a/app/cyp.js +++ b/app/cyp.js @@ -816,7 +816,7 @@ class Menu extends Component { customElements.define("cyp-menu", Menu); -const artSize = 96; +const artSize = 96 * (window.devicePixelRatio || 1); const ytPath = "_youtube"; let ytLimit = 3; @@ -1240,12 +1240,15 @@ class Queue extends Component { if (name === null) { return; } name = escape(name); - const commands = items.map(item => { - return `playlistadd "${escape(name)}" "${escape(item.file)}"`; - }); - commands.unshift(`rm "${escape(name)}"`); + try { // might not exist + await this._mpd.command(`rm "${name}"`); + } catch (e) {} + const commands = items.map(item => { + return `playlistadd "${name}" "${escape(item.file)}"`; + }); await this._mpd.command(commands); + sel.clear(); }, {label:"Save", icon:"content-save"}); diff --git a/app/js/conf.js b/app/js/conf.js index afac878..68404a8 100644 --- a/app/js/conf.js +++ b/app/js/conf.js @@ -1,4 +1,4 @@ -export const artSize = 96; +export const artSize = 96 * (window.devicePixelRatio || 1); export const ytPath = "_youtube"; export let ytLimit = 3; diff --git a/app/js/elements/queue.js b/app/js/elements/queue.js index 9aac8cf..d6076c0 100644 --- a/app/js/elements/queue.js +++ b/app/js/elements/queue.js @@ -96,12 +96,15 @@ class Queue extends Component { if (name === null) { return; } name = escape(name); - const commands = items.map(item => { - return `playlistadd "${escape(name)}" "${escape(item.file)}"`; - }); - commands.unshift(`rm "${escape(name)}"`); + try { // might not exist + await this._mpd.command(`rm "${name}"`); + } catch (e) {} + const commands = items.map(item => { + return `playlistadd "${name}" "${escape(item.file)}"`; + }); await this._mpd.command(commands); + sel.clear(); }, {label:"Save", icon:"content-save"});