Coder Social home page Coder Social logo

bencview's Introduction

bencview

bencview - a .torrent files viewer for terminal pagers.
json2bencode - a converter from JSON to the torrent files format.

(Bencode is a data serialization format used by the BitTorrent network.)

Installation

(Ruby 2.3.0+)

$ gem install bencview

Add to your lesspipe.sh:

case "$1" in
...
    *.torrent) bencview "$1" ;;
...
esac

Optionally:

$ npm -g i json

Usage

View a torrent file:

$ bencview gimp.torrent
*info-hash: a85b7e7f035c55f684238d0e252b273fe2a1ccf5
*uri: magnet:?xt=urn:btih:a85b7e7f035c55f684238d0e252b273fe2a1ccf5&dn=gimp-2.8.14-setup-1.exe
announce: udp://tracker.publicbt.com:80
announce-list: 2
 udp://tracker.publicbt.com:80
 udp://tracker.openbittorrent.com:80
comment: GIMP 2.8.14 Installer for Microsoft Windows - updated
created by: mktorrent 1.0
creation date: Tue, 2 Sep 2014 22:05:50 +0000
url-list: 34
 http://gimper.net/downloads/pub/gimp/v2.8/windows
 http://gimp.afri.cc/pub/gimp/v2.8/windows
 [...]
info/name: gimp-2.8.14-setup-1.exe
info/pieces: 351 x 262,144
info/files: 1
 91,931,728 gimp-2.8.14-setup-1.exe
info/*files size: 91,931,728

Properties prefixed w/ '*' don't exist in the torrent file.

Remove all trackers from it:

$ bencview -j gimp.torrent | json -e 'delete this.announce; delete this["announce-list"]' | json2bencode > file.torrent

$ file file.torrent
file.torrent: BitTorrent file

$ bencview file.torrent
*info-hash: a85b7e7f035c55f684238d0e252b273fe2a1ccf5
*uri: magnet:?xt=urn:btih:a85b7e7f035c55f684238d0e252b273fe2a1ccf5&dn=gimp-2.8.14-setup-1.exe
comment: GIMP 2.8.14 Installer for Microsoft Windows - updated
created by: mktorrent 1.0
creation date: Tue, 2 Sep 2014 22:05:50 +0000
url-list: 34
 http://gimper.net/downloads/pub/gimp/v2.8/windows
 http://gimp.afri.cc/pub/gimp/v2.8/windows
 [...]
info/name: gimp-2.8.14-setup-1.exe
info/pieces: 351 x 262,144
info/files: 1
 91,931,728 gimp-2.8.14-setup-1.exe
info/*files size: 91,931,728

Note that the infohash hasn't changed.

History

This is a complete rewrite of the original bencview-0.0.x. bencview_clean util is gone, for bencview can export torrent files into JSON.

1.0.0 version is also ~2 times smaller.

Bugs

  • Both utils assume the UTF8 locale.

License

MIT.

bencview's People

Contributors

gromnitsky avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  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.