Package DebTorrent :: Module download_bt1
[hide private]
[frames] | no frames]

Module download_bt1

source code

Manage a single download.

Classes [hide private]
  BT1Download
Manage a single download.
Functions [hide private]
dictionary
parse_params(params, presets={})
Parse the command-line parameters.
source code
 
get_usage(defaults=[('configfile', '', 'the configuration file to use, if not spe..., cols=100, presets={})
Print the usage information for the program.
source code
dictionary, dictionary
get_response(file, url, separate_all=0, default_tracker='http://dttracker.debian.net:6969/announce')
Get the response data from a metainfo or Packages file.
source code
dictionary, dictionary
get_packages(file, url, separate_all=0, default_tracker='http://dttracker.debian.net:6969/announce')
Extract the response data from a Packages file.
source code
Variables [hide private]
logging.Logger logger = logging.getLogger('DebTorrent.download_bt1')
the logger to send all log messages to for this module
list of (string, unknown, string) defaults = [('configfile', '', 'the configuration file to use,...
the default configuration variables, including descriptions
string argslistheader = 'Arguments are:\n\n'
the header to print before the default config

Imports: zurllib.urlopen, urlparse.urlparse, BT1.btformats.check_message, BT1.Choker.Choker, BT1.Storage.Storage, BT1.StorageWrapper.StorageWrapper, BT1.FileSelector.FileSelector, BT1.Uploader.Upload, BT1.Downloader.Downloader, BT1.HTTPDownloader.HTTPDownloader, BT1.Connecter.Connecter, RateLimiter.RateLimiter, BT1.Encrypter.Encoder, RawServer.RawServer, RawServer.autodetect_ipv6, RawServer.autodetect_socket_style, BT1.Rerequester.Rerequester, BT1.DownloaderFeedback.DownloaderFeedback, RateMeasure.RateMeasure, CurrentRateMeasure.Measure, BT1.PiecePicker.PiecePicker, BT1.Statistics.Statistics, ConfigDir.ConfigDir, bencode.bencode, bencode.bdecode, sha.sha, os.path, os.makedirs, os.listdir, os.walk, parseargs.parseargs, parseargs.formatDefinitions, parseargs.defaultargs, socket.error, random.seed, threading.Thread, threading.Event, clock.clock, BTcrypto.CRYPTO_OK, __init__.createPeerID, BT1.makemetafile.getpieces, BT1.makemetafile.getsubpieces, BT1.makemetafile.uniconvert, BT1.makemetafile.convert_all, gzip.GzipFile, StringIO.StringIO, binascii, logging


Function Details [hide private]

parse_params(params, presets={})

source code 
Parse the command-line parameters.
Parameters:
  • params (list of string) - the command-line parameters
  • presets (dictionary) - the preset values to use (optional)
Returns: dictionary
the configuration variables
Raises:
  • ValueError - if the parameters are not properly specified

get_usage(defaults=[('configfile', '', 'the configuration file to use, if not spe..., cols=100, presets={})

source code 
Print the usage information for the program.
Parameters:
  • defaults (list of tuple) - the default configuration variables (optional, default is to use defaults)
  • cols (int) - the width of the print out (optional, default is 100)
  • presets (dictionary) - the preset values to use (optional)

get_response(file, url, separate_all=0, default_tracker='http://dttracker.debian.net:6969/announce')

source code 

Get the response data from a metainfo or Packages file.

First checks to see if the data is in the Packages file format, and returns the extracted response data if it is. Otherwise, assumes it is a metainfo file and tries to get the response data from it.
Parameters:
  • file (string) - the file name to use, or None to indicate that the url is to be used
  • url (string) - the URL to download the metainfo file from
  • separate_all (int) - whether to separate the architecture:all packages into a separate torrent (optional, defaults to no)
  • default_tracker (string) - the default tracker to use for created torrents (optional, defaults to 'http://dttracker.debian.net:6969/announce')
Returns: dictionary, dictionary
the metainfo data

get_packages(file, url, separate_all=0, default_tracker='http://dttracker.debian.net:6969/announce')

source code 
Extract the response data from a Packages file.
Parameters:
  • file (string) - the file name to use, or None to indicate that the url is to be used
  • url (string) - the URL to download the metainfo file from
  • separate_all (int) - whether to separate the architecture:all packages into a separate torrent (optional, defaults to no)
  • default_tracker (string) - the default tracker to use for created torrents (optional, defaults to 'http://dttracker.debian.net:6969/announce')
Returns: dictionary, dictionary
the metainfo data

Variables Details [hide private]

defaults

the default configuration variables, including descriptions
Type:
list of (string, unknown, string)
Value:
[('configfile',
  '',
  'the configuration file to use, if not specified then a file in /etc\
/debtorrent will be used, followed by a file in the .DebTorrent direct\
ory in the user\'s home directory'),
 ('download_dir',
  '',
  'directory to save the download in, blank indicates use the user\'s \
...