Fix: macOS NP

This commit is contained in:
cutls 2019-10-12 01:08:33 +09:00
parent 3ba4dee8a7
commit d654b63bca
2 changed files with 6 additions and 2 deletions

View File

@ -141,7 +141,11 @@ function npCore(arg) {
var regExp = new RegExp("{song}", "g"); var regExp = new RegExp("{song}", "g");
content = content.replace(regExp, arg.name); content = content.replace(regExp, arg.name);
var regExp = new RegExp("{album}", "g"); var regExp = new RegExp("{album}", "g");
content = content.replace(regExp, arg.album); if(arg.album){
if(arg.album.name){
content = content.replace(regExp, arg.album.name);
}
}
var regExp = new RegExp("{artist}", "g"); var regExp = new RegExp("{artist}", "g");
content = content.replace(regExp, arg.artist); content = content.replace(regExp, arg.artist);
var regExp = new RegExp("{url}", "g"); var regExp = new RegExp("{url}", "g");

View File

@ -15,7 +15,7 @@ function np(mainWindow) {
if (platform == "darwin") { if (platform == "darwin") {
try { try {
const nowplaying = require("itunes-nowplaying-mac"); const nowplaying = require("itunes-nowplaying-mac");
const value = await nowplaying.getRawData(); const value = await nowplaying.getData();
e.sender.webContents.send('itunes-np', value); e.sender.webContents.send('itunes-np', value);
} catch (error) { } catch (error) {
// エラーを返す // エラーを返す