Toxblh / MTMR

🌟 [My TouchBar My rules]. The Touch Bar Customisation App for your MacBook Pro
https://mtmr.app
MIT License
4.22k stars 220 forks source link

Song title returns empty strings #306

Open vegardx opened 4 years ago

vegardx commented 4 years ago

After updating to Catalina (ugh, still regretting it) I've noticed that the song title and artist returns blank or empty strings. Randomly it will start displaying the information, but for the most part it will just return an empty string.

I'm not really sure if this is related to MTMR or just Catalina being a complete train wreck. I can see Spotify returning that it's not updating nowPlayingInfo because it apparently is identical, even though I changed to another song.

I also tried the music plugin. Same issue there.

Output of logs when changing song:

default 04:21:34.096138+0200    Spotify [NowPlayingInfo] Setting nowPlayingInfo with mergePolicy Replace: <NSCFDictionary 0x600002d94120 {
    kMRMediaRemoteNowPlayingInfoAlbum = Never Ever
    kMRMediaRemoteNowPlayingInfoTrackNumber = 1
    kMRMediaRemoteNowPlayingInfoTimestamp = 2020-04-30 02:21:34 +0000
    kMRMediaRemoteNowPlayingInfoTotalDiscCount = 1
    kMRMediaRemoteNowPlayingInfoTitle = Never Ever
    kMRMediaRemoteNowPlayingInfoElapsedTime = 0
    kMRMediaRemoteNowPlayingInfoPlaybackRate = 1
    kMRMediaRemoteNowPlayingInfoMediaType = kMRMediaRemoteNowPlayingInfoTypeAudio
    kMRMediaRemoteNowPlayingInfoDiscNumber = 1
    kMRMediaRemoteNowPlayingInfoContentItemIdentifier = 908B10D6-D561-4518-B7D9-FF9F27589E12
    kMRMediaRemoteNowPlayingInfoTotalTrackCount = 4
    kMRMediaRemoteNowPlayingInfoArtist = Röyksopp
    kMRMediaRemoteNowPlayingInfoDuration = 309.146
}>
default 04:21:34.096170+0200    Spotify [NowPlayingInfo] Setting nowPlayingInfo artwork: (null)
default 04:21:34.096360+0200    Spotify Sending short circuted notification kMRPlayerPlaybackQueueChangedNotification for <private>
default 04:21:34.096478+0200    Spotify PlaybackQueueInvalidation: NowPlayingItem for origin-yondu.local-1280262988/client-com.spotify.client-3466/player-MediaRemote-DefaultPlayer changed from
 item:<419B9FEC-5014-40C0-B2AA-1CB6C40BDF4F/FLYGER/CalculatedPlaybackPosition: 16.282822/PlaybackRate: 1.000000>
 -> 
