// The tiered tracker URIs.
Trackers [][]string
InfoHash metainfo.Hash
- Info *metainfo.InfoEx
+ InfoBytes []byte
// The name to use if the Name field from the Info isn't available.
DisplayName string
// The chunk size to use for outbound requests. Defaults to 16KiB if not
}
func TorrentSpecFromMetaInfo(mi *metainfo.MetaInfo) (spec *TorrentSpec) {
+ info := mi.UnmarshalInfo()
spec = &TorrentSpec{
Trackers: mi.AnnounceList,
- Info: &mi.Info,
- DisplayName: mi.Info.Name,
- InfoHash: mi.Info.Hash(),
+ InfoBytes: mi.InfoBytes,
+ DisplayName: info.Name,
+ InfoHash: mi.HashInfoBytes(),
}
if spec.Trackers == nil && mi.Announce != "" {
spec.Trackers = [][]string{{mi.Announce}}
if spec.DisplayName != "" {
t.SetDisplayName(spec.DisplayName)
}
- if spec.Info != nil {
- err = t.SetInfoBytes(spec.Info.Bytes)
+ if spec.InfoBytes != nil {
+ err = t.SetInfoBytes(spec.InfoBytes)
if err != nil {
return
}