torrent serve: Print magnet link

This commit is contained in:
Matt Joiner 2022-06-14 18:23:00 +10:00
parent 0158a830f5
commit 3c54eadf28
No known key found for this signature in database
GPG Key ID: 6B990B8185E7F782
2 changed files with 2 additions and 2 deletions

View File

@ -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

View File

@ -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()