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