-
Notifications
You must be signed in to change notification settings - Fork 4
/
main.go
88 lines (78 loc) · 1.98 KB
/
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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
package main
import (
"flag"
"fmt"
"horsaen/afreeca-downloader/plugins/bigo"
"horsaen/afreeca-downloader/plugins/chzzk"
"horsaen/afreeca-downloader/plugins/concurrent"
"horsaen/afreeca-downloader/plugins/flex"
"horsaen/afreeca-downloader/plugins/kick"
"horsaen/afreeca-downloader/plugins/panda"
"horsaen/afreeca-downloader/plugins/soop"
"horsaen/afreeca-downloader/plugins/tiktok"
"horsaen/afreeca-downloader/tools"
"horsaen/afreeca-downloader/views"
"log"
"os"
tea "github.com/charmbracelet/bubbletea"
)
func main() {
tools.InitConfDir()
tools.Exists("downloads")
var username string
mode := flag.String("mode", "tui", "Mode")
userArg := flag.String("username", "", "Streamer username")
playlist := flag.Bool("playlist", false, "Download bot playlists")
concurrently := flag.Bool("concurrent", false, "Download streams concurrently")
vod := flag.Bool("vod", false, "Download Afreeca vod")
version := flag.Bool("version", false, "Print version")
flag.Parse()
if *version {
tools.Version()
}
if *concurrently {
concurrent.Start()
}
if *userArg != "" || *playlist || *vod || *concurrently || *mode == "tui" {
username = *userArg
} else {
fmt.Println("Enter username:")
fmt.Scan(&username)
}
switch *mode {
// case "afreeca":
// if *playlist {
// inputPlaylists := afreeca.GetPlaylists()
// afreeca.Playlist(inputPlaylists)
// } else if *vod {
// var TitleNo string
// fmt.Println("Enter title number:")
// fmt.Scan(&TitleNo)
// afreeca.Vod(TitleNo)
// } else {
// afreeca.Start(username)
// }
case "soop":
soop.Start(username)
case "bigo":
bigo.Start(username)
case "chzzk":
chzzk.Start(username)
case "flex":
flex.Start(username)
case "kick":
kick.Start(username)
case "panda":
panda.Start(username)
case "tiktok":
tiktok.Start(username)
case "tui":
p := tea.NewProgram(views.InitialModel())
if _, err := p.Run(); err != nil {
log.Fatal(err)
}
default:
fmt.Println("Mode not supported, exiting.")
os.Exit(1)
}
}