fix normalization

This commit is contained in:
vapormusic 2022-01-24 10:09:30 +07:00
parent 12995da34a
commit 0a947257b2

View file

@ -9,6 +9,8 @@ import * as fs from "fs";
import { Stream } from "stream"; import { Stream } from "stream";
import * as qrcode from "qrcode-terminal"; import * as qrcode from "qrcode-terminal";
import * as os from "os"; import * as os from "os";
import * as mm from 'music-metadata';
import fetch from 'electron-fetch'
import {wsapi} from "./wsapi"; import {wsapi} from "./wsapi";
export class Win { export class Win {
@ -457,6 +459,23 @@ export class Win {
*/ */
}) })
// Get previews for normalization
electron.ipcMain.on("getPreviewURL", (_event, url) => {
'get url'
fetch(url)
.then(res => res.buffer())
.then(async(buffer) => {
try {
const metadata = await mm.parseBuffer(buffer, 'audio/x-m4a');
let SoundCheckTag = metadata.native.iTunes[1].value
console.log('sc',SoundCheckTag)
this.win.webContents.send('SoundCheckTag', SoundCheckTag)
} catch (error) {
console.error(error.message);
}
})
});
/* ********************************************************************************************* /* *********************************************************************************************
* Window Events * Window Events
* **********************************************************************************************/ * **********************************************************************************************/