Bases: exceptions.Exception
Raised when an invalid path is supplied
Bases: exceptions.Exception
Raised when an invalid piece size is set. Piece sizes must be multiples of 16KiB.
Bases: object
This class is used to create .torrent files.
** Usage **
>>> t = TorrentMetadata()
>>> t.data_path = "/tmp/torrent"
>>> t.comment = "My Test Torrent"
>>> t.trackers = [["http://tracker.openbittorent.com"]]
>>> t.save("/tmp/test.torrent")
Private torrents only announce to the tracker and will not use DHT or Peer Exchange.
The announce trackers is a list of lists.
The web seeds can either be: Hoffman-style: http://bittorrent.org/beps/bep_0017.html or, GetRight-style: http://bittorrent.org/beps/bep_0019.html
If the url ends in ‘.php’ then it will be considered Hoffman-style, if not it will be considered GetRight-style.
Private torrents only announce to the tracker and will not use DHT or Peer Exchange.
Creates and saves the torrent file to path.
| Parameters: |
|
|---|---|
| Raises InvalidPath: | |
if the data_path has not been set |
|
| Parameter: | comment (string) – an informational string |
|---|
| Parameter: | path (string) – the path to the data |
|---|---|
| Raises InvalidPath: | |
| if the path is not found | |
| Parameter: | pad (bool) – set True to align files on piece boundaries |
|---|
| Parameter: | size (int) – the desired piece size in KiBs |
|---|---|
| Raises InvalidPieceSize: | |
| if the piece size is not a multiple of 16 KiB | |
| Parameter: | private (bool) – True if the torrent is to be private |
|---|
| Parameter: | trackers (list of list of strings) – a list of lists of trackers, each list is a tier |
|---|
| Parameter: | webseeds (list of urls) – the webseeds which can be either Hoffman or GetRight style |
|---|
The announce trackers is a list of lists.
The web seeds can either be: Hoffman-style: http://bittorrent.org/beps/bep_0017.html or, GetRight-style: http://bittorrent.org/beps/bep_0019.html
If the url ends in ‘.php’ then it will be considered Hoffman-style, if not it will be considered GetRight-style.