diff --git a/README.md b/README.md index 95c4ec2..a3f05a5 100644 --- a/README.md +++ b/README.md @@ -16,7 +16,7 @@ var iTunesEmitter = iTunes.emitter; switch(currentTrack.playerState){ case "playing": { - var exampleMsg = "iTunes is currently playing " + decodeURIComponent(currentTrack.name) + " by " + decodeURIComponent(currentTrack.artist) + ' from the album "' + decodeURIComponent(currentTrack.album) + '". This song is ' + currentTrack.duration + 's long and will finish in ' + currentTrack.remainingTime+'s'; + var exampleMsg = "iTunes is currently playing " + currentTrack.name + " by " + currentTrack.artist + ' from the album "' + currentTrack.album + '". This song is ' + currentTrack.duration + 's long and will finish in ' + currentTrack.remainingTime+'s'; var exampleMsg2 = "You have " + iTunes.getPlaylistCount('/Users/steve/Music/iTunes/iTunes Library.xml') + " playlists in your library and " + iTunes.getTrackCount('/Users/steve/Music/iTunes/iTunes Library.xml') + " tracks!"; console.log(exampleMsg); console.log(exampleMsg2); @@ -38,16 +38,16 @@ switch(currentTrack.playerState){ iTunesEmitter.on('playing', function(type, currentTrack){ // If it is a paused track that restarts playing if(type === "player_state_change") { - console.log(decodeURIComponent(currentTrack.name) + " has been resumed! "); + console.log(currentTrack.name + " has been resumed! "); // Or if it is a new track }else if(type === 'new_track'){ - console.log(decodeURIComponent(currentTrack.name)+" is now playing!") + console.log(currentTrack.name+" is now playing!") } }); // Do something when iTunes is paused iTunesEmitter.on('paused', function(type, currentTrack){ - console.log(decodeURIComponent(currentTrack.name)+" is now paused!"); + console.log(currentTrack.name+" is now paused!"); }); // Do something when iTunes is stopped iTunesEmitter.on('stopped', function(){ diff --git a/itunes-bridge.js b/itunes-bridge.js index 65e47ec..47033a1 100644 --- a/itunes-bridge.js +++ b/itunes-bridge.js @@ -307,7 +307,7 @@ function runScript(req, type, args, isJson) { switch(type){ case "fetch": { if(isJson) { - return JSON.parse(execSync('cscript //Nologo ' + iTunesFetcherScpt + ' ' + req, { encoding: 'utf8'})); + return JSON.parse(decodeURIComponent(execSync('cscript //Nologo ' + iTunesFetcherScpt + ' ' + req, { encoding: 'utf8'}))); }else{ return execSync('cscript //Nologo ' + iTunesFetcherScpt+' ' + req, { encoding: 'utf8'}); }