Project

bencview

0.0
No commit activity in last 3 years
No release in over 3 years
View .torrent files; JSON export/import
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Runtime

~> 0.8.2
 Project Readme

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.