r160 - /debtorrent/trunk/DebTorrent/download_bt1.py

camrdale-guest at users.alioth.debian.org camrdale-guest at users.alioth.debian.org
Fri Jul 13 20:41:59 UTC 2007


Author: camrdale-guest
Date: Fri Jul 13 20:41:59 2007
New Revision: 160

URL: http://svn.debian.org/wsvn/debtorrent/?sc=1&rev=160
Log:
Remove the old-style downloader that is no longer used.

Modified:
    debtorrent/trunk/DebTorrent/download_bt1.py

Modified: debtorrent/trunk/DebTorrent/download_bt1.py
URL: http://svn.debian.org/wsvn/debtorrent/debtorrent/trunk/DebTorrent/download_bt1.py?rev=160&op=diff
==============================================================================
--- debtorrent/trunk/DebTorrent/download_bt1.py (original)
+++ debtorrent/trunk/DebTorrent/download_bt1.py Fri Jul 13 20:41:59 2007
@@ -224,113 +224,6 @@
 argslistheader = 'Arguments are:\n\n'
 
 
-def _failfunc(x):
-    """Default function to use for printing error messages.
-    
-    @type x: C{string}
-    @param x: the error message to print
-    
-    """
-    
-    print x
-
-def download(params, filefunc, statusfunc, finfunc, errorfunc, doneflag, cols,
-             pathFunc = None, presets = {}, exchandler = None,
-             failed = _failfunc, paramfunc = None):
-    """The old-style downloader (no longer used).
-    
-    @type params: unknown
-    @param params: unknown
-    @type filefunc: unknown
-    @param filefunc: unknown
-    @type statusfunc: unknown
-    @param statusfunc: unknown
-    @type finfunc: unknown
-    @param finfunc: unknown
-    @type errorfunc: unknown
-    @param errorfunc: unknown
-    @type doneflag: unknown
-    @param doneflag: unknown
-    @type cols: unknown
-    @param cols: unknown
-    @type pathFunc: unknown
-    @param pathFunc: unknown
-    @type presets: unknown
-    @param presets: unknown
-    @type exchandler: unknown
-    @param exchandler: unknown
-    @type failed: unknown
-    @param failed: unknown
-    @type paramfunc: unknown
-    @param paramfunc: unknown
-    
-    """
-
-    try:
-        config = parse_params(params, presets)
-    except ValueError, e:
-        failed('error: ' + str(e) + '\nrun with no args for parameter explanations')
-        return
-    if not config:
-        errorfunc(get_usage())
-        return
-    
-    myid = createPeerID()
-    seed(myid)
-
-    rawserver = RawServer(doneflag, config['timeout_check_interval'],
-                          config['timeout'], ipv6_enable = config['ipv6_enabled'],
-                          failfunc = failed, errorfunc = exchandler)
-
-    try:
-        listen_port = rawserver.find_and_bind(config['minport'], config['maxport'],
-                        config['bind'], ipv6_socket_style = config['ipv6_binds_v4'],
-                        randomizer = config['random_port'])
-    except socketerror, e:
-        failed("Couldn't listen - " + str(e))
-        return
-
-    response = get_response(config['responsefile'], config['url'], failed)
-    if not response:
-        return
-
-    infohash = sha(bencode(response['info'])).digest()
-
-    d = BT1Download(statusfunc, finfunc, errorfunc, exchandler, doneflag,
-                    config, response, infohash, myid, rawserver, listen_port)
-
-    if not d.saveAs(filefunc):
-        return
-
-    if pathFunc:
-        pathFunc(d.getFilename())
-
-    hashcheck = d.initFiles(old_style = True)
-    if not hashcheck:
-        return
-    if not hashcheck():
-        return
-    if not d.startEngine():
-        return
-    d.startRerequester()
-    d.autoStats()
-
-    statusfunc(activity = 'connecting to peers')
-
-    if paramfunc:
-        paramfunc({ 'max_upload_rate' : d.setUploadRate,  # change_max_upload_rate(<int KiB/sec>)
-                    'max_uploads': d.setConns, # change_max_uploads(<int max uploads>)
-                    'listen_port' : listen_port, # int
-                    'peer_id' : myid, # string
-                    'info_hash' : infohash, # string
-                    'start_connection' : d._startConnection, # start_connection((<string ip>, <int port>), <peer id>)
-                    })
-        
-    rawserver.listen_forever(d.getPortHandler())
-    
-    d.shutdown()
-
-
 def parse_params(params, presets = {}):
     """Parse the command-line parameters.
     




More information about the Debtorrent-commits mailing list