From: Matt Joiner Date: Wed, 9 Jul 2014 14:15:03 +0000 (+1000) Subject: torrent-infohash: utility to print the info hash of a torrent file X-Git-Tag: v1.0.0~1682 X-Git-Url: http://www.git.stargrave.org/?a=commitdiff_plain;h=7928b763d98a08f076f829320bfef42c687be77d;p=btrtrc.git torrent-infohash: utility to print the info hash of a torrent file --- diff --git a/cmd/torrent-infohash/main.go b/cmd/torrent-infohash/main.go new file mode 100644 index 00000000..96948d8e --- /dev/null +++ b/cmd/torrent-infohash/main.go @@ -0,0 +1,19 @@ +package main + +import ( + "flag" + "fmt" + "github.com/anacrolix/libtorgo/metainfo" + "log" +) + +func main() { + flag.Parse() + for _, arg := range flag.Args() { + mi, err := metainfo.LoadFromFile(arg) + if err != nil { + log.Fatal(err) + } + fmt.Printf("%x: %s\n", mi.InfoHash, arg) + } +}