Improve current music status functions

This commit is contained in:
Elara 2021-08-23 10:16:03 -07:00
parent 032147ae61
commit 18dec0d2b5

View File

@ -95,13 +95,18 @@ func CurrentMetadata(key string) (string, error) {
if err != nil {
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()
if err != nil {
return "", err
return false, err
}
return string(out), nil
data := string(out)
return data == "Playing", nil
}