matryer / xbar-plugins

Plugin repository for xbar (the BitBar reboot)
https://xbarapp.com
2.45k stars 1.04k forks source link

re: iTunes Now Playing #112

Closed sfai05 closed 8 years ago

sfai05 commented 8 years ago

FAO: (@daturkel) Its not working when listen to Apple Music. I did some research and find it difficult to do that so can we just hide the widget when listen to Apple Music ?

daturkel commented 8 years ago

I'm not sure why this would be the case. Feel free to submit a pull request to toggle the plugin's display when it's using Apple Music.

blockloop commented 8 years ago

It works for me using Apple Music using El Capitan. @sfai05 can you paste the output of the script that runs in terminal?

citoki commented 8 years ago

also not working on my machine (10.11.2), get the following error in terminal:

54:60: execution error: Can’t make name of «class pTrk» of application "iTunes" into type string. (-1700)
56:62: execution error: Can’t make «class pArt» of «class pTrk» of application "iTunes" into type string. (-1700)
55:61: execution error: Can’t make «class pAlb» of «class pTrk» of application "iTunes" into type string. (-1700)
▶ -
---
Track: | color=#333333
Artist: | color=#333333
Album: | color=#333333
---
Pause | bash=/Users/d060015/Sites/github-apps/bitbar-plugins/Enabled/itunes.10s.sh param1=playpause terminal=false
Previous | bash=/Users/d060015/Sites/github-apps/bitbar-plugins/Enabled/itunes.10s.sh param1=previous terminal=false
Next | bash=/Users/d060015/Sites/github-apps/bitbar-plugins/Enabled/itunes.10s.sh param1=next terminal=false

image

How can I debug to the root cause?

blockloop commented 8 years ago

Can you run the following in Terminal and paste the output please?

osascript -e 'tell application "iTunes" to name of current track''

Does this error persist or does it go away? Mine did that for a while and then it disappeared after a few refreshes.

citoki commented 8 years ago

thanks, here you go:

$ osascript -e 'tell application "iTunes" to name of current track'
29:33: execution error: iTunes got an error: Can’t get name of current track. (-1728)
citoki commented 8 years ago

I have to be more precise on that issue. When I listen to a radio station via iTunes tab 'Radio' it works fine. When I choose beats 1 for example, the output is correct:

$ osascript -e 'tell application "iTunes" to name of current track'
Beats 1

The error is only shown when I choose music via 'For, You', 'New', 'Connect' or 'iTunes Store'.

alex-ruehe commented 8 years ago

This is a known bug and was submitted to Apple by multiple people. Can't do anything about it unless they fix it.

matryer commented 8 years ago

Closing, as there seems to be nothing we can do.

loretoparisi commented 8 years ago

Note:

$ osascript -e 'tell application "iTunes" to player position as string'
71,499000549316

the player position works with AppleMusic New etc tabs.

@matryer do you have the radar that has been filed to Apple? It would be helpful to check it something new was done.

alex-ruehe commented 8 years ago

This has been fixed in iTunes 12.4

loretoparisi commented 8 years ago

Specifically,

[ { data: '27,024000167847',
    exitCode: 0,
    cli: 'osascript -e tell application "iTunes" to player position as string' },
  { data: 'Wherever I Go',
    exitCode: 0,
    cli: 'osascript -e tell application "iTunes" to name of current track as string' },
  { data: 'OneRepublic',
    exitCode: 0,
    cli: 'osascript -e tell application "iTunes" to artist of current track as string' },
  { data: 'Wherever I Go - Single',
    exitCode: 0,
    cli: 'osascript -e tell application "iTunes" to album of current track as string' } ]
err data: 39:52: 

we have that player position, track name, artist name works properly now from News and from Music as well. So now all iTunes tabs are covered, Radio was working already.

NOTE. About player position, maybe it's more accurate like ['osascript', '-e', 'tell application "iTunes" to duration of current track as integer']