mirror of
https://github.com/Zagrios/bs-manager.git
synced 2026-07-03 14:08:25 +02:00
[feature-107] Advancement on playlist creation
This commit is contained in:
@@ -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;
|
||||
})));
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user