-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.go
44 lines (34 loc) · 992 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
package main
import (
"log"
"os"
)
type Presenter interface {
Show(events map[*Task]TaskEvent)
Stop()
}
func main() {
log.Printf(
"Starting the downloader. Version: %s (commit: %s, build time: %s).",
Version, Commit, BuildTime,
)
params, err := GetInParams()
if err != nil {
log.Fatal(err)
os.Exit(0)
return
}
log.Printf("Dowload path is: %s \n", params.DowloadPath)
tp := TaskProcessorNew(params.MaxSpeed, 2)
// tp.SetPresenter(&TextLogPresenter{}, 500)
tp.SetPresenter(NewProgresBarPresenter(), 500)
tp.Download(params.Targets)
}
// Useful links
// https://github.com/cheggaaa/pb
// https://github.com/cavaliercoder/grab
// https://stackoverflow.com/questions/30532886/golang-dynamic-progressbar
// https://github.com/gosuri/uiprogress
// https://stackoverflow.com/questions/44318345/can-i-increase-golangs-http-stream-chunk-size
// https://www.reddit.com/r/golang/comments/4xtsbn/help_how_to_read_files_in_blocks/
// https://gobyexample.com/reading-files