itunes-api
itunes-api copied to clipboard
Failing on macOS Catalina
Upgraded to latest MacOS and getting errors - looks like it can't find osascript maybe? Here's a log:
script/server
warn: --minUptime not set. Defaulting to: 1000ms
warn: --spinSleepTime not set. Your script will exit if it does not stay up for at least 1000ms
Error: Command failed: osascript -l JavaScript -e 'var old = console.log; console.log = function () { Array.prototype.unshift.call(arguments, "<brandonhorst:node-osa>"); Array.prototype.push.call(arguments, "</brandonhorst:node-osa>"); old.apply(console, arguments); }; JSON.stringify((function getCurrentState(){ itunes = Application('\''iTunes'\''); playerState = itunes.playerState(); currentState = {}; currentState['\''player_state'\''] = playerState; if (playerState != "stopped") { currentTrack = itunes.currentTrack; currentPlaylist = itunes.currentPlaylist; currentState['\''id'\''] = currentTrack.persistentID(); currentState['\''name'\''] = currentTrack.name(); currentState['\''artist'\''] = currentTrack.artist(); currentState['\''album'\''] = currentTrack.album(); currentState['\''playlist'\''] = currentPlaylist.name(); currentState['\''volume'\''] = itunes.soundVolume(); currentState['\''muted'\''] = itunes.mute(); currentState['\''repeat'\''] = itunes.songRepeat(); currentState['\''shuffle'\''] = itunes.shuffleEnabled() && itunes.shuffleMode(); if (currentTrack.year()) { currentState['\''album'\''] += " (" + currentTrack.year() + ")"; } } return currentState;})());'
0:1117: execution error: Error on line 1: Error: Application can't be found. (-2700)
at ChildProcess.exithandler (child_process.js:295:12)
at ChildProcess.emit (events.js:203:13)
at maybeClose (internal/child_process.js:1021:16)
at Process.ChildProcess._handle.onexit (internal/child_process.js:283:5) {
killed: false,
code: 1,
signal: null,
cmd: `osascript -l JavaScript -e 'var old = console.log; console.log = function () { Array.prototype.unshift.call(arguments, "<brandonhorst:node-osa>"); Array.prototype.push.call(arguments, "</brandonhorst:node-osa>"); old.apply(console, arguments); }; JSON.stringify((function getCurrentState(){ itunes = Application('\\''iTunes'\\''); playerState = itunes.playerState(); currentState = {}; currentState['\\''player_state'\\''] = playerState; if (playerState != "stopped") { currentTrack = itunes.currentTrack; currentPlaylist = itunes.currentPlaylist; currentState['\\''id'\\''] = currentTrack.persistentID(); currentState['\\''name'\\''] = currentTrack.name(); currentState['\\''artist'\\''] = currentTrack.artist(); currentState['\\''album'\\''] = currentTrack.album(); currentState['\\''playlist'\\''] = currentPlaylist.name(); currentState['\\''volume'\\''] = itunes.soundVolume(); currentState['\\''muted'\\''] = itunes.mute(); currentState['\\''repeat'\\''] = itunes.songRepeat(); currentState['\\''shuffle'\\''] = itunes.shuffleEnabled() && itunes.shuffleMode(); if (currentTrack.year()) { currentState['\\''album'\\''] += " (" + currentTrack.year() + ")"; } } return currentState;})());'`
}
'[2019-11-28T16:30:15.055Z] - ::ffff:204.128.136.216 - GET /now_playing 500 67.566 ms - 21b'
Still an issue, it looks like it is a problem with the "osa" package. Did you ever figure it out?
Catalina changed the application name from 'iTunes' to 'Music'. You have to change all occurrences of Application('iTunes') to Application('Music')
Here's how to find all occurrences in a Mac Terminal: find . -name "*.js" -exec grep -H "Application('iTunes')" {} ;
@Gearlux Are you able to successfully control the new Apple Music app with it once you make these changes?
Yes, after the changes I can control the Music app on my Mac mini running Catalina.
Sent from my iPhone
On 16 May 2020, at 15:09, Sean Straus [email protected] wrote:
 @Gearlux Are you able to successfully control the new Apple Music app with it once you make these changes?
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or unsubscribe.
Great, thanks so much for that confirmation. It was one of the main things holding me back from upgrading. So no issues whatsoever? TBH I'm really surprised, I thought Apple would throw out that baby with the iTunes bathwater ;-).
Due to corona and travel restrictions to the place where it is installed, I am not able to test it extensively but it worked :-) From a technical point of vue, they just renamed iTunes, so no bathwater here. Good luck !
On 18 May 2020, at 14:31, Sean Straus [email protected] wrote:
Great, thanks so much for that confirmation. It was one of the main things holding me back from upgrading. So no issues whatsoever? TBH I'm really surprised, I thought Apple would throw out that baby with the iTunes bathwater ;-).
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/maddox/itunes-api/issues/42#issuecomment-630150651, or unsubscribe https://github.com/notifications/unsubscribe-auth/ACHY2XBSN7MKL3WKDDIZHMDRSETBJANCNFSM4JSWWQGA.
after installing this on Catalina I used Retroactive to reinstall iTunes......
It works fine, there are two apps on the Mac mini 'Music' and 'iTunes'
I have Home Assitant (HASS.IO) using this REST API to control "iTunes" on Catalina.
I had issues installing this API, but after I got it working, and using retroactive to reinstall it worked well..
the issues I hit;
- don't have forever installed
- https://nodejs.org/en/ to install nodejs this failed
sudo npm install forever -g
- script/bootstrap ran with error
sudo chown -R $USER:$(id -gn $USER) /Users/{userID}/.config
- replacing {userID} with your userid, then re-ran the bootstrap worked.
- then installed the above retroactive
- then tested
curl -X PUT http://10.10.10.3:8181/playlists/vinal-recordings-my-fav/play
curl -X PUT http://10.10.10.3:8181/pause
then set up an Automator script to start the server on reboot
Hello!
So I just upgraded to Catalina in order to install the Home Assistant app on my Macbook. Now the api isn't working anymore. I tried find . -name "*.js" -exec grep -H "Application('iTunes')" {} ;
with Terminal to find the iTunes occurrences, but I am getting this error message:
StiofansMacBookPro:~ stiofandegeata$ find . -name "*.js" -exec grep -H "Application('iTunes')" {} ; find: -exec: no terminating ";" or "+"
What do I do?
Hello!
So I just upgraded to Catalina in order to install the Home Assistant app on my Macbook. Now the api isn't working anymore. I tried
find . -name "*.js" -exec grep -H "Application('iTunes')" {} ;
with Terminal to find the iTunes occurrences, but I am getting this error message:
StiofansMacBookPro:~ stiofandegeata$ find . -name "*.js" -exec grep -H "Application('iTunes')" {} ; find: -exec: no terminating ";" or "+"
What do I do?
What did you upgrade from? MUSIC is the replacement for iTunes. If you have not reinstalled iTunes, then you will need to via Retroactive (See above)
Hello @kcossabo!
Thanks for your reply, I ended up just solving the issue a few minutes ago.
To answer your question though, I upgraded from 10.14.6 Mojave, so yes, iTunes was replaced by Music. I couldn't get that command line script to work to show me what to modify in the references to "application(iTunes)" so I ended up doing a global find with Nova. That worked, but the modifications didn't work anyhow.
I ended up finding a pull request that was modified for Music, I downloaded that one and all is well now! I've got Music up and running in my Home Assistant dashboard, album art and all.
That pull is here, in case anyone else has the same issue I had: https://github.com/DrMachin/itunes-api
That pull is here, in case anyone else has the same issue I had: https://github.com/DrMachin/itunes-api
@SdeGeata YOU ROCK! Thank You, I will update to that version!!!
That pull is here, in case anyone else has the same issue I had: https://github.com/DrMachin/itunes-api
@SdeGeata YOU ROCK! Thank You, I will update to that version!!!
I’d say DrMachin rocks, he’s the guy that put all the work in to fix this thing - i only stumbled across it... but hey, glad it helps!