Merge pull request #55 from kPherox/fix-nowplaying-for-asar-packed
Fix nowplaying for asar packed
This commit is contained in:
commit
53f880ab97
|
@ -129,6 +129,10 @@ function nowplaying(mode){
|
|||
|
||||
ipc.send('itunes', "");
|
||||
ipc.once('itunes-np', function (event, arg) {
|
||||
if (arg.cmd) {
|
||||
console.error(arg);
|
||||
return;
|
||||
}
|
||||
console.log(arg);
|
||||
var content=localStorage.getItem("np-temp");
|
||||
if(!content || content=="" || content=="null"){
|
||||
|
@ -142,8 +146,8 @@ function nowplaying(mode){
|
|||
media(arg.path,"image/png","new");
|
||||
}
|
||||
}else if(platform=="darwin"){
|
||||
if(flag && arg.artworks[0]){
|
||||
ipc.send('bmp-image', [arg.artworks[0].path,0]);
|
||||
if(flag && arg.existsArtwork){
|
||||
media(arg.artworks[0].data,"image/png","new");
|
||||
}
|
||||
}
|
||||
var regExp = new RegExp("{song}", "g");
|
||||
|
|
|
@ -4,7 +4,7 @@ function np(mainWindow){
|
|||
const app = electron.app;
|
||||
const fs = require("fs");
|
||||
var ipc = electron.ipcMain;
|
||||
ipc.on('itunes', (e, args) => {
|
||||
ipc.on('itunes', async (e, args) => {
|
||||
//Verified on Windows
|
||||
console.log("Access");
|
||||
if(args[0]=="set"){
|
||||
|
@ -25,13 +25,15 @@ function np(mainWindow){
|
|||
var platform=process.platform;
|
||||
var bit=process.arch;
|
||||
if(platform=="darwin"){
|
||||
const nowplaying = require("itunes-nowplaying-mac")
|
||||
nowplaying.getRawData().then(function (value) {
|
||||
try {
|
||||
const nowplaying = require("itunes-nowplaying-mac");
|
||||
const value = await nowplaying.getRawData();
|
||||
mainWindow.webContents.send('itunes-np', value);
|
||||
}).catch(function (error) {
|
||||
// 非同期処理失敗。呼ばれない
|
||||
console.log(error);
|
||||
});
|
||||
} catch (error) {
|
||||
// エラーを返す
|
||||
console.error(error);
|
||||
mainWindow.webContents.send('itunes-np', error);
|
||||
}
|
||||
}else{
|
||||
var {NowPlaying,PlayerName} = require("nowplaying-node");
|
||||
var nppath=join(app.getPath("userData"), "nowplaying");
|
||||
|
|
|
@ -49,12 +49,15 @@
|
|||
},
|
||||
"optionalDependencies": {
|
||||
"nowplaying-node": "^0.1.3",
|
||||
"itunes-nowplaying-mac": "git+https://github.com/rinsuki/itunes-nowplaying-mac#pull/1/head",
|
||||
"itunes-nowplaying-mac": "git+https://github.com/rinsuki/itunes-nowplaying-mac#pull/4/head",
|
||||
"font-manager": "^0.3.0"
|
||||
},
|
||||
"build": {
|
||||
"productName": "TheDesk",
|
||||
"appId": "top.thedesk",
|
||||
"asarUnpack": [
|
||||
"node_modules/itunes-nowplaying-mac"
|
||||
],
|
||||
"directories": {
|
||||
"output": "../build"
|
||||
},
|
||||
|
|
Loading…
Reference in New Issue
Block a user