Code Monkey home page Code Monkey logo

rbedit's Introduction

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

  • Paypal
  • Patreon
  • SubscribeStar
  • Bitcoin: 1MpmXm5AHtdBoDaLZstJw8nupJJaeKu8V8
  • Etherium: 0x9AB1e3C3d8a875e870f161b3e9287Db0E6DAfF78
  • Litecoin: LdyaVR67LBnTf6mAT4QJnjSG2Zk67qxmfQ
  • Cardano: addr1qytaslmqmk6dspltw06sp0zf83dh09u79j49ceh5y26zdcccgq4ph7nmx6kgmzeldauj43254ey97f3x4xw49d86aguqwfhlte

rbedit's People

Contributors

g0tmi1k avatar rakshasa avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.