Don't fire 'itunes' event when 'itunes-np' listener is present
Remove `uploadnow` variable as it is no longer needed
This commit is contained in:
parent
cdc6840808
commit
e44014a1a9
|
@ -156,7 +156,6 @@ function media(b64, type, no) {
|
||||||
Materialize.toast(lang.lang_postimg_aftupload, 1000);
|
Materialize.toast(lang.lang_postimg_aftupload, 1000);
|
||||||
$("#imgup").text("");
|
$("#imgup").text("");
|
||||||
$("#imgsel").show();
|
$("#imgsel").show();
|
||||||
uploadnow=false;
|
|
||||||
localStorage.removeItem("image");
|
localStorage.removeItem("image");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -63,7 +63,6 @@ function spotifyFlagSave(){
|
||||||
Materialize.toast(lang.lang_spotify_imgno, 3000);
|
Materialize.toast(lang.lang_spotify_imgno, 3000);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
var uploadnow=false;
|
|
||||||
function nowplaying(mode){
|
function nowplaying(mode){
|
||||||
if(mode=="spotify"){
|
if(mode=="spotify"){
|
||||||
var start = "https://thedesk.top/now-playing?at="+localStorage.getItem("spotify")+"&rt="+localStorage.getItem("spotify-refresh");
|
var start = "https://thedesk.top/now-playing?at="+localStorage.getItem("spotify")+"&rt="+localStorage.getItem("spotify-refresh");
|
||||||
|
@ -124,6 +123,10 @@ function nowplaying(mode){
|
||||||
}else if(mode=="itunes"){
|
}else if(mode=="itunes"){
|
||||||
var electron = require("electron");
|
var electron = require("electron");
|
||||||
var ipc = electron.ipcRenderer;
|
var ipc = electron.ipcRenderer;
|
||||||
|
if (ipc.listenerCount('itunes-np') > 0) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
ipc.send('itunes', "");
|
ipc.send('itunes', "");
|
||||||
ipc.once('itunes-np', function (event, arg) {
|
ipc.once('itunes-np', function (event, arg) {
|
||||||
console.log(arg);
|
console.log(arg);
|
||||||
|
@ -135,13 +138,11 @@ function nowplaying(mode){
|
||||||
var remote=electron.remote;
|
var remote=electron.remote;
|
||||||
var platform=remote.process.platform;
|
var platform=remote.process.platform;
|
||||||
if(platform=="win32"){
|
if(platform=="win32"){
|
||||||
if(!uploadnow && flag && arg.path){
|
if(flag && arg.path){
|
||||||
uploadnow=true;
|
|
||||||
media(arg.path,"image/png","new");
|
media(arg.path,"image/png","new");
|
||||||
}
|
}
|
||||||
}else if(platform=="darwin"){
|
}else if(platform=="darwin"){
|
||||||
if(!uploadnow && flag && arg.artworks[0]){
|
if(flag && arg.artworks[0]){
|
||||||
uploadnow=true;
|
|
||||||
ipc.send('bmp-image', [arg.artworks[0].path,0]);
|
ipc.send('bmp-image', [arg.artworks[0].path,0]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user