Home

Awesome

rbEdit

A statically compiled and dependency-free Bencode editor in Go, useful for command line use and scripts.

Quick Start

# Compile:
./scripts/build.sh

# Compile for darwin arch:
TARGET_OS=darwin ./scripts/build.sh

# Compile for linux arch:
TARGET_OS=linux ./scripts/build.sh

The only build requirement is Docker and the binary has no runtime dependencies.

./build/rbedit announce get --input ./test.torrent

Print announce url.

./build/rbedit announce put --input ./test.torrent --inplace http://example.com/announce

Change announce url.

./build/rbedit get --input ./test.torrent info length

Get value of the length entry in the info map.

./build/rbedit put --input ./test.torrent --inplace --bencode d3:bari2e3:bazi3e3:fooi1ee foo-info

Write a custom bencoded object to foo-info entry in the torrent root.

Batch Operations

Generate 10,000 torrents with unique info hashes:

$ RBEDIT_PATH=./build/rbedit-darwin-amd64 COUNT=10000 ./scripts/generate-torrents.sh /tmp/slackware-14.2-install-d1.torrent /tmp/slackware-torrents
Generating torrent test files

RBEDIT_PATH: ./build/rbedit
COUNT: 10000
SRC-TORRENT: /tmp/slackware-14.2-install-d1.torrent
DEST-DIR: /tmp/slackware-torrents
PREFIX-DEPTH: 1

generating..................................

Finished generating 10000 torrents

$ find /tmp/slackware-torrents -type f | wc -l
   10000

# du -h -d0 /tmp/slackware-torrents
273M    /Users/rakshasa/tmp/slackware-torrents/

Check the announce url of all 10,000 torrents:

$ time ./build/rbedit-darwin-amd64 announce get --input <(find /tmp/torrents -type f) --batch | tail -n3
http://trackers.transamrit.net:8082/announce
http://trackers.transamrit.net:8082/announce
http://trackers.transamrit.net:8082/announce

real    0m0.523s
user    0m0.375s
sys     0m0.374s

Replace the announce urls and overwrite the source files for all 10,000 torrents:

$ time ./build/rbedit-darwin-amd64 announce put --input <(find /tmp/torrents -type f) --batch --inplace http://new.example.com/announce

real    0m2.672s
user    0m0.841s
sys     0m1.858s

Verify the announce urls were changed:

$ ./build/rbedit-darwin-amd64 announce get --input <(find /tmp/torrents -type f) --batch | tail -n3
http://new.example.com/announce
http://new.example.com/announce
http://new.example.com/announce

Donate to rTorrent development