-
Notifications
You must be signed in to change notification settings - Fork 4
/
main.go
110 lines (90 loc) · 2.1 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
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
package main
import (
"fmt"
"myProject/videoCollector/account"
"myProject/videoCollector/common"
"myProject/videoCollector/engine"
"os"
"os/signal"
"strings"
"syscall"
"time"
)
var line = "******************************************************************************"
func main() {
// read config
conf := common.ReadConfig()
if conf == nil {
time.Sleep(time.Second * 100)
return
}
// check version
//code, msg := account2.CheckVersion()
//if code != 1 {
// if len(msg) > 0 {
// fmt.Println(msg)
// } else {
// fmt.Println("请检查网络,稍后再试")
// }
// time.Sleep(time.Second * 100)
// return
//} else if len(msg) > 0 {
// fmt.Println(msg)
// time.Sleep(time.Second * 3)
//}
// check account
if len(conf.AppID) < 10 {
fmt.Println("请填写app id")
time.Sleep(time.Hour)
return
}
account := account.NewAccount(conf.AppID, "")
fmt.Println(line)
fmt.Println(line)
fmt.Println(line)
fmt.Println()
fmt.Println()
printInfo()
if account.AccType < 0 {
fmt.Println(formatline("无效账户"))
fmt.Println(formatline("密钥 购买地址:"+"https://www.kuaifaka.com/purchasing?link=3ZUpQ"))
} else {
fmt.Println(formatline(fmt.Sprintf("账户 密钥:%v",account.AppId[:10] + strings.Repeat("*",16))))
fmt.Println(formatline(account.Msg))
fmt.Println(formatline(account.Time))
}
fmt.Println()
fmt.Println()
fmt.Println(line)
fmt.Println(line)
fmt.Println(line)
time.Sleep(time.Second * 6)
if account.AccType < 0 {
time.Sleep(time.Second * 100)
return
}
if conf.SSR {
fmt.Println("ssr账户检测中...")
}
eng := engine.NewEngine(conf, account)
fmt.Println("开始采集...")
go func() {
sig := make(chan os.Signal, 1)
signal.Notify(sig, syscall.SIGINT, syscall.SIGTERM)
msg := <-sig
fmt.Println("receive exit msg:", msg)
eng.Stop()
os.Exit(1)
}()
eng.Init()
eng.Run()
select {}
}
func formatline(text string)string {
r := strings.Repeat(" ", 10)
return r + text + r
}
func printInfo() {
fmt.Println(formatline("视频采集器"))
fmt.Println(formatline("软件地址:https://github.com/suifengqjn/videoCollector"))
}