-
Notifications
You must be signed in to change notification settings - Fork 4
/
main.go
51 lines (45 loc) · 1.06 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
package main
import (
"embed"
"flag"
util "github.com/hktalent/go-utils"
"github.com/hktalent/wget-go/pkg"
"runtime"
"sync"
)
//go:embed config/*
var config embed.FS
func main() {
util.DoInit(&config)
runtime.GOMAXPROCS(runtime.NumCPU())
pkg.PipelineHttp1.SetNoLimit()
//os.Args = []string{"", "-u", "https://huggingface.co/TencentARC/T2I-Adapter/resolve/main/models/t2iadapter_style_sd14v1.pth"}
var t = flag.Bool("t", false, "file name with datetime")
var workerCount = flag.Int64("c", 8, "Connection concurrency")
var downloadUrl, out string
flag.StringVar(&out, "o", "", "out file name")
flag.StringVar(&downloadUrl, "u", "", "Download URL")
flag.Parse()
if "" != downloadUrl {
pkg.Main(t, downloadUrl, out, workerCount, nil)
} else {
var out1 = make(chan *string)
util.DoSyncFunc(func() {
util.ReadStdIn(out1)
})
for {
select {
case s := <-out1:
if nil == s {
break
} else if "" != *s {
var wg sync.WaitGroup
pkg.Main(t, *s, out, workerCount, &wg)
wg.Wait()
}
}
}
}
util.Wg.Wait()
util.CloseAll()
}