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.go25
1 files changed, 25 insertions, 0 deletions
diff --git a/plugin/torrent/session.go b/plugin/torrent/session.go
new file mode 100644
index 000000000..3b3a35a41
--- /dev/null
+++ b/plugin/torrent/session.go
@@ -0,0 +1,25 @@
+package torrent
+
+import (
+ "log"
+ "time"
+
+ rtorrent "github.com/cenkalti/rain/torrent"
+)
+
+func (t *Torrent) StartSession() error {
+ s, err := rtorrent.NewSession(torrent.DefaultConfig)
+ if err != nil {
+ return err
+ }
+
+ // Add magnet link
+ tor, _ := ses.AddURI(magnetLink, nil)
+
+ // 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)
+ }
+
+}