John Hoffman's fork of the original bittorrent
Python Batchfile
Latest commit ed327c4 Sep 26, 2016 @effigies committed on GitHub Merge pull request #52 from effigies/fix_splitlist
Fix SplitList
Permalink
Failed to load latest commit information.
BitTornado TEST: Validate SplitList behavior Sep 19, 2016
docs RF Purge dead code left over from GUI Aug 26, 2015
targets Imported from BitTornado-0.3.18.tar.gz Jun 12, 2009
test Imported from BitTornado-0.3.18.tar.gz Jun 12, 2009
thosts Replace old trackers with Demonii Feb 7, 2015
.gitignore META Time to add a .gitignore May 28, 2014
.travis.yml TEST: Drop Python 3.3 support, ignore some Flake8 warnings Sep 18, 2016
LICENSE.txt Update version, authorship, report_url Feb 7, 2015
README.md DOC: Update README for merge Aug 25, 2015
btcompletedir.py RF Massive Python 3 transition Aug 14, 2015
btcopyannounce.py RF Massive Python 3 transition Aug 14, 2015
btdownloadcurses.py STY: Set globals after imports Aug 1, 2016
btdownloadheadless.py STY: Update variable names for clarity Aug 30, 2015
btlaunchmany.py RF Massive Python 3 transition Aug 14, 2015
btlaunchmanycurses.py STY: Set globals after imports Aug 1, 2016
btmakemetafile.py RF Massive Python 3 transition Aug 14, 2015
btreannounce.py BF: Update btreannounce to correctly set announce-list Aug 6, 2016
btrename.py RF Massive Python 3 transition Aug 14, 2015
btsethttpseeds.py RF Massive Python 3 transition Aug 14, 2015
btshowmetainfo.py Handle the case where a torrent has no trackers. Apr 26, 2016
bttrack.py STY: Set globals after imports Aug 1, 2016
ipranges.portugal.txt Imported from BitTornado-0.3.18.tar.gz Jun 12, 2009
pylintrc STY pylint cleanup Feb 14, 2015
setup.py Add all Python submodules to the distributed packages. Jan 11, 2016
tox.ini TEST: Drop Python 3.3 support, ignore some Flake8 warnings Sep 18, 2016
wincompletedirsetup.py RF Massive Python 3 transition Aug 14, 2015

README.md

BitTornado

BitTornado is a fork of the original Python BitTorrent distribution, made by John Hoffman to add some experimental features, most (if not all) of which are now standard in other clients and trackers. The last official release was made in 2006, and thus many newer features are missing, but BitTornado is also an accessible Python library, and has several simple tools for editing torrent files.

After several years of intermittent modifications, cleanups, modernization, and porting to Python 3.4, I have begun assigning version numbers. I have done my best to ensure that tagged versions and python-labelled branches (see below) work at least as well as they did in version 0.3.18. Since 0.4.0, the library components have been substantially reorganized, so expect dependent applications to break on upgrade.

Branches/Tags

Further development will be done in Python 3, although patches to the other branches may be accepted.

  • v0.3.18: Original import
  • legacy: Library structure unchanged, some fixes/cleanups made
  • python2.6: Python 2.6 compatibility maintained (legacy)
  • v0.4.0: Major restructuring, breaking depending applications
  • python2.7: Python 2.7 compatibility maintained (library structure updated)
  • master: Python 3

Using BitTornado Applications

Download or seed a file

A single file can be downloaded with any of the following commands:

btdownloadheadless.py myfile.torrent
btdownloadcurses.py myfile.torrent

A directory of files can be downloaded with any of the following commands:

btlaunchmany.py mydir
btlaunchmanycurses.py mydir

Attempting to download an already downloaded file will seed it.

Tracker

First, you need a tracker. If you're on a dynamic IP or otherwise unreliable connection, you should find someone else's tracker and use that. Otherwise, follow the rest of this step.

Trackers refer downloaders to each other. The load on the tracker is very small, so you only need one for all your files.

To run a tracker, execute the command bttrack.py Here is an example -

bttrack.py --port 6969 --dfile dstate

--dfile is where persistent information is kept on the tracker across invocations. It makes everything start working again immediately if you restart the tracker. A new one will be created if it doesn't exist already.

The tracker must be on a net-addressible box, and you must know the ip number or dns name of it.

The tracker outputs web logs to standard out. You can get information about the files it's currently serving by getting its index page.

Creating torrent files

btmakemetafile.py http://my.tracker:6969/announce myfile.ext

This will generate a file called myfile.ext.torrent

Make sure to include the port number in the tracker url if it isn't 80.

This command may take a while to scan over the whole file hashing it.

The /announce path is special and hard-coded into the tracker. Make sure to give the domain or ip your tracker is on instead of my.tracker.

You can use either a dns name or an IP address in the tracker url.

Creating many torrent files

btcompletedir.py http://my.tracker:6969/announce mydir

This will generate a torrent file for each file in mydir.

Editing torrent files

To view metadata encoded in the torrent file:

btshowmetainfo.py myfile.torrent

To set the announce tracker of a torrent file:

btreannounce.py http://mytracker.com:6969/announce myfile.torrent

To copy the announce information from one file to another:

btcopyannounce.py source.torrent destination.torrent

To set the default download name:

btrename.py myfile.torrent targetFileName.ext

To set HTTP seeds:

btsethttpseeds http://example.net/myfile myfile.torrent

To remove HTTP seeds:

btsethttpseeds 0 myfile.torrent