r123 - in /debtorrent/trunk: DebTorrent/BT1/AptListener.py DebTorrent/download_bt1.py btdownloadheadless.py
camrdale-guest at users.alioth.debian.org
camrdale-guest at users.alioth.debian.org
Sat Jun 23 20:48:12 UTC 2007
Author: camrdale-guest
Date: Sat Jun 23 20:48:11 2007
New Revision: 123
URL: http://svn.debian.org/wsvn/debtorrent/?sc=1&rev=123
Log:
Add an option to specify the default tracker address to use.
Fix potential bug in btdownloadheadless.
Modified:
debtorrent/trunk/DebTorrent/BT1/AptListener.py
debtorrent/trunk/DebTorrent/download_bt1.py
debtorrent/trunk/btdownloadheadless.py
Modified: debtorrent/trunk/DebTorrent/BT1/AptListener.py
URL: http://svn.debian.org/wsvn/debtorrent/debtorrent/trunk/DebTorrent/BT1/AptListener.py?rev=123&op=diff
==============================================================================
--- debtorrent/trunk/DebTorrent/BT1/AptListener.py (original)
+++ debtorrent/trunk/DebTorrent/BT1/AptListener.py Sat Jun 23 20:48:11 2007
@@ -664,7 +664,7 @@
def start_torrent(self, info, name, path):
response = {'info': info,
- 'announce': 'http://dttracker.debian.net:6969/announce',
+ 'announce': self.config['default_tracker'],
'name': uniconvert(name)}
if path.count('dists'):
Modified: debtorrent/trunk/DebTorrent/download_bt1.py
URL: http://svn.debian.org/wsvn/debtorrent/debtorrent/trunk/DebTorrent/download_bt1.py?rev=123&op=diff
==============================================================================
--- debtorrent/trunk/DebTorrent/download_bt1.py (original)
+++ debtorrent/trunk/DebTorrent/download_bt1.py Sat Jun 23 20:48:11 2007
@@ -211,6 +211,7 @@
'file contains IP range data in the format: xxx:xxx:ip1-ip2'),
('logfile', '', 'file to write the tracker logs, use - for stdout (default)'),
('allow_get', 0, 'use with allowed_dir; adds a /file?hash={hash} url that allows users to download the torrent file'),
+ ('default_tracker', 'http://dttracker.debian.net:6969/announce', 'the default tracker address to use for new torrents'),
]
argslistheader = 'Arguments are:\n\n'
@@ -372,7 +373,8 @@
return (argslistheader + formatDefinitions(defaults, cols, presets))
-def get_response(file, url, errorfunc, separate_all = 0):
+def get_response(file, url, errorfunc, separate_all = 0,
+ default_tracker = 'http://dttracker.debian.net:6969/announce'):
"""Get the response data from a metainfo or Packages file.
First checks to see if the data is in the Packages file format, and
@@ -389,12 +391,15 @@
@type separate_all: C{int}
@param separate_all: whether to separate the architecture:all packages into
a separate torrent (optional, defaults to no)
+ @type default_tracker: C{string}
+ @param default_tracker: the default tracker to use for created torrents
+ (optional, defaults to 'http://dttracker.debian.net:6969/announce')
@rtype: C{dictionary}, C{dictionary}
@return: the metainfo data
"""
- (response, response_all) = get_packages(file, url, separate_all)
+ (response, response_all) = get_packages(file, url, separate_all, default_tracker)
if response:
try:
check_message(response)
@@ -456,7 +461,8 @@
return (response, None)
-def get_packages(file, url, separate_all = 0):
+def get_packages(file, url, separate_all = 0,
+ default_tracker = 'http://dttracker.debian.net:6969/announce'):
"""Extract the response data from a Packages file.
@type file: C{string}
@@ -467,6 +473,9 @@
@type separate_all: C{int}
@param separate_all: whether to separate the architecture:all packages into
a separate torrent (optional, defaults to no)
+ @type default_tracker: C{string}
+ @param default_tracker: the default tracker to use for created torrents
+ (optional, defaults to 'http://dttracker.debian.net:6969/announce')
@rtype: C{dictionary}, C{dictionary}
@return: the metainfo data
@@ -515,14 +524,18 @@
sub_pieces = getsubpieces(name)
(info, info_all) = getpieces(h, separate_all = separate_all, sub_pieces = sub_pieces)
-
- response = {'info': info,
- 'announce': 'http://dttracker.debian.net:6969/announce',
- 'name': uniconvert(name)}
-
- response_all = {'info': info_all,
- 'announce': 'http://dttracker.debian.net:6969/announce',
- 'name': uniconvert(convert_all(name))}
+
+ response = None
+ response_all = None
+ if info:
+ response = {'info': info,
+ 'announce': default_tracker,
+ 'name': uniconvert(name)}
+
+ if info_all:
+ response_all = {'info': info_all,
+ 'announce': default_tracker,
+ 'name': uniconvert(convert_all(name))}
except IOError, e:
# errorfunc('problem getting Packages info - ' + str(e))
Modified: debtorrent/trunk/btdownloadheadless.py
URL: http://svn.debian.org/wsvn/debtorrent/debtorrent/trunk/btdownloadheadless.py?rev=123&op=diff
==============================================================================
--- debtorrent/trunk/btdownloadheadless.py (original)
+++ debtorrent/trunk/btdownloadheadless.py Sat Jun 23 20:48:11 2007
@@ -307,9 +307,10 @@
config['min_time_between_log_flushes']),
config['port'])
- (response, response_all) = get_response(config['responsefile'], config['url'], h.error, config['separate_all'])
-
- if config['separate_all'] == 1:
+ (response, response_all) = get_response(config['responsefile'], config['url'], h.error,
+ config['separate_all'], config['default_tracker'])
+
+ if config['separate_all'] == 1 and response_all:
response = response_all
if not response:
More information about the Debtorrent-commits
mailing list