fix(spotify): adjust incorrect erorr check

This commit is contained in:
Jan De Dobbeleer 2024-03-05 12:49:56 +01:00 committed by Jan De Dobbeleer
parent 21df976c2f
commit ae73c1dad5

View file

@ -3,24 +3,28 @@
package segments
func (s *Spotify) Enabled() bool {
var err error
// Check if running
running := s.runAppleScriptCommand("application \"Spotify\" is running")
if running == "false" || running == "" {
s.Status = stopped
return false
}
s.Status = s.runAppleScriptCommand("tell application \"Spotify\" to player state as string")
if err != nil {
if len(s.Status) == 0 {
s.Status = stopped
return false
}
if s.Status == stopped {
return false
}
s.Artist = s.runAppleScriptCommand("tell application \"Spotify\" to artist of current track as string")
s.Track = s.runAppleScriptCommand("tell application \"Spotify\" to name of current track as string")
s.resolveIcon()
return true
}