Skip to content

Commit

Permalink
πŸ‘¨β€πŸ­ Special character fix
Browse files Browse the repository at this point in the history
  • Loading branch information
N0chteil committed May 29, 2021
1 parent d7e4799 commit a5ee9aa
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 10 deletions.
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ var iTunesEmitter = iTunes.emitter;

switch(currentTrack.playerState){
case "playing": {
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 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 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);
Expand All @@ -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(currentTrack.name + " has been resumed! ");
console.log(decodeURIComponent(currentTrack.name) + " has been resumed! ");
// Or if it is a new track
}else if(type === 'new_track'){
console.log(currentTrack.name+" is now playing!")
console.log(decodeURIComponent(currentTrack.name)+" is now playing!")
}
});

// Do something when iTunes is paused
iTunesEmitter.on('paused', function(type, currentTrack){
console.log(currentTrack.name+" is now paused!");
console.log(decodeURIComponent(currentTrack.name)+" is now paused!");
});
// Do something when iTunes is stopped
iTunesEmitter.on('stopped', function(){
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -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": {
Expand Down
10 changes: 5 additions & 5 deletions wscript/iTunesFetcher.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit a5ee9aa

Please sign in to comment.