FelixKratz / SketchyBar

A highly customizable macOS status bar replacement
https://felixkratz.github.io/SketchyBar/
GNU General Public License v3.0
5.65k stars 86 forks source link

Malformed Spotify PlaybackStateChanged $INFO #291

Closed neutonfoo closed 1 year ago

neutonfoo commented 1 year ago

I can't seem to find this anywhere so it might be just me, but sometimes the $INFO for the com.spotify.client.PlaybackStateChanged event comes back malformed, either with additional closing backets and/or invalid characters almost always at the end of the $INFO json. This usually results in jq parse errors.

Unsure if anyone else has encountered this.

Example malformed (printed $INFO into a file)

{
  "Player State" : "Playing",
  "Name" : "Fiction",
  "Track ID" : "spotify:track:69QlYqNJeZG14R4an2aoJv",
  "Album" : "Fiction And Fact",
  "Disc Number" : 1,
  "Play Count" : 0,
  "Popularity" : 57,
  "Has Artwork" : true,
  "Duration" : 235000,
  "Artist" : "Beast",
  "Album Artist" : "Beast",
  "Playback Position" : 0,
  "Track Number" : 2
} 4
}
}

I usually have to santinize the output before I can jq it without errors with this line.

SPOTIFY_JSON="{$(echo $INFO | iconv -f utf-8 -t utf-8 -c | cut -d'}' -f1 | cut -d'{' -f2)}"

es183923 commented 1 year ago

See #271 for the same issue