10 "github.com/docopt/docopt-go"
12 "github.com/anacrolix/torrent/metainfo"
16 builtinAnnounceList = [][]string{
17 {"udp://tracker.openbittorrent.com:80"},
18 {"udp://tracker.publicbt.com:80"},
19 {"udp://tracker.istole.it:6969"},
24 opts, err := docopt.Parse("Usage: torrent-create <root>", nil, true, "", true)
28 root := opts["<root>"].(string)
29 mi := metainfo.MetaInfo{
30 AnnounceList: builtinAnnounceList,
33 err = mi.Info.BuildFromFilePath(root)
37 err = mi.Info.GeneratePieces(func(fi metainfo.FileInfo) (io.ReadCloser, error) {
38 return os.Open(filepath.Join(root, strings.Join(fi.Path, string(filepath.Separator))))
41 log.Fatalf("error generating pieces: %s", err)
43 err = mi.Write(os.Stdout)