-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.go
57 lines (42 loc) · 894 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
49
50
51
52
53
54
55
56
57
package main
import (
"github.com/andlabs/ui"
"github.com/KeizerDev/popcorntime-go/core"
"fmt"
)
func main() {
c := core.Core{Endpoint: core.ENDPOINT}
api := core.API{
Core: c,
}
err := ui.Main(func() {
window := ui.NewWindow("Popcorn Time Go", 200, 100, true)
wrapper := ui.NewVerticalBox()
window.SetChild(wrapper)
window.OnClosing(func(*ui.Window) bool {
ui.Quit()
return true
})
window.Show()
go counter(wrapper, api)
})
if err != nil {
panic(err)
}
}
func counter(wrapper *ui.Box, api core.API) {
resp, err := api.Movies(1, core.SORT_TRENDING, core.ORDER_NEWEST, "")
if err != nil {
panic(err)
}
ui.QueueMain(func() {
for _, value := range resp {
fmt.Println(value.Title)
box := ui.NewVerticalBox()
name := ui.NewEntry()
name.SetText(value.Title)
box.Append(name, false)
wrapper.Append(box, false)
}
})
}