Package DebTorrent :: Module launchmanycore :: Class SingleDownload
[hide private]
[frames] | no frames]

Class SingleDownload

source code

Manage a single torrent download.

Instance Methods [hide private]
 
__init__(self, controller, hash, identifier, response, config, myid)
Initialize the instance and start a new downloader.
source code
 
start(self)
Initialize the new torrent download and schedule it for hash checking.
source code
string
saveAs(self, name, length, saveas, isdir)
Determine the location to save the torrent in.
source code
 
hashcheck_start(self, donefunc)
Start the hash checking of the torrent.
source code
 
hashcheck_callback(self)
Start the torrent running now that hash checking is complete.
source code
boolean
is_dead(self)
Check if the torrent download has been shutdown.
source code
 
_shutdown(self)
Loudly shutdown the running torrent.
source code
 
shutdown(self, quiet=True)
Shutdown the running torrent.
source code
 
update_status(self, activity=None, fractionDone=None)
Update the current activity's status.
source code
 
finished(self)
Indicate that the download has completed.
source code
 
error(self, msg)
Add a new error to the list of errors that have occurred.
source code
Instance Variables [hide private]
method _hashcheckfunc
the method to call to hash check the torrent
boolean checking
whether the hash check is in progress
boolean closed
whether the download has been shutdown
dictionary config
the configuration parameters
LaunchMany controller
the manager for all torrent downloads
download_bt1.BT1Download d
the downloader for the torrent
threading.Event doneflag
the flag that indicates when the torrent is to be shutdown
string hash
the info hash of the torrent
string identifier
the identifier of the torrent
ServerPortHandler.SingleRawServer rawserver
the simplified Server to use to handle this torrent
dictionary response
the meta info for the torrent
boolean seed
whether this peer is a seed
method statsfunc
the method to call to get the statistics for the running download
float status_done
the fraction of the current activity that is complete
list of string status_err
the list of errors that have occurred
int status_errtime
the time of the last error
string status_msg
the current activity the torrent is engaged in
boolean waiting
whether the download is waiting for the hash check to complete before starting
boolean working
whether the download is under way
Method Details [hide private]

__init__(self, controller, hash, identifier, response, config, myid)
(Constructor)

source code 
Initialize the instance and start a new downloader.
Parameters:
  • controller (LaunchMany) - the manager for all torrent downloads
  • hash (string) - the info hash of the torrent
  • identifier (string) - the identifier of the torrent
  • response (dictionary) - the meta info for the torrent
  • config (dictionary) - the configuration parameters
  • myid (string) - the peer ID to use

saveAs(self, name, length, saveas, isdir)

source code 
Determine the location to save the torrent in.
Parameters:
  • name (string) - the name from the torrent's metainfo
  • length (long) - the total length of the torrent download (not used)
  • saveas (string) - the user specified location to save to
  • isdir (boolean) - whether the torrent needs a directory
Returns: string
the location to save the torrent in

hashcheck_start(self, donefunc)

source code 
Start the hash checking of the torrent.
Parameters:
  • donefunc (method) - the method to call when the hash checking is complete

is_dead(self)

source code 
Check if the torrent download has been shutdown.
Returns: boolean
whether the torrent download has been shutdown

shutdown(self, quiet=True)

source code 
Shutdown the running torrent.
Parameters:
  • quiet (boolean) - whether to announce the shutdown (optional, defaults to True)

update_status(self, activity=None, fractionDone=None)

source code 

Update the current activity's status.

Really only used by StorageWrapper now.
Parameters:
  • activity (string) - the activity currently under way (optional, defaults to not changing the current activity)
  • fractionDone (float) - the fraction of the activity that is complete (optional, defaults to not changing the current fraction done)

error(self, msg)

source code 
Add a new error to the list of errors that have occurred.
Parameters:
  • msg (string) - the error message