Package DebTorrent :: Package BT1 :: Module HTTPDownloader :: Class HTTPDownloader
[hide private]
[frames] | no frames]

Class HTTPDownloader

source code

Collection of all the HTTP downloads.

Instance Methods [hide private]
 
__init__(self, storage, picker, rawserver, finflag, errorfunc, peerdownloader, max_rate_period, infohash, measurefunc, gotpiecefunc, filenamefunc)
Initialize the instance.
source code
SingleDownload
make_download(self, url)
Create a new download from a site.
source code
list of SingleDownload
get_downloads(self)
Get the list of all current downloads.
source code
 
cancel_piece_download(self, pieces)
Cancel any active downloads for the pieces.
source code
Instance Variables [hide private]
list of SingleDownload downloads
the list of all current download connections to sites
method errorfunc
the method to call when an error occurs
method filenamefunc
the method to call to determine the file name that the download is being saved under
threading.Event finflag
the flag indicating when the download is complete
method gotpiecefunc
the method to call when a piece comes in
string infohash
the info hash
float max_rate_period
maximum amount of time to guess the current rate estimate represents
method measurefunc
the method to call to add downloaded data to the total download rate measurement
Downloader.Downloader peerdownloader
the instance of the collection of normal downloaders
PiecePicker.PiecePicker picker
the piece choosing instance
Debtorrent.RawServer.RawServer rawserver
the server
int seedsfound
the number of seeds successfully downloaded from
StorageWrapper.StorageWrapper storage
the piece storage instance
Method Details [hide private]

__init__(self, storage, picker, rawserver, finflag, errorfunc, peerdownloader, max_rate_period, infohash, measurefunc, gotpiecefunc, filenamefunc)
(Constructor)

source code 
Initialize the instance.
Parameters:
  • storage (StorageWrapper.StorageWrapper) - the piece storage instance
  • picker (PiecePicker.PiecePicker) - the piece choosing instance
  • rawserver (Debtorrent.RawServer.RawServer) - the server
  • finflag (threading.Event) - the flag indicating when the download is complete
  • errorfunc (method) - the method to call when an error occurs
  • peerdownloader (Downloader.Downloader) - the instance of the collection of normal downloaders
  • max_rate_period (float) - maximum amount of time to guess the current rate estimate represents
  • infohash (string) - the info hash
  • measurefunc (method) - the method to call to add downloaded data to the total download rate measurement
  • gotpiecefunc (method) - the method to call when a piece comes in
  • filenamefunc (method) - the method to call to determine the save location

make_download(self, url)

source code 
Create a new download from a site.
Parameters:
  • url (string) - the base URL to use for downloading from that site
Returns: SingleDownload
the SingleDownload instance created

get_downloads(self)

source code 
Get the list of all current downloads.
Returns: list of SingleDownload
all current downloads from sites

cancel_piece_download(self, pieces)

source code 
Cancel any active downloads for the pieces.
Parameters:
  • pieces (list of int) - the list of pieces to cancel downloads of