-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathmain.go
45 lines (35 loc) · 936 Bytes
/
main.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
package main
import (
"strings"
"github.com/spf13/pflag"
)
type Info struct {
Class string `json:"class"`
Text string `json:"text"`
}
func main() {
var autopauseplayers string
var watch string
var placeholder string
var toggle string
pflag.StringVarP(&autopauseplayers, "autopause", "a", "", "players to autopause")
pflag.StringVarP(&watch, "watch", "w", "", "metadata to watch (<player>:<data>)")
pflag.StringVarP(&placeholder, "placeholder", "p", "", "placeholder for empty text")
pflag.StringVarP(&toggle, "toggle", "t", "", "toggles play/pause for the given player. Starts the player otherwise.")
pflag.Parse()
if toggle != "" {
toggleOrStart(toggle)
return
}
if autopauseplayers != "" {
autopause(strings.Split(autopauseplayers, ","))
return
}
if watch == "" {
return
}
info := strings.Split(watch, ":")
player := info[0]
data := info[1]
watchPlayerMetaData(player, data, placeholder)
}