[feature-107] Advancement on playlist creation

This commit is contained in:
MathieuG-P
2024-06-18 21:03:13 +02:00
parent 5e1a021c3a
commit d299553d1e
10 changed files with 215 additions and 28 deletions
+13
View File
@@ -2,6 +2,7 @@ import { shell, dialog, app, BrowserWindow } from "electron";
import { NotificationService } from "../services/notification.service";
import { IpcService } from "../services/ipc.service";
import { from, of } from "rxjs";
import { readFileSync } from "fs-extra";
// TODO IMPROVE WINDOW CONTROL BY USING WINDOW SERVICE
@@ -45,3 +46,15 @@ ipc.on("notify-system", (args, reply) => {
ipc.on("view-path-in-explorer", (args, reply) => {
reply(of(shell.showItemInFolder(args)));
});
ipc.on("choose-image", (args, reply) => {
reply(from(dialog.showOpenDialog({ properties: ["openFile", "multiSelections"], filters: [{ name: "Images", extensions: ["jpg", "png", "jpeg"] }] }).then(res => {
if (res.canceled || !res.filePaths) {
return [];
}
if(args.base64){
return res.filePaths.map(path => Buffer.from(readFileSync(path)).toString("base64"));
}
return res.filePaths;
})));
});