Add downloader (video -> mp3) plugin (in music menu)

This commit is contained in:
TC
2020-11-21 22:50:33 +01:00
parent e0f61f128e
commit e197087a50
9 changed files with 518 additions and 9 deletions

View File

@ -0,0 +1,33 @@
const { join } = require("path");
const { dialog } = require("electron");
const { injectCSS, listenAction } = require("../utils");
const { ACTIONS, CHANNEL } = require("./actions.js");
const sendError = (win, err) => {
const dialogOpts = {
type: "info",
buttons: ["OK"],
title: "Error in download!",
message: "Argh! Apologies, download failed…",
detail: err.toString(),
};
dialog.showMessageBox(dialogOpts);
};
function handle(win) {
injectCSS(win.webContents, join(__dirname, "style.css"));
listenAction(CHANNEL, (event, action, error) => {
switch (action) {
case ACTIONS.ERROR:
sendError(win, error);
break;
default:
console.log("Unknown action: " + action);
}
});
}
module.exports = handle;