This commit is contained in:
Araxeus
2021-05-06 02:17:48 +03:00
parent ca41c12f7c
commit f190b51dcc
3 changed files with 4 additions and 2 deletions

View File

@ -45,9 +45,11 @@ function handle(win) {
ipcMain.on("add-metadata", async (event, filePath, songBuffer, currentMetadata) => {
let fileBuffer = songBuffer;
const songMetadata = { ...metadata, ...currentMetadata };
if (!songMetadata.image && songMetadata.imageSrc) {
songMetadata.image = await getImage(songMetadata.imageSrc)
}
try {
const coverBuffer = songMetadata.image.toPNG();
const writer = new ID3Writer(songBuffer);

View File

@ -47,8 +47,8 @@ global.download = () => {
videoUrl = baseUrl + "/" + videoUrl;
metadata = null;
} else {
videoUrl = global.songInfo.url || window.location.href;
metadata = global.songInfo;
videoUrl = metadata.url || window.location.href;
}
downloadVideoToMP3(

View File

@ -152,7 +152,7 @@ const toMP3 = async (
ipcRenderer.send("add-metadata", filePath, fileBuffer, {
artist: metadata.artist,
title: metadata.title,
imageSrc: metadata.imageSrc || ""
imageSrc: metadata.imageSrc
});
ipcRenderer.once("add-metadata-done", reinit);
} catch (e) {