8 "github.com/anacrolix/torrent/metainfo"
13 for range time.Tick(time.Second * 5) {
14 for _, torrent := range client.Torrents() {
15 if torrent.Complete.Bool() {
16 fmt.Println("Dropping torrent", torrent.InfoHash().HexString())
23 mux := http.NewServeMux()
24 mux.HandleFunc("/torrent", func(w http.ResponseWriter, r *http.Request) {
25 if index >= len(infoHashes) {
26 w.Write([]byte("No more torrents to add"))
30 infoHash := infoHashes[index]
31 fmt.Println("Adding torrent", infoHash)
33 t, _ := client.AddTorrentInfoHash(metainfo.NewHashFromHex(infoHash))
36 fmt.Println("Download started for", infoHash)
45 if err := http.ListenAndServe(":8080", mux); err != nil {