Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- func TCDownload(magnet string) error {
- log.Printf("Starting dowload for `%s`\n", magnet)
- defer log.Printf("`%s` finished downloading", magnet)
- torrent, err := client.AddMagnet(magnet)
- if err != nil {
- return err
- }
- log.Println("Getting information")
- <-torrent.GotInfo() // do this so things don't whine
- log.Println("Getting files")
- files := torrent.Files()
- if len(files) == 1 { // torrent is a single file so we download it all
- log.Println("Downloading all")
- torrent.DownloadAll()
- } else { // figure out which file is the video file
- log.Println("Not downloading all")
- for file := range files {
- println(file)
- }
- }
- client.WaitAll()
- return nil
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement