fix np on macos

This commit is contained in:
cutls 2019-10-12 01:33:40 +09:00
parent 9957bd9b8a
commit f50c2d3049
2 changed files with 5 additions and 4 deletions

View File

@ -134,8 +134,8 @@ function npCore(arg) {
media(arg.path, "image/png", "new");
}
} else if (platform == "darwin") {
if (flag && arg.existsArtwork) {
media(arg.artworks[0].data, "image/png", "new");
if (flag && arg.artwork) {
media(arg.artwork, "image/png", "new");
}
}
var regExp = new RegExp("{song}", "g");

View File

@ -15,10 +15,11 @@ function np(mainWindow) {
if (platform == "darwin") {
try {
const nowplaying = require("itunes-nowplaying-mac");
const value = await nowplaying();
let value = await nowplaying();
const artwork = await nowplaying.getThumbnailBuffer(value.databaseID);
console.log(artwork)
const base64 = artwork.toString('base64');
value.artwork = base64
e.sender.webContents.send('itunes-np', value);
} catch (error) {
// エラーを返す