mirror of
https://github.com/JanDeDobbeleer/oh-my-posh.git
synced 2024-11-10 04:54:03 -08:00
fix(spotify): adjust incorrect erorr check
This commit is contained in:
parent
21df976c2f
commit
ae73c1dad5
|
@ -3,24 +3,28 @@
|
||||||
package segments
|
package segments
|
||||||
|
|
||||||
func (s *Spotify) Enabled() bool {
|
func (s *Spotify) Enabled() bool {
|
||||||
var err error
|
|
||||||
// Check if running
|
// Check if running
|
||||||
running := s.runAppleScriptCommand("application \"Spotify\" is running")
|
running := s.runAppleScriptCommand("application \"Spotify\" is running")
|
||||||
if running == "false" || running == "" {
|
if running == "false" || running == "" {
|
||||||
s.Status = stopped
|
s.Status = stopped
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
s.Status = s.runAppleScriptCommand("tell application \"Spotify\" to player state as string")
|
s.Status = s.runAppleScriptCommand("tell application \"Spotify\" to player state as string")
|
||||||
if err != nil {
|
|
||||||
|
if len(s.Status) == 0 {
|
||||||
s.Status = stopped
|
s.Status = stopped
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
if s.Status == stopped {
|
if s.Status == stopped {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
s.Artist = s.runAppleScriptCommand("tell application \"Spotify\" to artist of current track as string")
|
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.Track = s.runAppleScriptCommand("tell application \"Spotify\" to name of current track as string")
|
||||||
s.resolveIcon()
|
s.resolveIcon()
|
||||||
|
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue