mirror of
https://git.FreeBSD.org/ports.git
synced 2025-02-05 11:35:01 +00:00
o Update to 4.20.4
o Add a new batch of local patches: - Better support for launchmany-{console,curses} - Add -save_incomplete_in - More fixes - General fixes
This commit is contained in:
parent
5fdf8e12dc
commit
3e106f9085
Notes:
svn2git
2021-03-31 03:12:20 +00:00
svn path=/head/; revision=169104
@ -6,7 +6,7 @@
|
||||
#
|
||||
|
||||
PORTNAME= BitTorrent
|
||||
PORTVERSION= 4.20.0
|
||||
PORTVERSION= 4.20.4
|
||||
PORTEPOCH= 1
|
||||
CATEGORIES?= net-p2p python
|
||||
MASTER_SITES= http://download.bittorrent.com/dl/
|
||||
|
@ -1,3 +1,3 @@
|
||||
MD5 (BitTorrent-4.20.0.tar.gz) = eb4568ec465421b03827bd5665395a62
|
||||
SHA256 (BitTorrent-4.20.0.tar.gz) = 70a78b693336cca4723f3a10eedc97eb88be7b20320f90b3bfee640ea4c14970
|
||||
SIZE (BitTorrent-4.20.0.tar.gz) = 2372371
|
||||
MD5 (BitTorrent-4.20.4.tar.gz) = 6616f6ae8a8460804ce43b3cf4b6f73b
|
||||
SHA256 (BitTorrent-4.20.4.tar.gz) = 54a231c6f95175fab6e493fef1e726f7f198d84396f0d6e5d6541db77b545d69
|
||||
SIZE (BitTorrent-4.20.4.tar.gz) = 2395512
|
||||
|
@ -0,0 +1,11 @@
|
||||
--- ./BitTorrent/AutoUpdateButler.py.orig Fri Jul 28 23:30:10 2006
|
||||
+++ ./BitTorrent/AutoUpdateButler.py Fri Jul 28 23:29:47 2006
|
||||
@@ -375,7 +375,7 @@
|
||||
self.multitorrent.remove_auto_updates_except(infohash)
|
||||
|
||||
try:
|
||||
- df = self.multitorrent.create_torrent(metainfo, installer_path, installer_path, hidden=True, is_auto_update=True)
|
||||
+ df = self.multitorrent.create_torrent(metainfo, installer_path, installer_path, installer_path, installer_path, hidden=True, is_auto_update=True)
|
||||
yield df
|
||||
df.getResult()
|
||||
except TorrentAlreadyRunning:
|
@ -1,5 +1,5 @@
|
||||
--- ./BitTorrent/HTTPHandler.py.orig Mon Jun 12 22:45:48 2006
|
||||
+++ ./BitTorrent/HTTPHandler.py Wed Jun 21 23:57:08 2006
|
||||
--- ./BitTorrent/HTTPHandler.py.orig Wed Jul 12 02:18:18 2006
|
||||
+++ ./BitTorrent/HTTPHandler.py Sat Jul 22 17:42:24 2006
|
||||
@@ -19,7 +19,7 @@
|
||||
|
||||
|
||||
|
@ -0,0 +1,35 @@
|
||||
--- ./BitTorrent/MultiTorrent.py.orig Mon Jul 24 00:58:59 2006
|
||||
+++ ./BitTorrent/MultiTorrent.py Sat Jul 29 00:02:03 2006
|
||||
@@ -270,6 +270,8 @@
|
||||
self.logger.log(severity, message, exc_info=exc_info)
|
||||
|
||||
def create_torrent(self, metainfo, save_incomplete_as, save_as,
|
||||
+ saveas_style_save_incomplete_as=None,
|
||||
+ saveas_style_save_as=None,
|
||||
hidden=False, is_auto_update=False):
|
||||
if self.is_single_torrent and len(self.torrents) > 0:
|
||||
print "create_torrent: len(self.torrents)=", len(self.torrents)
|
||||
@@ -295,9 +297,11 @@
|
||||
infohash,
|
||||
lambda s : self.global_error(logging.ERROR, s))
|
||||
|
||||
- t = Torrent(metainfo, save_incomplete_as, save_as, self.config,
|
||||
- self.data_dir, self.rawserver, self.choker,
|
||||
- self.singleport_listener, self.ratelimiter,
|
||||
+ t = Torrent(metainfo, save_incomplete_as, save_as,
|
||||
+ saveas_style_save_incomplete_as,
|
||||
+ saveas_style_save_as,
|
||||
+ self.config, self.data_dir, self.rawserver,
|
||||
+ self.choker, self.singleport_listener, self.ratelimiter,
|
||||
self.total_downmeasure, self.filepool, self.dht, self,
|
||||
self.log_root, hidden=hidden, is_auto_update=is_auto_update)
|
||||
retdf = Deferred()
|
||||
@@ -686,7 +690,7 @@
|
||||
'('+unicode(e.args[0])+')')
|
||||
return None
|
||||
|
||||
- t = Torrent(metainfo, "", "", self.config, self.data_dir,
|
||||
+ t = Torrent(metainfo, "", "", "", "", self.config, self.data_dir,
|
||||
self.rawserver, self.choker,
|
||||
self.singleport_listener, self.ratelimiter,
|
||||
self.total_downmeasure, self.filepool, self.dht, self,
|
@ -0,0 +1,35 @@
|
||||
--- ./BitTorrent/NewRateLimiter.py.orig Wed Jul 12 02:18:21 2006
|
||||
+++ ./BitTorrent/NewRateLimiter.py Sat Jul 22 17:42:24 2006
|
||||
@@ -144,24 +144,14 @@
|
||||
def restart_loop(self, t):
|
||||
# check for pending loop event
|
||||
if self.task and not self.task.called:
|
||||
- ## look at when it's scheduled to occur
|
||||
- # we can special case events which have a delta of 0, since they
|
||||
- # should occur asap. no need to check the time.
|
||||
- if self.task.delta == 0:
|
||||
- return
|
||||
- # use time.time since twisted does anyway
|
||||
- s = self.task.getTime() - time.time()
|
||||
- if s > t:
|
||||
- # if it would occur after the time we want, reset it
|
||||
- self.task.reset(t)
|
||||
- self.task.delta = t
|
||||
- else:
|
||||
- if t == 0:
|
||||
- # don't spin the event loop needlessly
|
||||
- self.run()
|
||||
- else:
|
||||
- self.task = self.add_task(t, self.run)
|
||||
- self.task.delta = t
|
||||
+ # look at when it's scheduled to occur
|
||||
+ s = self.task.getTime() - bttime()
|
||||
+ if s <= t:
|
||||
+ return
|
||||
+ # if it would occur after the time we want, cancel it
|
||||
+ self.task.cancel()
|
||||
+
|
||||
+ self.task = self.add_task(t, self.run)
|
||||
|
||||
def _write(self, to_write):
|
||||
amount = 0
|
@ -1,5 +1,5 @@
|
||||
--- ./BitTorrent/OldTorrentQueue.py.orig Mon Jun 12 22:45:49 2006
|
||||
+++ ./BitTorrent/OldTorrentQueue.py Wed Jun 21 23:57:08 2006
|
||||
--- ./BitTorrent/OldTorrentQueue.py.orig Wed Jul 12 02:18:22 2006
|
||||
+++ ./BitTorrent/OldTorrentQueue.py Sat Jul 22 17:42:24 2006
|
||||
@@ -20,7 +20,7 @@
|
||||
|
||||
|
||||
|
@ -1,16 +1,6 @@
|
||||
--- BitTorrent/Rerequester.py.orig Sat Jun 24 08:14:52 2006
|
||||
+++ BitTorrent/Rerequester.py Sat Jun 24 08:22:14 2006
|
||||
@@ -180,8 +180,8 @@
|
||||
def _check(self):
|
||||
assert thread.get_ident() == self.rawserver.ident
|
||||
assert not self.dead
|
||||
- self.errorfunc(logging.INFO, 'check: ' + str(self.current_started))
|
||||
if self.current_started is not None:
|
||||
+ self.errorfunc(logging.INFO, 'check: ' + str(self.current_started))
|
||||
if self.current_started <= bttime() - 58:
|
||||
self.errorfunc(logging.WARNING,
|
||||
_("Tracker announce still not complete "
|
||||
@@ -352,7 +352,8 @@
|
||||
--- ./BitTorrent/Rerequester.py.orig Wed Jul 12 02:18:25 2006
|
||||
+++ ./BitTorrent/Rerequester.py Sat Jul 22 17:42:24 2006
|
||||
@@ -369,7 +369,8 @@
|
||||
def _postrequest(self, data=None, errormsg=None, exc=None, peerid=None):
|
||||
assert thread.get_ident() == self.rawserver.ident
|
||||
self.current_started = None
|
||||
|
@ -1,6 +1,39 @@
|
||||
--- ./BitTorrent/Torrent.py.orig Mon Jun 12 22:45:53 2006
|
||||
+++ ./BitTorrent/Torrent.py Wed Jun 21 23:57:08 2006
|
||||
@@ -234,6 +234,9 @@
|
||||
--- ./BitTorrent/Torrent.py.orig Wed Jul 12 02:18:28 2006
|
||||
+++ ./BitTorrent/Torrent.py Sat Jul 29 00:08:59 2006
|
||||
@@ -58,7 +58,6 @@
|
||||
|
||||
from khashmir import const
|
||||
|
||||
-
|
||||
class Feedback(object):
|
||||
"""Inidivual torrents (Torrent) perform callbacks regarding
|
||||
changes of state to the rest of the program via a Feedback
|
||||
@@ -90,8 +89,9 @@
|
||||
POLICIES = ["stop", "start", "auto"]
|
||||
PRIORITIES = ["low", "normal", "high"]
|
||||
|
||||
- def __init__(self, metainfo, working_path, destination_path, config,
|
||||
- data_dir, rawserver, choker,
|
||||
+ def __init__(self, metainfo, working_path, destination_path,
|
||||
+ saveas_style_working_path, saveas_style_destination_path,
|
||||
+ config, data_dir, rawserver, choker,
|
||||
singleport_listener, ratelimiter, total_downmeasure,
|
||||
filepool, dht, feedback, log_root,
|
||||
hidden=False, is_auto_update=False):
|
||||
@@ -152,8 +152,11 @@
|
||||
|
||||
self.config = Preferences(config)#, persist_callback=self._dump_torrent_config)
|
||||
self.working_path = working_path #sets in config. See _set_working_path
|
||||
-
|
||||
self.destination_path = destination_path # sets in config.
|
||||
+
|
||||
+ self.saveas_style_working_path = saveas_style_working_path
|
||||
+ self.saveas_style_destination_path = saveas_style_destination_path
|
||||
+
|
||||
self.priority = "normal"
|
||||
self.policy = "auto"
|
||||
|
||||
@@ -258,6 +261,9 @@
|
||||
def is_running(self):
|
||||
return self.state == "running"
|
||||
|
||||
@ -9,3 +42,20 @@
|
||||
+
|
||||
def is_context_valid(self):
|
||||
return self.context_valid
|
||||
|
||||
@@ -819,8 +825,13 @@
|
||||
self.logger.debug("successfully paused torrent, moving file")
|
||||
|
||||
self.state = "finishing"
|
||||
- df = ThreadedDeferred(_wrap_task(self._rawserver.external_add_task),
|
||||
- move, self.working_path, self.destination_path)
|
||||
+ if self.saveas_style_working_path is not None and self.saveas_style_destination_path is not None:
|
||||
+ df = ThreadedDeferred(_wrap_task(self._rawserver.external_add_task),
|
||||
+ move, self.saveas_style_working_path,
|
||||
+ self.saveas_style_destination_path)
|
||||
+ else:
|
||||
+ df = ThreadedDeferred(_wrap_task(self._rawserver.external_add_task),
|
||||
+ move, self.working_path, self.destination_path)
|
||||
yield df
|
||||
df.getResult()
|
||||
|
||||
|
@ -0,0 +1,15 @@
|
||||
--- ./BitTorrent/XMultiTorrent.py.orig Fri Jul 28 23:25:45 2006
|
||||
+++ ./BitTorrent/XMultiTorrent.py Fri Jul 28 23:27:31 2006
|
||||
@@ -50,10 +50,10 @@
|
||||
|
||||
return Binary(infohash)
|
||||
|
||||
- def _create_torrent(self, torrent, dlpath):
|
||||
+ def _create_torrent(self, torrent, save_incomplete_as, save_as):
|
||||
d = bdecode(torrent)
|
||||
metainfo = ConvertedMetainfo(d)
|
||||
- self.multitorrent.create_torrent(metainfo, dlpath)
|
||||
+ self.multitorrent.create_torrent(metainfo, save_incomplete_as, save_as)
|
||||
return metainfo.infohash
|
||||
|
||||
def xmlrpc_start_torrent(self, infohash):
|
@ -0,0 +1,15 @@
|
||||
--- ./BitTorrent/XTorrentQueue.py.orig Fri Jul 28 23:27:55 2006
|
||||
+++ ./BitTorrent/XTorrentQueue.py Fri Jul 28 23:28:20 2006
|
||||
@@ -32,10 +32,10 @@
|
||||
|
||||
return Binary(infohash)
|
||||
|
||||
- def _create_torrent(self, torrent, dlpath):
|
||||
+ def _create_torrent(self, torrent, save_incomplete_as, save_as):
|
||||
d = bdecode(torrent)
|
||||
metainfo = ConvertedMetainfo(d)
|
||||
- self.tq.create_torrent(metainfo, dlpath)
|
||||
+ self.tq.create_torrent(metainfo, save_incomplete_as, save_as)
|
||||
return metainfo.infohash
|
||||
|
||||
def xmlrpc_start_torrent(self, infohash):
|
@ -1,5 +1,5 @@
|
||||
--- ./BitTorrent/defaultargs.py.orig Mon Jun 12 22:45:58 2006
|
||||
+++ ./BitTorrent/defaultargs.py Wed Jun 21 23:57:08 2006
|
||||
--- ./BitTorrent/defaultargs.py.orig Wed Jul 12 02:18:33 2006
|
||||
+++ ./BitTorrent/defaultargs.py Sat Jul 22 17:42:24 2006
|
||||
@@ -20,6 +20,8 @@
|
||||
if os.name == 'posix':
|
||||
if os.uname()[0] in ['Darwin']:
|
||||
@ -9,11 +9,11 @@
|
||||
|
||||
MAX_INCOMPLETE = 100
|
||||
MAX_FILES_OPEN = 50
|
||||
@@ -372,6 +374,10 @@
|
||||
@@ -376,6 +378,10 @@
|
||||
"name determined by --saveas_style. If this is left empty "
|
||||
"each torrent will be saved under the directory of the "
|
||||
"corresponding .torrent file")),
|
||||
+ ('save_incomplete_in', '',
|
||||
+ ('save_incomplete_in', u'',
|
||||
+ _("local directory where the incomplete torrent downloads will be "
|
||||
+ "stored until completion. Upon completion, downloads will be "
|
||||
+ "moved to the directory specified by --save_in.")),
|
||||
|
@ -1,247 +1,445 @@
|
||||
--- BitTorrent/launchmanycore.py.orig Mon Jun 12 22:45:59 2006
|
||||
+++ BitTorrent/launchmanycore.py Sat Jun 24 14:47:28 2006
|
||||
@@ -13,28 +13,33 @@
|
||||
# Original version written by John Hoffman, heavily modified for different
|
||||
# multitorrent architecture by Uoti Urpala (over 40% shorter than original)
|
||||
|
||||
-raise ImportError("launchmanycore has not been ported to the 5.0 backend. Please look for it in a future release. Thanks for your patience.")
|
||||
-
|
||||
import os
|
||||
from cStringIO import StringIO
|
||||
--- ./BitTorrent/launchmanycore.py.orig Wed Jul 12 02:18:34 2006
|
||||
+++ ./BitTorrent/launchmanycore.py Fri Jul 28 23:45:22 2006
|
||||
@@ -22,14 +22,17 @@
|
||||
from traceback import print_exc
|
||||
from BitTorrent.translation import _
|
||||
|
||||
+from BitTorrent import BTFailure
|
||||
import logging
|
||||
from BitTorrent import configfile
|
||||
-from BitTorrent.parsedir import parsedir
|
||||
-from BitTorrent.download import Multitorrent, Feedback
|
||||
+from BitTorrent import zurllib
|
||||
+from BitTorrent.AutoUpdateButler import AutoUpdateButler
|
||||
+from BitTorrent import platform
|
||||
from BitTorrent.parsedir import parsedir
|
||||
-from BitTorrent.MultiTorrent import MultiTorrent, Feedback
|
||||
+from BitTorrent.MultiTorrent import MultiTorrent, Feedback, TorrentAlreadyRunning, TorrentAlreadyInQueue, TorrentNotInitialized
|
||||
from BitTorrent.ConvertedMetainfo import ConvertedMetainfo
|
||||
-from BitTorrent import BTFailure
|
||||
+from BitTorrent.MultiTorrent import MultiTorrent, TorrentAlreadyRunning, TorrentAlreadyInQueue, TorrentNotInitialized
|
||||
+from BitTorrent.RawServer_twisted import RawServer
|
||||
+from BitTorrent.Torrent import Torrent
|
||||
+from BitTorrent.TorrentPolicy import Policy
|
||||
+from BitTorrent.defer import DeferredEvent
|
||||
+from BitTorrent.parsedir import parsedir
|
||||
from BitTorrent import BTFailure, UserFailure
|
||||
from BitTorrent.RawServer_twisted import RawServer
|
||||
from BitTorrent.yielddefer import launch_coroutine, _wrap_task
|
||||
from BitTorrent.ConvertedMetainfo import ConvertedMetainfo
|
||||
from BitTorrent.defer import DeferredEvent
|
||||
+from BitTorrent.platform import encode_for_filesystem
|
||||
+from BitTorrent.prefs import Preferences
|
||||
|
||||
-from threading import Event
|
||||
from time import time
|
||||
|
||||
-
|
||||
-class LaunchMany(Feedback):
|
||||
+class LaunchMany(Policy):
|
||||
|
||||
def __init__(self, config, output, configfile_key):
|
||||
+ zurllib.add_unsafe_thread()
|
||||
+
|
||||
@@ -51,13 +54,13 @@
|
||||
# logger Formatter, which is specific to exceptions, warnings, and
|
||||
# info messages.
|
||||
try:
|
||||
+ self.display = display.display
|
||||
self.logger = logging.getLogger(configfile_key)
|
||||
|
||||
self.multitorrent = None
|
||||
self.rawserver = None
|
||||
- self.config = config
|
||||
+ self.config = Preferences().initWithDict(config)
|
||||
self.configfile_key = configfile_key
|
||||
- self.display = display
|
||||
|
||||
self.torrent_dir = config['torrent_dir']
|
||||
|
||||
@@ -78,30 +81,31 @@
|
||||
|
||||
self.hashcheck_queue = []
|
||||
self.hashcheck_store = {}
|
||||
- self.hashcheck_current = None
|
||||
|
||||
self.core_doneflag = DeferredEvent()
|
||||
- rawserver_doneflag = DeferredEvent()
|
||||
+ self.rawserver_doneflag = DeferredEvent()
|
||||
self.rawserver = RawServer(self.config)
|
||||
try:
|
||||
- self.config = config
|
||||
+ self.config = Preferences().initWithDict(config)
|
||||
self.output = output
|
||||
self.configfile_key = configfile_key
|
||||
|
||||
@@ -45,15 +50,30 @@
|
||||
|
||||
self.torrent_list = []
|
||||
self.downloads = {}
|
||||
- self.doneflag = Event()
|
||||
+
|
||||
+ self.doneflag = DeferredEvent()
|
||||
+ self.rawserver_doneflag = DeferredEvent()
|
||||
|
||||
self.hashcheck_queue = []
|
||||
self.hashcheck_store = {}
|
||||
- self.hashcheck_current = None
|
||||
|
||||
- self.multitorrent = MultiTorrent(config, self.doneflag,
|
||||
- self.global_error)
|
||||
- self.rawserver = self.multitorrent.rawserver
|
||||
+ self.rawserver = RawServer(self.config)
|
||||
+ zurllib.set_zurllib_rawserver(self.rawserver)
|
||||
+ self.rawserver.associate_thread()
|
||||
+
|
||||
+ data_dir = self.config['data_dir']
|
||||
+ self.multitorrent = \
|
||||
+ MultiTorrent(self.config, self.doneflag, self.rawserver, data_dir)
|
||||
+
|
||||
+ # to handle the callbacks
|
||||
+ self.multitorrent.add_policy(self)
|
||||
+
|
||||
+# auto_update_butler = AutoUpdateButler(self.multitorrent, self.rawserver,
|
||||
+# test_new_version=self.config['new_version'],
|
||||
+# test_current_version=self.config['current_version'])
|
||||
+# self.multitorrent.add_auto_update_policy(auto_update_butler)
|
||||
+# self.rawserver.add_task(0, auto_update_butler.check_version)
|
||||
+
|
||||
|
||||
self.rawserver.add_task(0, self.scan)
|
||||
self.rawserver.add_task(0, self.stats)
|
||||
@@ -63,23 +83,40 @@
|
||||
def handler(signum, frame):
|
||||
self.rawserver.external_add_task(0, self.read_config)
|
||||
signal.signal(signal.SIGHUP, handler)
|
||||
- self.rawserver.install_sigint_handler()
|
||||
+ self.rawserver.install_sigint_handler(self.doneflag)
|
||||
except Exception, e:
|
||||
self.output.message(_("Could not set signal handler: ") + str(e))
|
||||
|
||||
- self.rawserver.listen_forever()
|
||||
+ def shutdown():
|
||||
+ self.output.message(_("shutting down"))
|
||||
+ for infohash in self.torrent_list:
|
||||
+ self.output.message(_('dropped "%s"') %
|
||||
+ self.torrent_cache[infohash]['path'])
|
||||
+ torrent = self.downloads[infohash]
|
||||
|
||||
# set up shut-down procedure before we begin doing things that
|
||||
# can throw exceptions.
|
||||
def shutdown():
|
||||
- print "SHUTDOWNSHUTDOWNSHUTDOWN"
|
||||
+ #print "SHUTDOWNSHUTDOWNSHUTDOWN"
|
||||
self.logger.critical(_("shutting down"))
|
||||
- for infohash in self.multitorrent.get_torrents():
|
||||
- self.logger.info(_('dropped "%s"') %
|
||||
- self.torrent_cache[infohash]['path'])
|
||||
- # torrent = self.downloads[infohash]
|
||||
- # if torrent is not None:
|
||||
- # torrent.shutdown()
|
||||
+ for torrent in self.multitorrent.get_torrents():
|
||||
+ try:
|
||||
+ removed = self.torrent_cache[torrent.infohash]['path']
|
||||
+ self.logger.info(_('dropped "%s"') % removed)
|
||||
+ except KeyError:
|
||||
+ pass
|
||||
+ if torrent is not None:
|
||||
+ torrent.shutdown()
|
||||
+ if self.multitorrent:
|
||||
+ df = self.multitorrent.shutdown()
|
||||
+ set_flag = lambda *a : self.rawserver_doneflag.set()
|
||||
+ df.addCallbacks(set_flag, set_flag)
|
||||
+
|
||||
+ self.rawserver.add_task(0, self.doneflag.addCallback, \
|
||||
+ lambda r: self.rawserver.external_add_task(0, shutdown))
|
||||
+
|
||||
+ try:
|
||||
+ self.rawserver.listen_forever(self.rawserver_doneflag)
|
||||
+ except AttributeError, e:
|
||||
+ output.message(str(e))
|
||||
+ raise
|
||||
+ except KeyboardInterrupt:
|
||||
+ raise
|
||||
|
||||
- self.output.message(_("shutting down"))
|
||||
- for infohash in self.torrent_list:
|
||||
- self.output.message(_('dropped "%s"') %
|
||||
- self.torrent_cache[infohash]['path'])
|
||||
- torrent = self.downloads[infohash]
|
||||
- if torrent is not None:
|
||||
- torrent.shutdown()
|
||||
if self.multitorrent:
|
||||
df = self.multitorrent.shutdown()
|
||||
- set_flag = lambda *a : rawserver_doneflag.set()
|
||||
+ set_flag = lambda *a : self.rawserver_doneflag.set()
|
||||
df.addCallbacks(set_flag, set_flag)
|
||||
else:
|
||||
- rawserver_doneflag.set()
|
||||
+ self.rawserver_doneflag.set()
|
||||
|
||||
# It is safe to addCallback here, because there is only one thread,
|
||||
# but even if the code were multi-threaded, core_doneflag has not
|
||||
@@ -112,9 +116,9 @@
|
||||
|
||||
self.rawserver.install_sigint_handler(self.core_doneflag)
|
||||
|
||||
- data_dir = config['data_dir']
|
||||
- print "Creating MultiTorrent"
|
||||
- self.multitorrent = MultiTorrent(config, self.rawserver, data_dir)
|
||||
+ data_dir = self.config['data_dir']
|
||||
+ #print "Creating MultiTorrent"
|
||||
+ self.multitorrent = MultiTorrent(self.config, self.rawserver, data_dir)
|
||||
|
||||
self.rawserver.add_task(0, self.scan)
|
||||
self.rawserver.add_task(0, self.stats)
|
||||
@@ -131,162 +135,221 @@
|
||||
self.rawserver.add_task(0,self.core_doneflag.set())
|
||||
|
||||
except UserFailure, e:
|
||||
- output.exception(unicode(e.args[0]))
|
||||
+ display.exception(unicode(e.args[0]))
|
||||
self.rawserver.add_task(0,self.core_doneflag.set())
|
||||
except:
|
||||
data = StringIO()
|
||||
print_exc(file = data)
|
||||
output.exception(data.getvalue())
|
||||
+ self.doneflag.set()
|
||||
+ self.rawserver_doneflag.set()
|
||||
- output.exception(data.getvalue())
|
||||
+ display.exception(data.getvalue())
|
||||
self.rawserver.add_task(0,self.core_doneflag.set())
|
||||
|
||||
# always make sure events get processed even if only for
|
||||
# shutting down.
|
||||
- print "listening forever"
|
||||
- self.rawserver.listen_forever(rawserver_doneflag)
|
||||
+ #print "listening forever"
|
||||
+ try:
|
||||
+ self.rawserver.listen_forever(self.rawserver_doneflag)
|
||||
+ except AttributeError, e:
|
||||
+ output.message(str(e))
|
||||
+ raise
|
||||
+ except KeyboardInterrupt:
|
||||
+ raise
|
||||
|
||||
except:
|
||||
data = StringIO()
|
||||
print_exc(file = data)
|
||||
- output.exception(data.getvalue())
|
||||
+ display.exception(data.getvalue())
|
||||
+ self.core_doneflag.set()
|
||||
+ self.rawserver_doneflag.set()
|
||||
|
||||
def scan(self):
|
||||
- print "LaunchMany.scan top."
|
||||
+ #print "LaunchMany.scan top."
|
||||
self.rawserver.add_task(self.config['parse_dir_interval'], self.scan)
|
||||
@@ -122,17 +159,16 @@
|
||||
upamt = 0
|
||||
dnamt = 0
|
||||
t = 0
|
||||
|
||||
r = parsedir(self.torrent_dir, self.torrent_cache,
|
||||
self.file_cache, self.blocked_files,
|
||||
self.logger.error)
|
||||
|
||||
- print "After parsedir"
|
||||
+ #print "After parsedir"
|
||||
( self.torrent_cache, self.file_cache, self.blocked_files,
|
||||
added, removed ) = r
|
||||
for infohash, data in removed.items():
|
||||
self.logger.info(_('dropped "%s"') % data['path'])
|
||||
self.remove(infohash)
|
||||
for infohash, data in added.items():
|
||||
- print "adding item:", data['path']
|
||||
+ #print "adding item:", data['path']
|
||||
self.logger.info(_('added "%s"' ) % data['path'])
|
||||
- print "after self.logger.info"
|
||||
+ #print "after self.logger.info"
|
||||
if self.config['launch_delay'] > 0:
|
||||
self.rawserver.add_task(self.config['launch_delay'], self.add, infohash, data)
|
||||
# torrent may have been known from resume state.
|
||||
elif not self.multitorrent.torrent_known(infohash):
|
||||
self.add(infohash, data)
|
||||
- print "LaunchMany.scan bottom"
|
||||
+ #print "LaunchMany.scan bottom"
|
||||
|
||||
def stats(self):
|
||||
self.rawserver.add_task(self.config['display_interval'], self.stats)
|
||||
data = []
|
||||
- for d in self.get_torrents():
|
||||
- infohash = d.infohash
|
||||
- cache = self.torrent_cache[infohash]
|
||||
- if self.config['display_path']:
|
||||
- name = cache['path']
|
||||
- else:
|
||||
- name = cache['name']
|
||||
- size = cache['length']
|
||||
- #d = self.downloads[infohash]
|
||||
- progress = '0.0%'
|
||||
- peers = 0
|
||||
- seeds = 0
|
||||
- seedsmsg = "S"
|
||||
- dist = 0.0
|
||||
- uprate = 0.0
|
||||
- dnrate = 0.0
|
||||
- upamt = 0
|
||||
- dnamt = 0
|
||||
- t = 0
|
||||
- msg = ''
|
||||
if d is None:
|
||||
status = _("waiting for hash check")
|
||||
else:
|
||||
stats = d.get_status()
|
||||
status = stats['activity']
|
||||
progress = '%.1f%%' % (int(stats['fractionDone']*1000)/10.0)
|
||||
- if d.started and not d.closed:
|
||||
+ if d.is_running() and d.is_context_valid():
|
||||
s = stats
|
||||
- dist = s['numCopies']
|
||||
- if d.is_seed:
|
||||
- #if d.state in ["created", "initializing"]:
|
||||
- # status = _("waiting for hash check")
|
||||
- #else:
|
||||
- stats = d.get_status()
|
||||
- status = stats['activity']
|
||||
- progress = '%.1f%%' % (int(stats['fractionDone']*1000)/10.0)
|
||||
- if d.is_running():
|
||||
- s = stats
|
||||
- dist = s['numCopies']
|
||||
- if d.is_seed:
|
||||
- seeds = 0 # s['numOldSeeds']
|
||||
- seedsmsg = "s"
|
||||
+ for d in self.multitorrent.get_torrents():
|
||||
+ if d is not None:
|
||||
+ infohash = d.infohash
|
||||
+ try:
|
||||
+ cache = self.torrent_cache[infohash]
|
||||
+ except KeyError:
|
||||
+ self.remove(infohash)
|
||||
+ continue
|
||||
+ if self.config['display_path']:
|
||||
+ name = cache['path']
|
||||
else:
|
||||
- if s['numSeeds'] + s['numPeers']:
|
||||
- t = stats['timeEst']
|
||||
- if t is None:
|
||||
- t = -1
|
||||
- if t == 0: # unlikely
|
||||
- t = 0.01
|
||||
- status = _("downloading")
|
||||
+ name = cache['name']
|
||||
+ size = cache['length']
|
||||
+ progress = '0.0%'
|
||||
+ peers = 0
|
||||
+ seeds = 0
|
||||
+ seedsmsg = "S"
|
||||
+ dist = 0.0
|
||||
+ uprate = 0.0
|
||||
+ dnrate = 0.0
|
||||
+ upamt = 0
|
||||
+ dnamt = 0
|
||||
+ t = 0
|
||||
+ msg = ''
|
||||
+ #if d.state in ["created", "initializing"]:
|
||||
+ # status = _("waiting for hash check")
|
||||
+ #else:
|
||||
+ stats = d.get_status()
|
||||
+ status = stats['activity']
|
||||
+ progress = '%.1f%%' % (int(stats['fractionDone']*1000)/10.0)
|
||||
+ if d.is_running():
|
||||
+ s = stats
|
||||
+ dist = int(s['distributed_copies'])
|
||||
+ if d.is_seeding():
|
||||
seeds = 0 # s['numOldSeeds']
|
||||
seedsmsg = "s"
|
||||
+ seeds = 0 # s['numOldSeeds']
|
||||
+ seedsmsg = "s"
|
||||
else:
|
||||
@@ -152,11 +188,9 @@
|
||||
uprate = stats['upRate']
|
||||
upamt = s['upTotal']
|
||||
dnamt = s['downTotal']
|
||||
- if d.errors and (d.closed or d.errors[-1][0] + 300 > time()):
|
||||
- msg = d.errors[-1][2]
|
||||
- t = -1
|
||||
- status = _("connecting to peers")
|
||||
- seeds = s['numSeeds']
|
||||
- dnrate = stats['downRate']
|
||||
- peers = s['numPeers']
|
||||
- uprate = stats['upRate']
|
||||
- upamt = s['upTotal']
|
||||
- dnamt = s['downTotal']
|
||||
+ if s['numSeeds'] + s['numPeers']:
|
||||
+ t = stats['timeEst']
|
||||
+ if t is None:
|
||||
+ t = -1
|
||||
+ if t == 0: # unlikely
|
||||
+ t = 0.01
|
||||
+ status = _("downloading")
|
||||
+ else:
|
||||
+ t = -1
|
||||
+ status = _("connecting to peers")
|
||||
+ seeds = s['numSeeds']
|
||||
+ dnrate = stats['downRate']
|
||||
+ peers = s['numPeers']
|
||||
+ uprate = stats['upRate']
|
||||
+ upamt = s['upTotal']
|
||||
+ dnamt = s['downTotal']
|
||||
|
||||
data.append(( name, status, progress, peers, seeds, seedsmsg, dist,
|
||||
- uprate, dnrate, upamt, dnamt, size, t, msg ))
|
||||
+ uprate, dnrate, upamt, dnamt, size, t ))
|
||||
stop = self.output.display(data)
|
||||
- data.append(( name, status, progress, peers, seeds, seedsmsg, dist,
|
||||
+ data.append(( name, status, progress, peers, seeds, seedsmsg, dist,
|
||||
uprate, dnrate, upamt, dnamt, size, t, msg ))
|
||||
stop = self.display(data)
|
||||
if stop:
|
||||
self.doneflag.set()
|
||||
@@ -176,22 +210,55 @@
|
||||
self.core_doneflag.set()
|
||||
|
||||
def remove(self, infohash):
|
||||
- self.torrent_list.remove(infohash)
|
||||
- if self.downloads[infohash] is not None:
|
||||
- self.downloads[infohash].shutdown()
|
||||
+ torrent = self.multitorrent.get_torrent(infohash)
|
||||
+ if torrent is not None:
|
||||
+ torrent.shutdown()
|
||||
self.was_stopped(infohash)
|
||||
- del self.downloads[infohash]
|
||||
|
||||
def add(self, infohash, data):
|
||||
-
|
||||
# data is a dict like
|
||||
# { path:'/a/b/c.torrent', file:'c.torrent', length:90911, name:'Sea',
|
||||
# metainfo: <metainfo>} Metainfo has bdecoded but not passed
|
||||
# to ConvertedMetainfo.
|
||||
- self.torrent_list.append(infohash)
|
||||
- self.downloads[infohash] = None
|
||||
self.hashcheck_queue.append(infohash)
|
||||
self.hashcheck_store[infohash] = ConvertedMetainfo(data['metainfo'])
|
||||
self.check_hashcheck_queue()
|
||||
|
||||
def check_hashcheck_queue(self):
|
||||
- if self.hashcheck_current is not None or not self.hashcheck_queue:
|
||||
+ if not self.hashcheck_queue:
|
||||
+ return
|
||||
return
|
||||
- infohash = self.hashcheck_current = self.hashcheck_queue.pop(0)
|
||||
+ infohash = self.hashcheck_queue.pop(0)
|
||||
+ x = self.hashcheck_store[infohash]
|
||||
+ metainfo = ConvertedMetainfo(x)
|
||||
+ del self.hashcheck_store[infohash]
|
||||
metainfo = self.hashcheck_store[infohash]
|
||||
del self.hashcheck_store[infohash]
|
||||
- filename = self.determine_filename(infohash)
|
||||
+ save_incomplete_as, save_as = self.determine_filename(infohash)
|
||||
+ saveas_style_save_incomplete_as, saveas_style_save_as = self._determine_filename(infohash)
|
||||
torrent_path = self.torrent_cache[infohash]['path']
|
||||
- self.start_torrent(torrent_path, metainfo, filename, filename)
|
||||
+ self.start_torrent(torrent_path, metainfo, save_incomplete_as,save_as,
|
||||
+ saveas_style_save_incomplete_as, saveas_style_save_as)
|
||||
|
||||
- def start_torrent(self,torrent_path,metainfo,save_incomplete_as,save_as):
|
||||
+ def start_torrent(self,torrent_path,metainfo,save_incomplete_as,save_as,
|
||||
+ saveas_style_save_incomplete_as=None,saveas_style_save_as=None):
|
||||
assert isinstance(metainfo, ConvertedMetainfo)
|
||||
df = launch_coroutine(_wrap_task(self.rawserver.add_task),
|
||||
self._start_torrent, metainfo,
|
||||
- save_incomplete_as, save_as)
|
||||
+ save_incomplete_as, save_as,
|
||||
+ saveas_style_save_incomplete_as=saveas_style_save_incomplete_as,
|
||||
+ saveas_style_save_as=saveas_style_save_as)
|
||||
df.addErrback(lambda e : self.logger.error(_("DIED: "),exc_info=e))
|
||||
return df
|
||||
|
||||
- def _start_torrent(self, metainfo, save_incomplete_as,save_as):
|
||||
+ def _start_torrent(self, metainfo, save_incomplete_as,save_as,
|
||||
+ saveas_style_save_incomplete_as,saveas_style_save_as):
|
||||
assert isinstance(metainfo, ConvertedMetainfo)
|
||||
- df = self.multitorrent.create_torrent(metainfo,
|
||||
- save_incomplete_as, save_as)
|
||||
- yield df
|
||||
- torrent = self.multitorrent.get_torrent(metainfo.infohash)
|
||||
- if torrent.is_initialized():
|
||||
- multitorrent.start_torrent(metainfo.infohash)
|
||||
- #else: ???? # this would be an error condition already reported
|
||||
- # to logger.
|
||||
- check_hashcheck_queue()
|
||||
+ save_incomplete_as, junk = platform.encode_for_filesystem(save_incomplete_as)
|
||||
+ save_as, junk = platform.encode_for_filesystem(save_as)
|
||||
+ if saveas_style_save_incomplete_as is not None:
|
||||
+ saveas_style_save_incomplete_as, junk = platform.encode_for_filesystem(saveas_style_save_incomplete_as)
|
||||
+ if saveas_style_save_as is not None:
|
||||
+ saveas_style_save_as, junk = platform.encode_for_filesystem(saveas_style_save_as)
|
||||
+ try:
|
||||
+ df = self.multitorrent.create_torrent(metainfo,
|
||||
+ save_incomplete_as, save_as,
|
||||
+ saveas_style_save_incomplete_as,
|
||||
+ saveas_style_save_as)
|
||||
+ yield df
|
||||
+ df.getResult()
|
||||
+ except (TorrentAlreadyRunning, TorrentAlreadyInQueue):
|
||||
+ pass
|
||||
+ except:
|
||||
+ raise
|
||||
|
||||
- def determine_filename(self, infohash):
|
||||
+ infohash = metainfo.infohash
|
||||
+
|
||||
+ if not self.torrent_cache[infohash] or self.torrent_cache[infohash] is None:
|
||||
+ # find out if torrent has been recorded
|
||||
+ try:
|
||||
+ torrent = self.multitorrent.get_torrent(infohash)
|
||||
+ if not torrent or torrent is None:
|
||||
+ raise UnknownInfohash(infohash.encode("hex"))
|
||||
+ except:
|
||||
+ raise
|
||||
+
|
||||
+ if not self.multitorrent.torrent_known(infohash):
|
||||
+ try:
|
||||
+ (save_as, save_incomplete_as) = self.determine_filename(infohash)
|
||||
+ df = self.multitorrent.create_torrent(metainfo, save_incomplete_as, save_as)
|
||||
+ except (TorrentAlreadyRunning, TorrentAlreadyInQueue):
|
||||
+ pass
|
||||
+ except:
|
||||
+ raise
|
||||
+
|
||||
+ try:
|
||||
+ if not self.multitorrent.torrent_running(infohash):
|
||||
+ df = self.multitorrent.start_torrent(infohash)
|
||||
+ except TorrentAlreadyRunning:
|
||||
+ pass
|
||||
+ except TorrentNotInitialized:
|
||||
+ # requeue
|
||||
+ self.remove(infohash)
|
||||
+ # function to requeue torrent if has not been initialized just yet
|
||||
+ def hashcheck_requeue(infohash):
|
||||
+ df = self.remove(infohash)
|
||||
+ data = self.torrent_cache[infohash]
|
||||
+ if self.config['launch_delay'] > 0:
|
||||
+ self.rawserver.add_task(self.config['launch_delay'], self.add, infohash, data)
|
||||
+ else:
|
||||
+ # wait at least 1
|
||||
+ self.rawserver.add_task(1, self.add, infohash, data)
|
||||
return
|
||||
- self.hashcheck_current = self.hashcheck_queue.pop(0)
|
||||
- metainfo = self.hashcheck_store[self.hashcheck_current]
|
||||
- del self.hashcheck_store[self.hashcheck_current]
|
||||
- filename = self.determine_filename(self.hashcheck_current)
|
||||
- self.downloads[self.hashcheck_current] = self.multitorrent. \
|
||||
- start_torrent(ConvertedMetainfo(metainfo),
|
||||
- self.config, self, filename)
|
||||
+ except:
|
||||
+ raise
|
||||
+
|
||||
+ # record if everything has gone right
|
||||
+ self.downloads[infohash] = \
|
||||
+ self.multitorrent.get_torrent(infohash)
|
||||
|
||||
def determine_filename(self, infohash):
|
||||
+ # Is it running?
|
||||
+ running = self.multitorrent.torrent_running(infohash)
|
||||
+ if not running:
|
||||
+ try:
|
||||
+ if torrent.is_initialized():
|
||||
+ df = self.multitorrent.start_torrent(infohash)
|
||||
+ yield df
|
||||
+ df.getResult()
|
||||
+ else:
|
||||
+ raise TorrentNotInitialized
|
||||
+ except TorrentAlreadyRunning:
|
||||
+ pass
|
||||
+ except TorrentNotInitialized:
|
||||
+ hashcheck_requeue(infohash)
|
||||
+ except:
|
||||
+ raise
|
||||
+
|
||||
+ self.check_hashcheck_queue()
|
||||
+
|
||||
+ def determine_saveas_style(self, infohash):
|
||||
x = self.torrent_cache[infohash]
|
||||
name = x['name']
|
||||
savein = self.config['save_in']
|
||||
+ saveincompletein = self.config['save_incomplete_in']
|
||||
isdir = not x['metainfo']['info'].has_key('length')
|
||||
- savein = self.config['save_in']
|
||||
- isdir = not x['metainfo']['info'].has_key('length')
|
||||
style = self.config['saveas_style']
|
||||
+
|
||||
if style == 4:
|
||||
torrentname = os.path.split(x['path'][:-8])[1]
|
||||
suggestedname = name
|
||||
@@ -202,17 +269,27 @@
|
||||
@@ -295,20 +358,54 @@
|
||||
style = 1
|
||||
else:
|
||||
style = 3
|
||||
+ return style
|
||||
+
|
||||
+ # Specially handle the style 3 case.
|
||||
+ # Style 3 breaks Torrent.move so we have an intermediate
|
||||
+ # _determine_filename for Torrent.move benefit
|
||||
+ # but determine_filename for general use
|
||||
+ def determine_filename(self, infohash):
|
||||
+ x = self.torrent_cache[infohash]
|
||||
+ name = x['name']
|
||||
+ isdir = not x['metainfo']['info'].has_key('length')
|
||||
+ style = self.determine_saveas_style(infohash)
|
||||
+ saveincompleteas, saveas = self._determine_filename(infohash)
|
||||
+
|
||||
+ # add filename
|
||||
+ if style == 3 and not isdir:
|
||||
+ saveas = os.path.join(saveas, name)
|
||||
+ saveincompleteas = os.path.join(saveincompleteas, name)
|
||||
+
|
||||
+ return saveincompleteas, saveas
|
||||
+
|
||||
+ # generate paths appropriate for Torrent.move method
|
||||
+ def _determine_filename(self, infohash):
|
||||
+ x = self.torrent_cache[infohash]
|
||||
+ name = x['name']
|
||||
+ savein = self.config['save_in']
|
||||
+ saveincompletein = self.config['save_incomplete_in']
|
||||
+ style = self.determine_saveas_style(infohash)
|
||||
|
||||
if style == 1 or style == 3:
|
||||
if savein:
|
||||
- saveas = os.path.join(savein,x['file'][:-8]) # strip '.torrent'
|
||||
+ saveas = os.path.join(savein, x['file'][:-8]) # strip '.torrent'
|
||||
saveas = os.path.join(savein,x['file'][:-8]) # strip '.torrent'
|
||||
else:
|
||||
saveas = x['path'][:-8] # strip '.torrent'
|
||||
- if style == 3 and not isdir:
|
||||
- saveas = os.path.join(saveas, name)
|
||||
+ if saveincompletein:
|
||||
+ saveincompleteas = os.path.join(saveincompletein, x['file'][:-8]) # strip '.torrent'
|
||||
+ else:
|
||||
+ saveincompleteas = x['path'][:-8] # strip '.torrent'
|
||||
if style == 3 and not isdir:
|
||||
saveas = os.path.join(saveas, name)
|
||||
+ saveincompleteas = os.path.join(saveincompleteas, name)
|
||||
else:
|
||||
if savein:
|
||||
saveas = os.path.join(savein, name)
|
||||
@ -253,11 +451,11 @@
|
||||
+ else:
|
||||
+ saveincompleteas = os.path.join(os.path.split(x['path'])[0], name)
|
||||
+
|
||||
+ return saveas, saveincompleteas
|
||||
+ return saveincompleteas, saveas
|
||||
|
||||
def was_stopped(self, infohash):
|
||||
try:
|
||||
@@ -221,8 +298,6 @@
|
||||
@@ -317,8 +414,6 @@
|
||||
pass
|
||||
else:
|
||||
del self.hashcheck_store[infohash]
|
||||
@ -265,12 +463,13 @@
|
||||
- self.hashcheck_current = None
|
||||
self.check_hashcheck_queue()
|
||||
|
||||
def global_error(self, level, text):
|
||||
@@ -253,7 +328,6 @@
|
||||
# rest are callbacks from torrent instances
|
||||
|
||||
def started(self, torrent):
|
||||
- self.hashcheck_current = None
|
||||
self.check_hashcheck_queue()
|
||||
|
||||
def failed(self, torrent):
|
||||
# Exceptions are now reported via loggers.<
|
||||
@@ -343,7 +438,7 @@
|
||||
# the self.failed() callback can run during this loop.
|
||||
for option, value in newvalues.iteritems():
|
||||
self.multitorrent.set_option(option, value)
|
||||
- for torrent in self.downloads.values():
|
||||
+ for torrent in self.multitorrent.get_torrents():
|
||||
if torrent is not None:
|
||||
for option, value in newvalues.iteritems():
|
||||
torrent.set_option(option, value)
|
||||
|
@ -1,11 +1,11 @@
|
||||
--- ./BitTorrent/platform.py.orig Mon Jun 12 22:46:01 2006
|
||||
+++ ./BitTorrent/platform.py Wed Jun 21 23:57:08 2006
|
||||
@@ -131,7 +131,7 @@
|
||||
--- ./BitTorrent/platform.py.orig Wed Jul 12 02:18:37 2006
|
||||
+++ ./BitTorrent/platform.py Sat Jul 22 17:42:24 2006
|
||||
@@ -334,7 +334,7 @@
|
||||
|
||||
|
||||
def calc_unix_dirs():
|
||||
- appdir = '%s-%s'%(app_name, version)
|
||||
+ appdir = '%s'%(app_name)
|
||||
ip = os.path.join('share', 'pixmaps', appdir)
|
||||
dp = os.path.join('share', 'doc' , appdir)
|
||||
lp = os.path.join('share', 'locale')
|
||||
ip = os.path.join(efs(u'share')[0], efs(u'pixmaps')[0], appdir)
|
||||
dp = os.path.join(efs(u'share')[0], efs(u'doc')[0], appdir)
|
||||
lp = os.path.join(efs(u'share')[0], efs(u'locale')[0])
|
||||
|
@ -1,16 +1,32 @@
|
||||
--- ./launchmany-console.py.orig Mon Jun 12 22:46:19 2006
|
||||
+++ ./launchmany-console.py Wed Jun 21 23:57:08 2006
|
||||
@@ -34,10 +34,10 @@
|
||||
self.message(_("no torrents"))
|
||||
for x in data:
|
||||
( name, status, progress, peers, seeds, seedsmsg, dist,
|
||||
- uprate, dnrate, upamt, dnamt, size, t, msg ) = x
|
||||
- print '"%s": "%s" (%s) - %sP%s%s%.3fD u%0.1fK/s-d%0.1fK/s u%dK-d%dK "%s"' % (
|
||||
+ uprate, dnrate, upamt, dnamt, size, t ) = x
|
||||
+ print '"%s": "%s" (%s) - %sP%s%s%.3fD u%0.1fK/s-d%0.1fK/s u%dK-d%dK' % (
|
||||
name, status, progress, peers, seeds, seedsmsg, dist,
|
||||
- uprate/1000, dnrate/1000, upamt/1024, dnamt/1024, msg)
|
||||
+ uprate/1000, dnrate/1000, upamt/1024, dnamt/1024)
|
||||
--- ./launchmany-console.py.orig Wed Jul 12 02:18:54 2006
|
||||
+++ ./launchmany-console.py Fri Jul 28 23:56:07 2006
|
||||
@@ -49,6 +49,10 @@
|
||||
uprate/1000, dnrate/1000, upamt/1024, dnamt/1024, msg))
|
||||
return False
|
||||
|
||||
def message(self, s):
|
||||
+ def exception(self, s):
|
||||
+ exceptions.append(s)
|
||||
+ #logging.getLogger('').info(_("SYSTEM ERROR - EXCEPTION GENERATED"))
|
||||
+
|
||||
|
||||
if __name__ == '__main__':
|
||||
uiname = 'launchmany-console'
|
||||
@@ -76,7 +80,7 @@
|
||||
platform.decode_from_filesystem(torrent_dir)
|
||||
else:
|
||||
torrent_dir = config['torrent_dir']
|
||||
- torrent_dir,bad = platform.encode_from_filesystem(torrent_dir)
|
||||
+ torrent_dir,bad = platform.encode_for_filesystem(torrent_dir)
|
||||
if bad:
|
||||
raise BTFailure(_("Warning: ")+config['torrent_dir']+
|
||||
_(" is not a directory"))
|
||||
@@ -139,4 +143,8 @@
|
||||
#logging.getLogger().setLevel(INFO)
|
||||
logging.getLogger('').setLevel(0)
|
||||
|
||||
- LaunchMany(config, d.display, 'launchmany-console')
|
||||
+ LaunchMany(config, d, 'launchmany-console')
|
||||
+
|
||||
+ if exceptions:
|
||||
+ print _("\nEXCEPTION:")
|
||||
+ print exceptions[0]
|
||||
|
@ -1,5 +1,5 @@
|
||||
--- ./launchmany-curses.py.orig Mon Jun 12 22:46:19 2006
|
||||
+++ ./launchmany-curses.py Wed Jun 21 23:57:08 2006
|
||||
--- ./launchmany-curses.py.orig Wed Jul 12 02:18:54 2006
|
||||
+++ ./launchmany-curses.py Fri Jul 28 23:42:45 2006
|
||||
@@ -18,6 +18,7 @@
|
||||
|
||||
DOWNLOAD_SCROLL_RATE = 1
|
||||
@ -8,7 +8,7 @@
|
||||
import sys, os
|
||||
from threading import Event
|
||||
from time import time, localtime, strftime
|
||||
@@ -99,7 +100,7 @@
|
||||
@@ -101,7 +102,7 @@
|
||||
def winch_handler(self, signum, stackframe):
|
||||
self.changeflag.set()
|
||||
curses.endwin()
|
||||
@ -17,7 +17,7 @@
|
||||
self.scrwin = curses.newwin(0, 0, 0, 0)
|
||||
self._remake_window()
|
||||
self._display_messages()
|
||||
@@ -118,22 +119,26 @@
|
||||
@@ -120,22 +121,26 @@
|
||||
self.mainpan = curses.panel.new_panel(self.mainwin)
|
||||
self.mainwin.scrollok(0)
|
||||
self.mainwin.nodelay(1)
|
||||
@ -44,30 +44,22 @@
|
||||
|
||||
try:
|
||||
self.scrwin.border(ord('|'),ord('|'),ord('-'),ord('-'),ord(' '),ord(' '),ord(' '),ord(' '))
|
||||
@@ -199,7 +204,7 @@
|
||||
if self._display_line(''):
|
||||
break
|
||||
( name, status, progress, peers, seeds, seedsmsg, dist,
|
||||
- uprate, dnrate, upamt, dnamt, size, t, msg ) = data[ii]
|
||||
+ uprate, dnrate, upamt, dnamt, size, t ) = data[ii]
|
||||
t = fmttime(t)
|
||||
if t:
|
||||
status = t
|
||||
@@ -216,7 +221,7 @@
|
||||
else:
|
||||
datastr = ' '+status+' ('+progress+')'
|
||||
self._display_line(datastr)
|
||||
- self._display_line(' '+ljust(msg,self.mainwinw-4))
|
||||
+# self._display_line(' '+ljust(msg,self.mainwinw-4))
|
||||
i += 1
|
||||
@@ -277,7 +282,8 @@
|
||||
|
||||
def display(self, data):
|
||||
@@ -236,7 +241,7 @@
|
||||
totalup = 0
|
||||
totaldn = 0
|
||||
for ( name, status, progress, peers, seeds, seedsmsg, dist,
|
||||
- uprate, dnrate, upamt, dnamt, size, t, msg ) in data:
|
||||
+ uprate, dnrate, upamt, dnamt, size, t ) in data:
|
||||
totalup += uprate
|
||||
totaldn += dnrate
|
||||
|
||||
def LaunchManyWrapper(scrwin, config):
|
||||
- LaunchMany(config, CursesDisplayer(scrwin), 'launchmany-curses')
|
||||
+ d = CursesDisplayer(scrwin)
|
||||
+ LaunchMany(config, d, 'launchmany-curses')
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
@@ -306,7 +312,7 @@
|
||||
platform.decode_from_filesystem(torrent_dir)
|
||||
else:
|
||||
torrent_dir = config['torrent_dir']
|
||||
- torrent_dir,bad = platform.encode_from_filesystem(torrent_dir)
|
||||
+ torrent_dir,bad = platform.encode_for_filesystem(torrent_dir)
|
||||
if bad:
|
||||
raise BTFailure(_("Warning: ")+config['torrent_dir']+
|
||||
_(" is not a directory"))
|
||||
|
@ -90,6 +90,9 @@ bin/torrentinfo-console
|
||||
%%PYTHON_SITELIBDIR%%/BitTorrent/IPC.py
|
||||
%%PYTHON_SITELIBDIR%%/BitTorrent/IPC.pyc
|
||||
%%PYTHON_SITELIBDIR%%/BitTorrent/IPC.pyo
|
||||
%%PYTHON_SITELIBDIR%%/BitTorrent/InternetWatcher.py
|
||||
%%PYTHON_SITELIBDIR%%/BitTorrent/InternetWatcher.pyc
|
||||
%%PYTHON_SITELIBDIR%%/BitTorrent/InternetWatcher.pyo
|
||||
%%PYTHON_SITELIBDIR%%/BitTorrent/LaunchPath.py
|
||||
%%PYTHON_SITELIBDIR%%/BitTorrent/LaunchPath.pyc
|
||||
%%PYTHON_SITELIBDIR%%/BitTorrent/LaunchPath.pyo
|
||||
@ -105,6 +108,9 @@ bin/torrentinfo-console
|
||||
%%PYTHON_SITELIBDIR%%/BitTorrent/MultiTorrent.py
|
||||
%%PYTHON_SITELIBDIR%%/BitTorrent/MultiTorrent.pyc
|
||||
%%PYTHON_SITELIBDIR%%/BitTorrent/MultiTorrent.pyo
|
||||
%%PYTHON_SITELIBDIR%%/BitTorrent/NamedMutex.py
|
||||
%%PYTHON_SITELIBDIR%%/BitTorrent/NamedMutex.pyc
|
||||
%%PYTHON_SITELIBDIR%%/BitTorrent/NamedMutex.pyo
|
||||
%%PYTHON_SITELIBDIR%%/BitTorrent/NatCheck.py
|
||||
%%PYTHON_SITELIBDIR%%/BitTorrent/NatCheck.pyc
|
||||
%%PYTHON_SITELIBDIR%%/BitTorrent/NatCheck.pyo
|
||||
@ -216,9 +222,6 @@ bin/torrentinfo-console
|
||||
%%PYTHON_SITELIBDIR%%/BitTorrent/defer.py
|
||||
%%PYTHON_SITELIBDIR%%/BitTorrent/defer.pyc
|
||||
%%PYTHON_SITELIBDIR%%/BitTorrent/defer.pyo
|
||||
%%PYTHON_SITELIBDIR%%/BitTorrent/flock_mutex.py
|
||||
%%PYTHON_SITELIBDIR%%/BitTorrent/flock_mutex.pyc
|
||||
%%PYTHON_SITELIBDIR%%/BitTorrent/flock_mutex.pyo
|
||||
%%PYTHON_SITELIBDIR%%/BitTorrent/hash.py
|
||||
%%PYTHON_SITELIBDIR%%/BitTorrent/hash.pyc
|
||||
%%PYTHON_SITELIBDIR%%/BitTorrent/hash.pyo
|
||||
@ -252,6 +255,9 @@ bin/torrentinfo-console
|
||||
%%PYTHON_SITELIBDIR%%/BitTorrent/pykill.py
|
||||
%%PYTHON_SITELIBDIR%%/BitTorrent/pykill.pyc
|
||||
%%PYTHON_SITELIBDIR%%/BitTorrent/pykill.pyo
|
||||
%%PYTHON_SITELIBDIR%%/BitTorrent/shortargs.py
|
||||
%%PYTHON_SITELIBDIR%%/BitTorrent/shortargs.pyc
|
||||
%%PYTHON_SITELIBDIR%%/BitTorrent/shortargs.pyo
|
||||
%%PYTHON_SITELIBDIR%%/BitTorrent/sparse_set.py
|
||||
%%PYTHON_SITELIBDIR%%/BitTorrent/sparse_set.pyc
|
||||
%%PYTHON_SITELIBDIR%%/BitTorrent/sparse_set.pyo
|
||||
@ -342,34 +348,16 @@ bin/torrentinfo-console
|
||||
%%PYTHON_SITELIBDIR%%/khashmir/utkhashmir.py
|
||||
%%PYTHON_SITELIBDIR%%/khashmir/utkhashmir.pyc
|
||||
%%PYTHON_SITELIBDIR%%/khashmir/utkhashmir.pyo
|
||||
share/locale/af/LC_MESSAGES/bittorrent.mo
|
||||
share/locale/bg/LC_MESSAGES/bittorrent.mo
|
||||
share/locale/ca/LC_MESSAGES/bittorrent.mo
|
||||
share/locale/cs/LC_MESSAGES/bittorrent.mo
|
||||
share/locale/da/LC_MESSAGES/bittorrent.mo
|
||||
share/locale/de/LC_MESSAGES/bittorrent.mo
|
||||
share/locale/el/LC_MESSAGES/bittorrent.mo
|
||||
share/locale/en/LC_MESSAGES/bittorrent.mo
|
||||
share/locale/es/LC_MESSAGES/bittorrent.mo
|
||||
share/locale/es_MX/LC_MESSAGES/bittorrent.mo
|
||||
share/locale/fr/LC_MESSAGES/bittorrent.mo
|
||||
share/locale/he/LC_MESSAGES/bittorrent.mo
|
||||
share/locale/hu/LC_MESSAGES/bittorrent.mo
|
||||
share/locale/is/LC_MESSAGES/bittorrent.mo
|
||||
share/locale/it/LC_MESSAGES/bittorrent.mo
|
||||
share/locale/ja/LC_MESSAGES/bittorrent.mo
|
||||
share/locale/ko/LC_MESSAGES/bittorrent.mo
|
||||
share/locale/nb_NO/LC_MESSAGES/bittorrent.mo
|
||||
share/locale/nl/LC_MESSAGES/bittorrent.mo
|
||||
share/locale/pl/LC_MESSAGES/bittorrent.mo
|
||||
share/locale/pt/LC_MESSAGES/bittorrent.mo
|
||||
share/locale/pt_BR/LC_MESSAGES/bittorrent.mo
|
||||
share/locale/ro/LC_MESSAGES/bittorrent.mo
|
||||
share/locale/ru/LC_MESSAGES/bittorrent.mo
|
||||
share/locale/sk/LC_MESSAGES/bittorrent.mo
|
||||
share/locale/sl/LC_MESSAGES/bittorrent.mo
|
||||
share/locale/sv/LC_MESSAGES/bittorrent.mo
|
||||
share/locale/tr/LC_MESSAGES/bittorrent.mo
|
||||
share/locale/vi/LC_MESSAGES/bittorrent.mo
|
||||
share/locale/zh_CN/LC_MESSAGES/bittorrent.mo
|
||||
share/locale/zh_TW/LC_MESSAGES/bittorrent.mo
|
||||
%%GUI%%@dirrm share/pixmaps/BitTorrent/themes/default/torrentstate
|
||||
@ -386,26 +374,10 @@ share/locale/zh_TW/LC_MESSAGES/bittorrent.mo
|
||||
@dirrmtry share/locale/zh_TW
|
||||
@dirrmtry share/locale/zh_CN/LC_MESSAGES
|
||||
@dirrmtry share/locale/zh_CN
|
||||
@dirrmtry share/locale/sl/LC_MESSAGES
|
||||
@dirrmtry share/locale/sl
|
||||
@dirrmtry share/locale/sk/LC_MESSAGES
|
||||
@dirrmtry share/locale/sk
|
||||
@dirrmtry share/locale/ro/LC_MESSAGES
|
||||
@dirrmtry share/locale/ro
|
||||
@dirrmtry share/locale/pt/LC_MESSAGES
|
||||
@dirrmtry share/locale/pt
|
||||
@dirrmtry share/locale/pl/LC_MESSAGES
|
||||
@dirrmtry share/locale/pl
|
||||
@dirrmtry share/locale/nb_NO/LC_MESSAGES
|
||||
@dirrmtry share/locale/nb_NO
|
||||
@dirrmtry share/locale/ko/LC_MESSAGES
|
||||
@dirrmtry share/locale/ko
|
||||
@dirrmtry share/locale/el/LC_MESSAGES
|
||||
@dirrmtry share/locale/el
|
||||
@dirrmtry share/locale/cs/LC_MESSAGES
|
||||
@dirrmtry share/locale/cs
|
||||
@dirrmtry share/locale/ca/LC_MESSAGES
|
||||
@dirrmtry share/locale/ca
|
||||
@dirrm %%PYTHON_SITELIBDIR%%/khashmir
|
||||
@dirrm %%PYTHON_SITELIBDIR%%/BitTorrent/GUI_wx
|
||||
@dirrm %%PYTHON_SITELIBDIR%%/BitTorrent
|
||||
|
Loading…
x
Reference in New Issue
Block a user