]> Sergey Matveev's repositories - btrtrc.git/commitdiff
torrent-infohash: utility to print the info hash of a torrent file
authorMatt Joiner <anacrolix@gmail.com>
Wed, 9 Jul 2014 14:15:03 +0000 (00:15 +1000)
committerMatt Joiner <anacrolix@gmail.com>
Wed, 9 Jul 2014 14:15:03 +0000 (00:15 +1000)
cmd/torrent-infohash/main.go [new file with mode: 0644]

diff --git a/cmd/torrent-infohash/main.go b/cmd/torrent-infohash/main.go
new file mode 100644 (file)
index 0000000..96948d8
--- /dev/null
@@ -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)
+       }
+}