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

Class DownloaderFeedback

source code

Gather and display statistics about the download.

Instance Methods [hide private]
 
__init__(self, choker, httpdl, add_task, upfunc, downfunc, ratemeasure, leftfunc, file_length, finflag, statistics, statusfunc=None, interval=None)
Initialize the instance.
source code
list of Connecter.Connection
_rotate(self)
Rotate the list of connections so it starts roughly where it did before.
source code
list of dictionary
spews(self)
Get information about the currently connected peers.
source code
dictionary
gather(self, displayfunc=None)
Gather the information about the download.
source code
 
display(self, displayfunc)
Gather the information about the download and display it.
source code
 
autodisplay(self, displayfunc, interval)
Initialize the automatic displayer.
source code
 
_autodisplay(self)
Call the displayer and reschedule.
source code
Instance Variables [hide private]
method add_task
the method to call to schedule future tasks
Choker.Choker choker
the Choker instance for the download
method displayfunc
the method to call to display the gathered data
threading.Event doneprocessing
flag that is set when the previous display is complete
method downfunc
the method to call to get the download rate
long file_length
the total length of the download
threading.Event finflag
flag to indicate when the download is complete
HTTPDownloder.HTTPDownloader httpdl
the HTTP downloader instance used by the download
int interval
the number of seconds between displays of the gathered data
list of string lastids
the peer IDs that were found the last time
method leftfunc
the method to call to determine the amount of data left to download
DebTorrent.RateMeasure.RateMeasure ratemeasure
the download rate measurement for the download
Statistics.Statistics statistics
the statistics gatherer for the download
method upfunc
the method to call to get the upload rate
Method Details [hide private]

__init__(self, choker, httpdl, add_task, upfunc, downfunc, ratemeasure, leftfunc, file_length, finflag, statistics, statusfunc=None, interval=None)
(Constructor)

source code 
Initialize the instance.
Parameters:
  • choker (Choker.Choker) - the Choker instance for the download
  • httpdl (HTTPDownloder.HTTPDownloader) - the HTTP downloader instance used by the download
  • add_task (method) - the method to call to schedule future tasks
  • upfunc (method) - the method to call to get the upload rate
  • downfunc (method) - the method to call to get the download rate
  • ratemeasure (DebTorrent.RateMeasure.RateMeasure) - the download rate measurement for the download
  • leftfunc (method) - the method to call to determine the amount of data left to download
  • file_length (long) - the total length of the download
  • finflag (threading.Event) - flag to indicate when the download is complete
  • statistics (Statistics.Statistics) - the statistics gatherer for the download
  • statusfunc (method) - the method to call to automatically display the gathered data (optional, default is to not automatically display anything)
  • interval (int) - the number of seconds between displays of the gathered data (optional, but must be set if the statusfunc is set)

_rotate(self)

source code 
Rotate the list of connections so it starts roughly where it did before.
Returns: list of Connecter.Connection
the connections from peers to the client

spews(self)

source code 
Get information about the currently connected peers.
Returns: list of dictionary
information about all the current peer connections

gather(self, displayfunc=None)

source code 
Gather the information about the download.
Parameters:
  • displayfunc (method) - not used (optional)
Returns: dictionary
various information about the download

display(self, displayfunc)

source code 
Gather the information about the download and display it.
Parameters:
  • displayfunc (method) - the method to call with the gathered information

autodisplay(self, displayfunc, interval)

source code 
Initialize the automatic displayer.
Parameters:
  • displayfunc (method) - the method to call to display the gathered data
  • interval (int) - the number of seconds between displays of the gathered data