diff --git a/src/main/base/win.ts b/src/main/base/win.ts index 3e402329..fb959568 100644 --- a/src/main/base/win.ts +++ b/src/main/base/win.ts @@ -9,6 +9,8 @@ import * as fs from "fs"; import { Stream } from "stream"; import * as qrcode from "qrcode-terminal"; import * as os from "os"; +import * as mm from 'music-metadata'; +import fetch from 'electron-fetch' import {wsapi} from "./wsapi"; 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 * **********************************************************************************************/