aboutsummaryrefslogtreecommitdiff
path: root/plugin/torrent/session.go
diff options
context:
space:
mode:
Diffstat (limited to 'plugin/torrent/session.go')
-rw-r--r--plugin/torrent/session.go49
1 files changed, 0 insertions, 49 deletions
diff --git a/plugin/torrent/session.go b/plugin/torrent/session.go
deleted file mode 100644
index 22c5d99d8..000000000
--- a/plugin/torrent/session.go
+++ /dev/null
@@ -1,49 +0,0 @@
-package torrent
-
-import (
- "io/ioutil"
- "log"
- "path/filepath"
- "time"
-
- rtorrent "github.com/cenkalti/rain/torrent"
-)
-
-func (t *Torrent) Do() error {
- dc := rtorrent.DefaultConfig
- dc.DHTEnabled = t.dht
- dc.RPCEnabled = false
- dc.DHTBootstrapNodes = []string{"127.0.0.1:7246"} // its a me
-
- td, err := ioutil.TempDir("", "example")
- if err != nil {
- return err
- }
- dc.DataDir = td
- dc.Database = filepath.Join(td, "session.db")
- s, err := rtorrent.NewSession(dc)
- if err != nil {
- return err
- }
-
- ti, err := NewTorrentInfo("plugin/torrent/testdata/db.miek.nl")
- if err != nil {
- return err
- }
-
- tor, err := s.AddTorrent(ti.ToReader(), nil)
- if err != nil {
- return err
- }
- // mag, _ := tor.Magnet()
-
- go s.StartAll()
-
- // Watch the progress
- for range time.Tick(time.Second) {
- s := tor.Stats()
- log.Printf("Status: %s, Downloaded: %d, Peers: %d", s.Status.String(), s.Bytes.Completed, s.Peers.Total)
- }
- return nil
-
-}