test on #208
This commit is contained in:
parent
b42b04d769
commit
51af1590ad
|
@ -36,7 +36,7 @@ function src(mode, offset) {
|
||||||
var user = $('#his-data').attr('user-id')
|
var user = $('#his-data').attr('user-id')
|
||||||
}
|
}
|
||||||
if (!mode) {
|
if (!mode) {
|
||||||
var start = 'https://' + domain + '/api/v2/search?q=' + q + add
|
var start = 'https://' + domain + '/api/v2/search?resolve=true&q=' + q + add
|
||||||
} else {
|
} else {
|
||||||
var start = 'https://' + domain + '/api/v1/search?q=' + q
|
var start = 'https://' + domain + '/api/v1/search?q=' + q
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,36 +1,42 @@
|
||||||
function np(mainWindow) {
|
function np(mainWindow) {
|
||||||
const electron = require("electron");
|
const electron = require('electron')
|
||||||
const join = require('path').join;
|
const join = require('path').join
|
||||||
const app = electron.app;
|
const app = electron.app
|
||||||
const fs = require("fs");
|
const fs = require('fs')
|
||||||
var ipc = electron.ipcMain;
|
const fpath = join(app.getPath('userData'), 'npexec')
|
||||||
|
const npExec = fs.readFileSync(fpath, 'utf8')
|
||||||
|
const ipc = electron.ipcMain
|
||||||
|
|
||||||
|
const { exec } = require('child_process')
|
||||||
ipc.on('itunes', async (e, args) => {
|
ipc.on('itunes', async (e, args) => {
|
||||||
//Verified on Windows
|
console.log('Access')
|
||||||
console.log("Access");
|
if (args[0] == 'set') {
|
||||||
if (args[0] == "set") {
|
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
var platform = process.platform;
|
var platform = process.platform
|
||||||
var bit = process.arch;
|
var bit = process.arch
|
||||||
if (platform == "darwin") {
|
if (platform == 'darwin') {
|
||||||
try {
|
try {
|
||||||
const nowplaying = require("itunes-nowplaying-mac");
|
const nowplaying = require('itunes-nowplaying-mac')
|
||||||
let value = await nowplaying();
|
let value = await nowplaying()
|
||||||
|
if(!value && npExec) {
|
||||||
const artwork = await nowplaying.getThumbnailBuffer(value.databaseID);
|
exec(npExec, (error, stdout, stderr) => {
|
||||||
const base64 = artwork.toString('base64');
|
e.sender.webContents.send('itunes-np', stdout)
|
||||||
|
})
|
||||||
|
} else {
|
||||||
|
const artwork = await nowplaying.getThumbnailBuffer(value.databaseID)
|
||||||
|
const base64 = artwork.toString('base64')
|
||||||
value.artwork = base64
|
value.artwork = base64
|
||||||
e.sender.webContents.send('itunes-np', value);
|
e.sender.webContents.send('itunes-np', value)
|
||||||
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
// エラーを返す
|
// エラーを返す
|
||||||
console.error(error);
|
console.error(error)
|
||||||
e.sender.webContents.send('itunes-np', error);
|
e.sender.webContents.send('itunes-np', error)
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
})
|
||||||
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
exports.TheDeskNowPlaying = np;
|
exports.TheDeskNowPlaying = np
|
||||||
|
|
Loading…
Reference in New Issue
Block a user