m-cli icon indicating copy to clipboard operation
m-cli copied to clipboard

iTunes commands not working on macOS 10.15.6

Open pbnj opened this issue 4 years ago • 4 comments

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

pbnj avatar Aug 03 '20 16:08 pbnj

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)

XNinety9 avatar Oct 03 '20 15:10 XNinety9

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.

XNinety9 avatar Oct 03 '20 15:10 XNinety9

Created a PR #158 to fix this problem in MacOS Catalina and above. Made a copy of iTunes plugin and renamed 'itunes' to 'music'

VishalBilagi avatar Oct 17 '20 21:10 VishalBilagi

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?

bensleveritt avatar May 06 '21 13:05 bensleveritt