item:<908B10D6-D561-4518-B7D9-FF9F27589E12/Never Ever/CalculatedPlaybackPosition: 0.000586/PlaybackRate: 1.000000>
default 04:21:34.096976+0200    mediaremoted    Set: origin-yondu.local-1280262988/client-com.spotify.client-3466 (Spotify)/player-MediaRemote-DefaultPlayer setting playbackQueue to <{
    contentItem = "item:<908B10D6-D561-4518-B7D9-FF9F27589E12/Never Ever/CalculatedPlaybackPosition: 0.001079/PlaybackRate: 1.000000>\n";
    location = 0;
}>
default 04:21:34.097141+0200    mediaremoted    Set: origin-yondu.local-1280262988/client-com.spotify.client-3466 (Spotify)/player-MediaRemote-DefaultPlayer setting nowPlayingItem to <<MRContentItem: 0x7ff95b610630> {
    identifier = "908B10D6-D561-4518-B7D9-FF9F27589E12";
    metadata =     {
        "__playbackRate" = 1;
        "__title" = "Never Ever";
        albumName = "Never Ever";
        artworkAvailable = 0;
        "custom: calculatedElapsedTime" = "00:00:00 (0.001184)";
        "custom: delta" = "00:00:00 (0.001174)";
        "custom: remainingTime" = "00:05:09 (309.146000)";
        discNumber = 1;
        duration = "00:05:09 (309.146000)";
        elapsedTime = "00:00:00 (0.000000)";
        elapsedTimeTimestamp = "2020-04-30 02:21:34 +0000";
        mediaSubType = 0;
        mediaType = 1;
        nowPlayingInfo =         {
        };
        nowPlayingInfoData = "{length = 4, bytes = 0x62706c69}...{length = 4, bytes = 0x000000cb}:261 bytes";
        playbackRate = 1;
        title = "Never Ever";
        totalDiscCount = 1;
        t>
default 04:21:34.097217+0200    mediaremoted    Set: origin-yondu.local-1280262988/client-com.spotify.client-3466 (Spotify)/player-MediaRemote-DefaultPlayer setting nowPlayingItem from <item:<419B9FEC-5014-40C0-B2AA-1CB6C40BDF4F/FLYGER/CalculatedPlaybackPosition: 16.283575/PlaybackRate: 1.000000>> to <item:<908B10D6-D561-4518-B7D9-FF9F27589E12/Never Ever/CalculatedPlaybackPosition: 0.001331/PlaybackRate: 1.000000>>
default 04:21:34.101293+0200    AirPlayXPCHelper    Request: playbackQueue<B3D1DF94-B74A-46D5-9415-B87A7CC2668C AirPlayXPCHelper-176 /M/L/A600.000000x600.000000/R[0:1]> for origin-yondu.local-1280262988/client-com.spotify.client-3466 (Spotify)/player-MediaRemote-DefaultPlayer
default 04:21:34.102442+0200    NowPlayingTouchUI   Request: playbackQueue<DE29326B-3A70-4E58-8C93-90419953AE26 NowPlayingTouchUI-1082 /M/L/A600.000000x600.000000/R[0:1]> for origin-yondu.local-1280262988/client-com.spotify.client-3466 (Spotify)/player-(null)
default 04:21:34.102896+0200    NowPlayingTouchUI   Response: playbackQueue<DE29326B-3A70-4E58-8C93-90419953AE26 NowPlayingTouchUI-1082 /M/L/A600.000000x600.000000/R[0:1]> returned <item:<908B10D6-D561-4518-B7D9-FF9F27589E12/Never Ever/CalculatedPlaybackPosition: 0.006969/PlaybackRate: 1.000000>
> for origin-yondu.local-1280262988/client-com.spotify.client-3466 (Spotify)/player-MediaRemote-DefaultPlayer in 0.0004 seconds
default 04:21:34.105633+0200    mediaremoted    [MRDNowPlayingPlaybackQueueServer] Handling playbackQueueRequest <B3D1DF94-B74A-46D5-9415-B87A7CC2668C AirPlayXPCHelper-176 /M/L/A600.000000x600.000000/R[0:1]> from <AirPlayXPCHelper-176> for <origin-yondu.local-1280262988/client-com.spotify.client-3466 (Spotify)/player-MediaRemote-DefaultPlayer>
default 04:21:34.106707+0200    mediaremoted    [MRDNowPlayingPlaybackQueueServer] Modifying playbackQueueRequest <B3D1DF94-B74A-46D5-9415-B87A7CC2668C AirPlayXPCHelper-176 /M/L/A600.000000x600.000000/R[0:1]< to <B3D1DF94-B74A-46D5-9415-B87A7CC2668C AirPlayXPCHelper-176 /M/L/A600.000000x600.000000/R[0:1]>
default 04:21:34.107072+0200    mediaremoted    Posted Active Now Playing Notification kMRNowPlayingPlaybackQueueChangedNotification for path origin-yondu.local-1280262988/client-com.spotify.client-3466 (Spotify)/player-MediaRemote-DefaultPlayer
default 04:21:34.107743+0200    AirPlayXPCHelper    Response: playbackQueue<B3D1DF94-B74A-46D5-9415-B87A7CC2668C AirPlayXPCHelper-176 /M/L/A600.000000x600.000000/R[0:1]> returned <item:<908B10D6-D561-4518-B7D9-FF9F27589E12/Never Ever/CalculatedPlaybackPosition: 0.011803/PlaybackRate: 1.000000>
> for origin-yondu.local-1280262988/client-com.spotify.client-3466 (Spotify)/player-MediaRemote-DefaultPlayer in 0.0065 seconds
default 04:21:34.108688+0200    contextstored   Request: playbackQueue<1297EC1D-0228-405B-AB3C-F9A1CD805E64 contextstored-209 /M/L/R[0:1]> for origin-yondu.local-1280262988/client--0/player-(null)
default 04:21:34.108927+0200    ContextStoreAgent   Request: playbackQueue<D255CB4B-72AB-4D56-85F0-4661B2B28F74 ContextStoreAgent-404 /M/L/R[0:1]> for origin-yondu.local-1280262988/client--0/player-(null)
default 04:21:34.109072+0200    contextstored   Request: clientProperties<017CFA84-602F-4FDE-909E-B20C1E341760> for origin-(null)-0/client--0/player-(null)
default 04:21:34.109191+0200    ContextStoreAgent   Request: clientProperties<E67F0AD7-D89C-42DA-8DD7-EEC3E50EE979> for origin-(null)-0/client--0/player-(null)
default 04:21:34.109312+0200    contextstored   Response: playbackQueue<1297EC1D-0228-405B-AB3C-F9A1CD805E64 contextstored-209 /M/L/R[0:1]> returned <item:<908B10D6-D561-4518-B7D9-FF9F27589E12/Never Ever/CalculatedPlaybackPosition: 0.013383/PlaybackRate: 1.000000>
> for origin-yondu.local-1280262988/client-com.spotify.client-3466 (Spotify)/player-MediaRemote-DefaultPlayer in 0.0006 seconds
default 04:21:34.109441+0200    ContextStoreAgent   Response: playbackQueue<D255CB4B-72AB-4D56-85F0-4661B2B28F74 ContextStoreAgent-404 /M/L/R[0:1]> returned <item:<908B10D6-D561-4518-B7D9-FF9F27589E12/Never Ever/CalculatedPlaybackPosition: 0.013517/PlaybackRate: 1.000000>
> for origin-yondu.local-1280262988/client-com.spotify.client-3466 (Spotify)/player-MediaRemote-DefaultPlayer in 0.0005 seconds
default 04:21:34.109494+0200    contextstored   Request: playbackState<EC9F4B93-D2C4-45C2-AAA2-6CDE0BC7BCFF> for origin-yondu.local-1280262988/client-com.spotify.client-3466 (Spotify)/player-MediaRemote-DefaultPlayer
default 04:21:34.109684+0200    ContextStoreAgent   Request: playbackState<FB56FA4D-9526-447E-B4DA-91962361C340> for origin-yondu.local-1280262988/client-com.spotify.client-3466 (Spotify)/player-MediaRemote-DefaultPlayer
default 04:21:34.109957+0200    contextstored   Response: playbackState<EC9F4B93-D2C4-45C2-AAA2-6CDE0BC7BCFF> returned <Playing> for origin-yondu.local-1280262988/client-com.spotify.client-3466 (Spotify)/player-MediaRemote-DefaultPlayer in 0.0006 seconds
default 04:21:34.110161+0200    ContextStoreAgent   Response: playbackState<FB56FA4D-9526-447E-B4DA-91962361C340> returned <Playing> for origin-yondu.local-1280262988/client-com.spotify.client-3466 (Spotify)/player-MediaRemote-DefaultPlayer in 0.0005 seconds
default 04:21:34.110933+0200    contextstored   Response: clientProperties<017CFA84-602F-4FDE-909E-B20C1E341760> returned <<_MRNowPlayingClientProtobuf: 0x7fa446e2a470> {
    bundleIdentifier = "com.spotify.client";
    displayName = Spotify;
    processIdentifier = 3466;
    processUserIdentifier = 501;
}> for origin-(null)-0/client--0/player-(null) in 0.0019 seconds
default 04:21:34.111932+0200    ContextStoreAgent   Response: clientProperties<E67F0AD7-D89C-42DA-8DD7-EEC3E50EE979> returned <<_MRNowPlayingClientProtobuf: 0x7fb834d14290> {
    bundleIdentifier = "com.spotify.client";
    displayName = Spotify;
    processIdentifier = 3466;
    processUserIdentifier = 501;
}> for origin-(null)-0/client--0/player-(null) in 0.0027 seconds
default 04:21:34.112363+0200    mediaremoted    Posted Active Now Playing Notification kMRMediaRemoteNowPlayingInfoDidChangeNotification for path origin-yondu.local-1280262988/client-com.spotify.client-3466 (Spotify)/player-MediaRemote-DefaultPlayer
default 04:21:34.681376+0200    Spotify [NowPlayingInfo] Setting identical nowPlayingInfo, skipping update.

My configuration:

[
  {
    "type":"play",
    "width":80,
    "align":"left"
  },
  {
    "type":"mute",
    "width":80,
    "align":"left"
  },
  {
    "type":"group",
    "align":"right",
    "bordered":true,
    "title":"Controls",
    "items":[
      {
        "type":"close",
        "align":"right"
      },
      {
        "type":"volumeUp",
        "width":45,
        "align":"left"
      },
      {
        "type":"volume",
        "width":200,
        "align":"left"
      },
      {
        "type":"volumeUp",
        "width":45,
        "align":"left"
      },
      {
        "type":"brightnessUp",
        "width":45,
        "align":"left"
      },
      {
        "type":"brightness",
        "width":200,
        "align":"left"
      },
      {
        "type":"brightnessDown",
        "width":45,
        "align":"left"
      }
    ]
  },
  {
    "type":"appleScriptTitledButton",
    "source":{
      "inline":"if application \"Spotify\" is running then\rtell application \"Spotify\"\rif player state is playing then\rreturn (get artist of current track) & \" – \" & (get name of current track)\relse\rreturn \"\"\rend if\rend tell\rend if\rreturn \"\"\r"
    },
    "action":"appleScript",
    "actionAppleScript":{
      "inline":"if application \"Spotify\" is running then\rtell application \"Spotify\"\rif player state is playing then\rnext track\rend if\rend tell\rend if\r"
    },
    "refreshInterval":3
  },
  {
    "type":"shellScriptTitledButton",
    "source":{
      "inline":"/usr/bin/pmset -g batt | grep -o -E \"[0-9]+%\""
    },
    "refreshInterval":5,
    "align": "right",
    "bordered":false
  },
  {
    "type":"timeButton",
    "formatTemplate":"HH:mm",
    "align":"right",
    "locale":"nb_NO",
    "bordered":false
  }
]
admnov38 commented 4 years ago

Hi, I dont know how it is with Spotify, but me being an Apple Music user I modified my .json config file so it works with the new catalina "Music" app instead of "iTunes" and added a feature so you can pause/unpause by pressing and skipping tracks by holding on the element. I works for me flawlessly on the latest version on MacOS. Feel free to change up some things, maybe it will help you sort this out.

"type": "appleScriptTitledButton",
    "source":
    {
      "inline":
        "if application \"Music\" is running then\rtell application \"Music\"\rif (player state is playing) or (player state is paused) \rreturn (get artist of current track) & \" – \" & (get name of current track)\relse\rreturn \"\"\rend if\rend tell\rend if\rreturn \"\"\r"
    },

    "action": "appleScript",
    "actionAppleScript": {
      "inline":
        "tell application \"Music\"\rif player state is paused\rplay\relse\rpause\rend if\rend tell\r"
    },

    "longAction": "appleScript",
    "longActionAppleScript": {
      "inline":
        "if application \"Music\" is running then \rtell application \"Music\"\rnext track & play\rend tell\rend if\r"
bobrosoft commented 4 years ago

@vegardx I noticed that too, that's a bug in latest Spotify 🤦‍♂️ https://community.spotify.com/t5/Desktop-Mac/You-broke-AppleScript-Again/td-p/4937134 https://community.spotify.com/t5/Desktop-Mac/Applescript-no-longer-reports-Spotify-Connect-song-playing/td-p/4925257

bobrosoft commented 4 years ago

Ok, looks solved now in latest Spotify v1.1.34.694.gac68a2b3 ! 🎉