Improve current music status functions
This commit is contained in:
parent
032147ae61
commit
18dec0d2b5
@ -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
|
||||
}
|
||||
|
Reference in New Issue
Block a user