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'}); } diff --git a/package.json b/package.json index 56a1ee1..12b07e7 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "itunes-bridge", - "version": "0.6.6", + "version": "0.6.7", "description": "A macOS and Windows NodeJS package to control and get informations from iTunes and macOS Music app through AppleScript", "main": "itunes-bridge.js", "repository": { diff --git a/wscript/iTunesFetcher.js b/wscript/iTunesFetcher.js index 9ea6100..03d0780 100644 --- a/wscript/iTunesFetcher.js +++ b/wscript/iTunesFetcher.js @@ -30,16 +30,16 @@ function getCurrentTrack(){ } } json = { - "name": currentTrack.name, - "artist": currentTrack.artist, - "album": currentTrack.album, + "name": encodeURIComponent(currentTrack.name), + "artist": encodeURIComponent(currentTrack.artist), + "album": encodeURIComponent(currentTrack.album), "mediaKind": currentTrack.kind, "duration": currentTrack.duration, "elapsedTime": iTunesApp.PlayerPosition, "remainingTime": remainingTime, - "genre": currentTrack.genre, + "genre": encodeURIComponent(currentTrack.genre), "releaseYear": currentTrack.year, - "id": currentTrack.name, // I haven't found a way to get the current track ID with iTunes COM :/ + "id": encodeURIComponent(currentTrack.name), // I haven't found a way to get the current track ID with iTunes COM :/ "playerState": playerState }; } catch (e) {