From 1b70a5eb16085cb37d885fca0a6c50e43501ba67 Mon Sep 17 00:00:00 2001 From: end-4 <97237370+end-4@users.noreply.github.com> Date: Sat, 10 May 2025 11:15:34 +0200 Subject: [PATCH] booru: cleaner download --- .../modules/sidebarLeft/anime/BooruImage.qml | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-) diff --git a/.config/quickshell/modules/sidebarLeft/anime/BooruImage.qml b/.config/quickshell/modules/sidebarLeft/anime/BooruImage.qml index e4f83685c..1efe10106 100644 --- a/.config/quickshell/modules/sidebarLeft/anime/BooruImage.qml +++ b/.config/quickshell/modules/sidebarLeft/anime/BooruImage.qml @@ -20,28 +20,21 @@ Button { property string downloadPath property string nsfwPath property string fileName: decodeURIComponent((imageData.file_url).substring((imageData.file_url).lastIndexOf('/') + 1)) + property string filePath: `${root.previewDownloadPath}/${root.fileName}` property bool showActions: false Process { id: downloadProcess running: false - command: ["bash", "-c", `curl '${root.imageData.preview_url ?? root.imageData.sample_url}' -o '${root.previewDownloadPath}/${root.fileName}' && echo 'done'`] - stdout: SplitParser { - onRead: (data) => { - // console.log("Download output:", data) - if(data.includes("done")) { - imageObject.source = `${previewDownloadPath}/${root.fileName}` - } - } + command: ["bash", "-c", `[ -f ${root.filePath} ] || curl '${root.imageData.preview_url ?? root.imageData.sample_url}' -o '${root.filePath}'`] + onExited: (exitCode, exitStatus) => { + imageObject.source = `${previewDownloadPath}/${root.fileName}` } } Component.onCompleted: { if (root.manualDownload) { - // console.log("Manual download triggered") - // console.log("Image data:", JSON.stringify(root.imageData)) - // console.log("Download command:", downloadProcess.command.join(" ")) downloadProcess.running = true } }