-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathmodels.go
52 lines (44 loc) · 795 Bytes
/
models.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
package goutube
import "fmt"
type MediaType int
const (
VIDEO MediaType = iota
AUDIO
)
func (t MediaType) String() string {
var s string
switch t {
case VIDEO:
s = "VIDEO"
case AUDIO:
s = "AUDIO"
}
return s
}
type MediaFormat struct {
Type string
VideoCodec string
AudioCodec string
Raw string
}
type Link struct {
URL string
Type MediaType
Signature string
Quality string
Format MediaFormat
}
func (t Link) String() string {
quality := t.Quality
if len(quality) == 0 {
quality = "NA"
}
s := fmt.Sprintf("URL: %s,\n Type: %s,\n Quality: %s,\n Format(Raw): %s\n",
t.URL, t.Type, quality, t.Format.Raw)
return s
}
type Result struct {
Done chan bool
Error chan error
Links []Link
}