m-cli
m-cli copied to clipboard
iTunes commands not working on macOS 10.15.6
Bug Report
Since the introduction of Apple Music app on macOS, I believe the iTunes commands have stopped working.
Reproduction Steps
$ m itunes status
29:41: syntax error: A identifier can’t go after this identifier. (-2740)
iTunes is currently .
/usr/local/Cellar/m-cli/0.2.5/plugins/itunes: line 30: [: =: unary operator expected
Proposed Resolution
Fortunately, I think the solution is as simple as replacing instances of iTunes
in osascripts to Music
.
$ osascript -e 'tell application "iTunes" to artist of current track as string'
39:52: syntax error: A identifier can’t go after this identifier. (-2740)
$ ^iTunes^Music
osascript -e 'tell application "Music" to artist of current track as string'
Michael St Laurent
I will continue to test iTunes commands and submit a patch, including to replace m itunes
with m music
subcommand.
Info
$ m info
ProductName: Mac OS X
ProductVersion: 10.15.6
BuildVersion: 19G73
Same issue here:
$ m itunes vol 0
35:41: execution error: The variable volume is not defined. (-2753)
39:45: execution error: The variable volume is not defined. (-2753)
$ m itunes vol up
35:41: execution error: The variable volume is not defined. (-2753)
39:45: execution error: The variable volume is not defined. (-2753)
I think I found the issue. In m-cli's source, the app is references as "iTunes", but has be renamed in Catalina to "Music".
Example:
osascript -e 'tell application "iTunes" to sound volume as integer'
will fail where
osascript -e 'tell application "Music" to sound volume as integer'
succeeds.
Created a PR #158 to fix this problem in MacOS Catalina and above. Made a copy of iTunes plugin and renamed 'itunes' to 'music'
Great work @VishalBilagi. Sorry it's taken time to get around to reviewing.
How would you feel about putting the two commands together under music
, and eventually deprecate itunes
?