Improve current music status functions
This commit is contained in:
parent
75121b709c
commit
8648afeebf
@ -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
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user