cmd/torrent/create.go | 10 ++++++++-- go.mod | 2 +- go.sum | 4 ++++ diff --git a/cmd/torrent/create.go b/cmd/torrent/create.go index d8681e8e6a4647fd0049019661c1497f5b8e6487..8f4440c44c15e96391c030bf3a75590a4b086c27 100644 --- a/cmd/torrent/create.go +++ b/cmd/torrent/create.go @@ -2,6 +2,7 @@ package main import ( "github.com/anacrolix/bargle" + "github.com/anacrolix/tagflag" "github.com/anacrolix/torrent/bencode" "github.com/anacrolix/torrent/metainfo" "os" @@ -20,8 +21,10 @@ EmptyAnnounceList bool `name:"n" help:"exclude default announce-list entries"` Comment string `name:"t" help:"comment"` CreatedBy string `name:"c" help:"created by"` InfoName *string `name:"i" help:"override info name (defaults to ROOT)"` + PieceLength tagflag.Bytes Url []string `name:"u" help:"add webseed url"` - Root string `arg:"positional"` + Private *bool + Root string `arg:"positional"` } cmd = bargle.FromStruct(&args) cmd.Desc = "Creates a torrent metainfo for the file system rooted at ROOT, and outputs it to stdout" @@ -43,7 +46,10 @@ if len(args.CreatedBy) > 0 { mi.CreatedBy = args.CreatedBy } mi.UrlList = args.Url - info := metainfo.Info{} + info := metainfo.Info{ + PieceLength: args.PieceLength.Int64(), + Private: args.Private, + } err = info.BuildFromFilePath(args.Root) if err != nil { return diff --git a/go.mod b/go.mod index 74bb792db51e860d863fd929c98e33e4174dd992..8e351f99c4ae461e6286125d6e9816bb5a9b6e87 100644 --- a/go.mod +++ b/go.mod @@ -51,7 +51,7 @@ require ( github.com/alecthomas/atomic v0.1.0-alpha2 // indirect github.com/alexflint/go-scalar v1.1.0 // indirect - github.com/anacrolix/bargle v0.0.0-20220622082028-6c0bfc8b614d // indirect + github.com/anacrolix/bargle v0.0.0-20220630015206-d7a4d433886a // indirect github.com/anacrolix/mmsg v1.0.0 // indirect github.com/anacrolix/stm v0.4.0 // indirect github.com/benbjohnson/immutable v0.3.0 // indirect diff --git a/go.sum b/go.sum index 06acff1ffee8fb5a752fc68519303b7d2535dd5a..b936cbe34d1cc4de00469e23c1cb9140d18a32b9 100644 --- a/go.sum +++ b/go.sum @@ -68,6 +68,10 @@ github.com/anacrolix/bargle v0.0.0-20220620083758-c3885e1796d1 h1:RijTNFCxug0EBODz/AmqJDA3Ow700v5jJZQL1j+RLvI= github.com/anacrolix/bargle v0.0.0-20220620083758-c3885e1796d1/go.mod h1:cC/kX8wL4i1n+63lOrXhPQQlsoxCo0EqV88fGExQwcY= github.com/anacrolix/bargle v0.0.0-20220622082028-6c0bfc8b614d h1:eSBxjJUsa4p5lCn8mlp6gOdzhZYZxqr4YHPk8Uwn1iQ= github.com/anacrolix/bargle v0.0.0-20220622082028-6c0bfc8b614d/go.mod h1:9xUiZbkh+94FbiIAL1HXpAIBa832f3Mp07rRPl5c5RQ= +github.com/anacrolix/bargle v0.0.0-20220627055849-08d7fa720ece h1:QPZd4ViWNy2uxIbrj1fIhvLxpe27GrnzaaVHGfY6Aac= +github.com/anacrolix/bargle v0.0.0-20220627055849-08d7fa720ece/go.mod h1:9xUiZbkh+94FbiIAL1HXpAIBa832f3Mp07rRPl5c5RQ= +github.com/anacrolix/bargle v0.0.0-20220630015206-d7a4d433886a h1:KCP9QvHlLoUQBOaTf/YCuOzG91Ym1cPB6S68O4Q3puo= +github.com/anacrolix/bargle v0.0.0-20220630015206-d7a4d433886a/go.mod h1:9xUiZbkh+94FbiIAL1HXpAIBa832f3Mp07rRPl5c5RQ= github.com/anacrolix/chansync v0.3.0 h1:lRu9tbeuw3wl+PhMu/r+JJCRu5ArFXIluOgdF0ao6/U= github.com/anacrolix/chansync v0.3.0/go.mod h1:DZsatdsdXxD0WiwcGl0nJVwyjCKMDv+knl1q2iBjA2k= github.com/anacrolix/dht/v2 v2.18.0 h1:btjVjzjKqO5nKGbJHJ2UmuwiRx+EgX3e+OCHC9+WRz8=