From 3c54eadf28bcd8f6b581ed5c14e80a08ef092a42 Mon Sep 17 00:00:00 2001 From: Matt Joiner Date: Tue, 14 Jun 2022 18:23:00 +1000 Subject: [PATCH] torrent serve: Print magnet link --- cmd/torrent/serve.go | 2 +- metainfo/metainfo.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/cmd/torrent/serve.go b/cmd/torrent/serve.go index ae12eb49..5546511c 100644 --- a/cmd/torrent/serve.go +++ b/cmd/torrent/serve.go @@ -65,7 +65,7 @@ func serve(ctx args.SubCmdCtx) error { if err != nil { return fmt.Errorf("setting trackers: %w", err) } - fmt.Println(ih) + fmt.Printf("%v: %v\n", to, to.Metainfo().Magnet(&ih, &info)) select {} }) return nil diff --git a/metainfo/metainfo.go b/metainfo/metainfo.go index 0aca2375..7ffa6d5b 100644 --- a/metainfo/metainfo.go +++ b/metainfo/metainfo.go @@ -69,7 +69,7 @@ func (mi *MetaInfo) SetDefaults() { } // Creates a Magnet from a MetaInfo. Optional infohash and parsed info can be provided. -func (mi *MetaInfo) Magnet(infoHash *Hash, info *Info) (m Magnet) { +func (mi MetaInfo) Magnet(infoHash *Hash, info *Info) (m Magnet) { m.Trackers = append(m.Trackers, mi.UpvertedAnnounceList().DistinctValues()...) if info != nil { m.DisplayName = info.BestName()