Improve current music status functions

This commit is contained in:
Elara 2021-08-23 10:16:03 -07:00
parent 75121b709c
commit 8648afeebf

View File

@ -95,13 +95,18 @@ func CurrentMetadata(key string) (string, error) {
if err != nil { if err != nil {
return "", err return "", err
} }
return string(out), nil data := string(out)
if data == "No player could handle this command" || data == "" {
data = "Unknown " + strings.Title(key)
}
return data, nil
} }
func CurrentStatus() (string, error) { func CurrentStatus() (bool, error) {
out, err := exec.Command("playerctl", "status").Output() out, err := exec.Command("playerctl", "status").Output()
if err != nil { if err != nil {
return "", err return false, err
} }
return string(out), nil data := string(out)
return data == "Playing", nil
} }