-
-
Notifications
You must be signed in to change notification settings - Fork 6
/
main.go
48 lines (41 loc) · 837 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
46
47
48
package main
import (
"flag"
"fmt"
"github.com/go-olive/tv"
)
var (
cookie string
url string
roomID string
siteID string
)
func init() {
flag.StringVar(&cookie, "c", "", "site cookie")
flag.StringVar(&url, "u", "", "room url")
flag.StringVar(&roomID, "rid", "", "room ID")
flag.StringVar(&siteID, "sid", "", "site ID")
flag.Parse()
}
func main() {
switch {
case url != "":
t, err := tv.NewWithUrl(url, tv.SetCookie(cookie))
if err != nil {
println(err.Error())
return
}
t.Snap()
fmt.Println(t)
case roomID != "" && siteID != "":
t, err := tv.New(siteID, roomID, tv.SetCookie(cookie))
if err != nil {
println(err.Error())
return
}
t.Snap()
fmt.Println(t)
default:
fmt.Println("You need to specify [roomd id and site id] or [room url]\nType olive -h for more information.")
}
}