[btqueue-users] Re: Changes in BTQueue-0.1.0.tar.gz
Status: Beta
Brought to you by:
xgie
From: Sugree P. <su...@hp...> - 2006-03-24 03:29:24
|
Hi Stefan, Oops! Sorry. I thought the changes were just minor bug fixs and no need to change version to 0.1.1. So, I just changed its build number. Sadly, I don't know how to add build number into the source filename. I will notify you next time I release new code (perhaps tomorrow). Regards, Sugree Phatanapherom su...@hp... Stefan Walter wrote: > Hi Sugree, > > when 0.1.0 came out, I updated the FreeBSD port to that version. Now I was > notified that the release tar ball's size (and, according to the attached > diff, the content, too) has changed since I did that update, which > prevents the port from working due to a size and checksum mismatch. > Updating the port again to match the new tar ball isn't a problem, but I > haven't seen an announcement for any changes in the release tar ball and > was wondering what the reason for those changes was. > > Regards, > Stefan > > > ------------------------------------------------------------------------ > > diff -urN BTQueue-0.1.0.old/BitQueue/__init__.py BTQueue-0.1.0/BitQueue/__init__.py > --- BTQueue-0.1.0.old/BitQueue/__init__.py Tue Feb 28 10:22:26 2006 > +++ BTQueue-0.1.0/BitQueue/__init__.py Sat Mar 11 15:49:24 2006 > @@ -1,5 +1,5 @@ > > -version = "Q-0.1.0 406 (BitQueue)" > +version = "Q-0.1.0 433 (BitQueue)" > > version_short = version.split(' ')[0] > version_num = version.split(' ')[0].split('-')[1] > diff -urN BTQueue-0.1.0.old/BitQueue/launchmanycore_bittorrent.py BTQueue-0.1.0/BitQueue/launchmanycore_bittorrent.py > --- BTQueue-0.1.0.old/BitQueue/launchmanycore_bittorrent.py Tue Feb 28 10:19:16 2006 > +++ BTQueue-0.1.0/BitQueue/launchmanycore_bittorrent.py Thu Mar 9 16:02:54 2006 > @@ -8,7 +8,7 @@ > platform.get_config_dir = get_config_dir > platform.install_translation() > > -from BitTorrent import RawServer, download > +from BitTorrent import RawServer, download, ConvertedMetainfo > > try: > basestring > @@ -60,10 +60,31 @@ > self.myid = PeerID.make_id() > > def reannounce(self): > - self._rerequest._announce() > + if self._rerequest._announce: > + self._rerequest._announce() > > download._SingleTorrent = _SingleTorrent > > +BTConvertedMetainfo = ConvertedMetainfo.ConvertedMetainfo > +class _ConvertedMetainfo(BTConvertedMetainfo): > + def __init__(self,*args,**kw): > + self.policy = policy.get_policy() > + BTConvertedMetainfo.__init__(self,*args,**kw) > + > + def _enforce_utf8(self, s): > + encodings = ['utf-8']+self.policy(policy.DEFAULT_ENCODING).split(',')+['latin1'] > + for encoding in encodings: > + try: > + s = s.decode(encoding) > + break > + except: > + pass > + if type(s) == type(u''): > + s = s.encode('utf-8') > + return BTConvertedMetainfo._enforce_utf8(self,s) > + > +ConvertedMetainfo.ConvertedMetainfo = _ConvertedMetainfo > + > from BitTorrent.bencode import bencode,bdecode > from BitTorrent import BTFailure,status_dict > from BitTorrent import configfile > @@ -73,6 +94,7 @@ > from BitTorrent import TorrentQueue > from BitTorrent.ConvertedMetainfo import ConvertedMetainfo, set_filesystem_encoding > from BitTorrent.download import Feedback, Multitorrent > +from BitTorrent import INFO, WARNING, ERROR, CRITICAL, status_dict > > import copy > from random import seed,randrange > @@ -83,6 +105,7 @@ > from __init__ import createPeerID, mapbase64, version > from threading import Event,Thread > from cStringIO import StringIO > +import time > > from queue import hours as fmttime > from i18n import * > @@ -156,12 +179,13 @@ > return 1 > > def remove(self, item): > - hash = item.infohash_bin > - > if item in self.startqueue: > self.startqueue.remove(item) > - self.torrent_list.remove(item) > - del self.downloads[item] > + self.torrent_list.remove(item.infohash_bin) > + try: > + del self.downloads[item] > + except TypeError: > + pass > return > > try: > @@ -183,25 +207,33 @@ > > def add(self, item): > hash,data = item.infohash_bin,item.get_metadata() > + pol = item.get_policy() > + > + try: > + item.metainfo = ConvertedMetainfo(item.get_meta()) > + except BTFailure,why: > + self.output.exception('FAILURE: %s %s' % (item.id,item.title)) > + self.output.exception(str(why)) > + raise why > > self.torrent_list.append(hash) > self.downloads[hash] = item > > - item.metainfo = ConvertedMetainfo(item.get_meta()) > - > name = item.metainfo.name_fs > item.config = copy.copy(self.config) > > path = item.config['save_in'] > item.saveas = os.path.join(path,name) > > - item.config['upnp'] = self.policy(policy.UPNP_NAT_ACCESS) > - item.config['min_peers'] = self.policy(policy.MIN_PEER) > - item.config['max_initiate'] = self.policy(policy.MAX_INITIATE) > - item.config['rerequest_interval'] = self.policy(policy.REREQUEST_INTERVAL) > - item.config['snub_time'] = self.policy(policy.SNUB_TIME) > - item.config['socket_timeout'] = self.policy(policy.IDLE_TIMEOUT) > - item.config['timeout_check_interval'] = self.policy(policy.IDLE_TIMEOUT_CHECK_INTERVAL) > + item.config['min_peers'] = pol(policy.MIN_PEER) > + item.config['max_initiate'] = pol(policy.MAX_INITIATE) > + item.config['rerequest_interval'] = pol(policy.REREQUEST_INTERVAL) > + item.config['snub_time'] = pol(policy.SNUB_TIME) > + item.config['socket_timeout'] = pol(policy.IDLE_TIMEOUT) > + item.config['timeout_check_interval'] = pol(policy.IDLE_TIMEOUT_CHECK_INTERVAL) > + item.config['start_trackerless_client'] = self.auto_dht(item) > + item.config['filesystem_encoding'] = pol(policy.FILESYSTEM_ENCODING) > + item.config['tracker_proxy'] = pol(policy.TRACKER_PROXY) > > self.start_check(item) > > @@ -209,6 +241,27 @@ > # metainfo = self.torrentqueue.torrents[hash] > # self.save_location(hash) > > + def auto_dht(self, item): > + mode = item.get_policy().get(policy.ENABLE_DHT) > + if mode == 0: > + return 0 > + elif mode == 2: > + return 1 > + > + enable = 1 > + meta = item.get_meta() > + > + if meta.has_key('nodes'): > + enable = 1 > + if meta.has_key('azureus_properties'): > + azp = meta['azureus_properties'] > + enable = azp.get('dht_backup_enable',1) > + if meta.has_key('info'): > + info = meta['info'] > + enable = enable and not info.get('private',0) > + > + return enable > + > def start_check(self, item): > if self.busyflag.isSet(): > self.startqueue.append(item) > @@ -220,16 +273,13 @@ > self.emptyflag.clear() > item.dow = self.multitorrent.start_torrent(item.metainfo,item.config,self,item.saveas) > > - def stop(self, item=None): > - if not item: > - for hash in self.torrent_list: > - item = self.downloads[hash] > - self.remove(item) > - if self.removingflag.isSet(): > - self.emptyflag.wait() > - self.doneflag.set() > - else: > - item.done_flag.set() > + def stop(self): > + for hash in self.torrent_list: > + item = self.downloads[hash] > + self.remove(item) > + if self.removingflag.isSet(): > + self.emptyflag.wait() > + self.doneflag.set() > > # def save_location(self, hash): > # metainfo = self.torrentqueue.torrents[hash].metainfo > @@ -277,7 +327,10 @@ > return function(*args) > > def started(self,torrent): > - item = self.downloads[torrent.infohash] > + item = self.downloads.get(torrent.infohash,None) > + if not item: > + self.output.message('FAILURE: not found '+torrent.infohash) > + return > self.output.message('started %s' % item.id) > if self.startqueue: > item = self.startqueue.pop(0) > @@ -311,15 +364,28 @@ > if not self.removing_list: > self.removingflag.clear() > > - def failed(self, torrent, is_external=1): > + def failed(self,torrent,is_external=1): > item = self.downloads.get(torrent.infohash) > - self.output.message('FAILURE: '+item.id) > + if not item: > + self.output.message('FAILURE: invalid item') > + return > + self.output.message('FAILURE: %s %s' % (item.id,item.title)) > > - def exception(self, torrent, s): > + if torrent.errors: > + def format_error(t,l,msg): > + return '%s %s %s' % (time.strftime('%Y/%m/%d %H:%M:%S'),status_dict[l],msg) > + self.output.message(' %s' % format_error(*torrent.errors[-1])) > + self.remove(item) > + if item.state == STATE_SEEDING: > + item.state = STATE_FINISHED > + else: > + item.state = STATE_PAUSED > + > + def exception(self,torrent,s): > self.output.exception(str(s)) > > - def error(self,infohash,severity,text): > - item = self.downloads.get(infohash,None) > + def error(self,torrent,severity,text): > + item = self.downloads.get(torrent.infohash,None) > if item: > item.error = text > > diff -urN BTQueue-0.1.0.old/BitQueue/manager.py BTQueue-0.1.0/BitQueue/manager.py > --- BTQueue-0.1.0.old/BitQueue/manager.py Tue Feb 28 03:51:27 2006 > +++ BTQueue-0.1.0/BitQueue/manager.py Sat Mar 11 15:48:45 2006 > @@ -28,6 +28,7 @@ > from launchmanycore import LaunchManyThread > from scrape import get_scrape_by_metadata > from table import TableFormatter > +import util > > def format_time(s): > if s < 0: > @@ -151,7 +152,10 @@ > args = ['--minport',minport, > '--maxport',maxport, > '--seed_forever', > + '--ip',self.policy(policy.REPORT_IP), > '--save_in',self.policy(policy.DEST_PATH), > + '--start_trackerless_client',str(self.policy(policy.ENABLE_DHT)), > + '--filesystem_encoding',self.policy(policy.FILESYSTEM_ENCODING), > '--max_upload_rate',self.policy(policy.MAX_UPLOAD_RATE)] > # '--max_download_rate',self.policy(policy.MAX_DOWNLOAD_RATE)] > self.controller = LaunchManyThread(self.out,args, > @@ -281,6 +285,8 @@ > dest='referer',default=None, > help='specify referer') > > + clear = self.get_parser('clear') > + > def get_parser(self,prog,usage=None): > if not self.parser.has_key(prog): > if not usage is None: > @@ -1623,8 +1629,10 @@ > detail = res.getreply() > print '%-20s %s' % ('infohash:',detail['infohash']) > for key in detail.keys(): > - if not key in ['infohash','files']: > + if not key in ['infohash','files','creation date']: > print '%-20s %s' % (key+':',str(detail[key])) > + if key == 'creation date': > + print '%-20s %s' % (key+':',format_time(int(detail[key]))) > print '%-20s' % 'files:' > length = 0 > for i in detail['files']: > @@ -1751,6 +1759,10 @@ > def do_quit(self,line=None): > '''detach''' > return 1 > + > + def do_clear(self,line=None): > + '''clear screen''' > + util.clear_screen() > > do_exit = do_quit > do_info = do_detail > diff -urN BTQueue-0.1.0.old/BitQueue/policy.py BTQueue-0.1.0/BitQueue/policy.py > --- BTQueue-0.1.0.old/BitQueue/policy.py Mon Feb 27 12:56:05 2006 > +++ BTQueue-0.1.0/BitQueue/policy.py Wed Mar 8 05:17:19 2006 > @@ -34,6 +34,10 @@ > IDLE_TIMEOUT_CHECK_INTERVAL = 'idle_timeout_check_interval' > > PEER_ID = 'peer_id' > +ENABLE_DHT = 'enable_dht' > +DEFAULT_ENCODING = 'default_encoding' > +FILESYSTEM_ENCODING = 'filesystem_encoding' > +TRACKER_PROXY = 'tracker_proxy' > > DEFAULT_SOCKET_TIMEOUT = 'default_socket_timeout' > MAX_JOB_RUN = 'max_run_job' > @@ -264,6 +268,11 @@ > MAX_SEEDER: 4, > MIN_PEER_RATIO: 0, > MAX_PEER_RATIO: 4, > + > + ENABLE_DHT: 1, > + FILESYSTEM_ENCODING: '', > + TRACKER_PROXY: '', > + > PRIORITIES: '', > USE_LOCAL_POLICY: 0, > } > @@ -307,7 +316,7 @@ > try: > ret = self.params[key] > except KeyError: > - ret = None > + ret = get_policy().get(key) > return ret > > class Policy: > @@ -326,27 +335,39 @@ > DEFAULT_COMMAND: 'list running seeding', > DEFAULT_SOCKET_TIMEOUT: 60, > DEFAULT_PRIORITY: 5, > + > TORRENT_FORMAT: DEFAULT_TORRENT_FORMAT, > SPEW_FORMAT: DEFAULT_SPEW_FORMAT, > PEER_FORMAT: DEFAULT_PEER_FORMAT, > + > SCHEDULING_INTERVAL: 30, > SCRAPE_INTERVAL: 20*60, > REREQUEST_INTERVAL: 20*60, > REQUEST_BACKLOG: 2, > + > IDLE_TIMEOUT: 300, > IDLE_TIMEOUT_CHECK_INTERVAL: 60, > SNUB_TIME: 30, > + > DEBUG_LEVEL: 0, > REASSIGN_ID: 1, > LOG_UNKNOWN_ID: 0, > + > REPORT_IP: '', > BIND_IP: '', > IPV6_BINDS_V4: 0, > UPNP_NAT_ACCESS: 1, > + > PEER_ID: 'btq', > + ENABLE_DHT: 1, > + DEFAULT_ENCODING: 'tis-620', > + FILESYSTEM_ENCODING: '', > + TRACKER_PROXY: '', > + > MIN_PORT: 6881, > MAX_PORT: 6999, > RANDOM_PORT: 1, > + > MIN_FREE_SPACE: 100*1024*1024, > MIN_PEER: 20, > MAX_PEER: 90, > @@ -362,33 +383,38 @@ > MAX_SEEDER: 4, > MIN_PEER_RATIO: 0, > MAX_PEER_RATIO: 4, > + > DEST_PATH: os.path.join(default_path,'incoming'), > TORRENT_PATH: os.path.join(default_path,'torrent'), > IGNORE_WAITING_MEDIA: 0, > + > ALLOW_ACL: 'ALL', > DENY_ACL: 'NONE', > ORDER_ACL: 'allow,deny', > MAX_LAST_BANNED: 20, > MAX_LAST_MESSAGE: 40, > + > VERIFY_LINK: 0, > DAEMON_STDOUT: '', > DAEMON_STDERR: '', > WRITE_BUFFER_SIZE: 4, > + > XMLRPC_IP: '127.0.0.1', > XMLRPC_PORT: 19413, > XMLRPC_ID: 'xmlrpcbt', > + > WEBSERVICE_IP: '127.0.0.1', > WEBSERVICE_PORT: 19412, > WEBSERVICE_ID: 'wsbt', > - WEBSERVICE_CLOSE: False, > - WEBSERVICE_QUERY: True, > - WEBSERVICE_ADD: True, > - WEBSERVICE_DELETE: True, > - WEBSERVICE_PAUSE: True, > - WEBSERVICE_RESUME: True, > - WEBSERVICE_QUEUE: True, > - WEBSERVICE_VERSION: True, > - WEBSERVICE_GSET: False > + WEBSERVICE_CLOSE: 0, > + WEBSERVICE_QUERY: 1, > + WEBSERVICE_ADD: 1, > + WEBSERVICE_DELETE: 1, > + WEBSERVICE_PAUSE: 1, > + WEBSERVICE_RESUME: 1, > + WEBSERVICE_QUEUE: 1, > + WEBSERVICE_VERSION: 1, > + WEBSERVICE_GSET: 0, > } > self.load() > > diff -urN BTQueue-0.1.0.old/BitQueue/queue.py BTQueue-0.1.0/BitQueue/queue.py > --- BTQueue-0.1.0.old/BitQueue/queue.py Tue Feb 28 04:28:35 2006 > +++ BTQueue-0.1.0/BitQueue/queue.py Sat Mar 11 15:44:27 2006 > @@ -317,7 +317,6 @@ > self.priority = self.global_policy(policy.DEFAULT_PRIORITY) > self.local_policy = policy.EntryPolicy() > self.state = STATE_WAITING > - self.done_flag = Event() > self.dest_path = dest_path > self.saveas = '' > self.dlsize = self.ulsize = self.old_dlsize = self.old_ulsize = 0 > @@ -575,7 +574,7 @@ > if sizeDone != None: > self.size_done = sizeDone > if self.size_done > self.old_dlsize+self.dlsize: > - self.old_dlsize = self.size_done-self.dlsize > + self.dlsize = self.size_done-self.old_dlsize > #if self.statistics: > # if self.old_dlsize+self.dlsize > \ > # self.statistics.downmeasure.get_total(): > diff -urN BTQueue-0.1.0.old/BitQueue/scheduler.py BTQueue-0.1.0/BitQueue/scheduler.py > --- BTQueue-0.1.0.old/BitQueue/scheduler.py Mon Feb 27 19:28:34 2006 > +++ BTQueue-0.1.0/BitQueue/scheduler.py Tue Mar 7 06:47:13 2006 > @@ -278,9 +278,8 @@ > self.unhold(item) > return > if item.state in [STATE_RUNNING,STATE_SEEDING]: > - item.done_flag.set() > - item.state = STATE_WAITING > - self.schedule() > + return > + self.dispatch(item) > > def hold(self,item): > if item.state == STATE_HOLDED: > @@ -323,7 +322,12 @@ > item.params += ['--ip',report_ip] > item.params += [item.file] > self.num_run += 1 > - self.do_dispatch(item,self.cb_finished,self.cb_failed) > + try: > + self.do_dispatch(item,self.cb_finished,self.cb_failed) > + except Exception,why: > + self.num_run -= 1 > + item.state = STATE_PAUSED > + item.error = str(why) > > def cb_finished(self,item): > self.lock.acquire() > @@ -352,7 +356,7 @@ > completes = [] > incompletes = [] > > - for j in self.queue.get(): > + for j in self.jobs(): > # duplicate with download rate > #j.update_scrape() > if not j.dow or not hasattr(j.dow.d,'downloader'): > @@ -432,7 +436,7 @@ > return > incompletes = [] > > - for j in self.queue.get(): > + for j in self.jobs(): > # duplicate with download rate > #j.update_scrape() > if not j.dow or not hasattr(j.dow.d,'downloader'): > @@ -465,7 +469,7 @@ > incompletes = [] > used_bw = 0 > dl_rates = [] > - for j in self.queue.get(): > + for j in self.jobs(): > # duplicate with upload rate > #j.update_scrape() > if not j.dow or not hasattr(j.dow.d,'downloader'): > @@ -503,13 +507,13 @@ > if free_space == -1: > return > if free_space < self.policy(policy.MIN_FREE_SPACE): > - for j in self.queue.get(): > + for j in self.jobs(): > if j.state in [STATE_RUNNING,STATE_SEEDING]: > self.pause(j) > > def terminate_seeding(self): > now = time.time() > - for j in self.queue.get(): > + for j in self.jobs(): > pol = j.get_policy() > if pol(policy.USE_LOCAL_POLICY): > min_share_ratio = pol(policy.MIN_SHARE_RATIO) > @@ -595,7 +599,7 @@ > if self.scrape_thread.isAlive(): > return > active_jobs = [] > - for j in self.queue.get(): > + for j in self.jobs(): > if j.state in [STATE_RUNNING,STATE_SEEDING]: > active_jobs.append(j) > > @@ -605,7 +609,7 @@ > > def stop(self): > self._quit.set() > - for j in self.queue.get(): > + for j in self.jobs(): > self.controller.remove(j) > if hasattr(self,'scrape_thread'): > if self.scrape_thread.isAlive(): > diff -urN BTQueue-0.1.0.old/BitQueue/util.py BTQueue-0.1.0/BitQueue/util.py > --- BTQueue-0.1.0.old/BitQueue/util.py Fri Dec 10 18:25:33 2004 > +++ BTQueue-0.1.0/BitQueue/util.py Tue Mar 7 07:01:29 2006 > @@ -2,6 +2,8 @@ > Utilities > ''' > > +numlines = 100 > + > import os,sys > > def get_free_space_statvfs(path): > @@ -31,3 +33,19 @@ > else: > import statvfs > get_free_space = get_free_space_statvfs > + > +def clear_screen_posix(): > + os.system('clear') > + > +def clear_screen_win32(): > + os.system('CLS') > + > +def clear_screen_default(): > + print '\n' * numlines > + > +if os.name == 'posix': > + clear_screen = clear_screen_posix > +elif os.name in ('nt','dos','ce'): > + clear_screen = clear_screen_win32 > +else: > + clear_screen = clear_screen_default > diff -urN BTQueue-0.1.0.old/BitQueue/xmlrpc.py BTQueue-0.1.0/BitQueue/xmlrpc.py > --- BTQueue-0.1.0.old/BitQueue/xmlrpc.py Wed Dec 22 18:41:09 2004 > +++ BTQueue-0.1.0/BitQueue/xmlrpc.py Tue Mar 7 05:48:03 2006 > @@ -116,6 +116,7 @@ > self.id = self.policy(policy.XMLRPC_ID).split(',') > > def _dispatch(self,method,params): > + params = xml_unescape(params) > if len(params) < 1 or not params[0] in self.id: > raise Exception('unauthorized') > if hasattr(SimpleXMLRPCRequestHandler,'_dispatch'): > @@ -173,6 +174,7 @@ > def __request(self, methodname, params): > # call a method on the remote server > > + params = xml_escape(params) > request = xmlrpclib.dumps(params, methodname, encoding=self.__encoding) > > response = self.__transport.request( > diff -urN BTQueue-0.1.0.old/BitTorrent/Rerequester.py BTQueue-0.1.0/BitTorrent/Rerequester.py > --- BTQueue-0.1.0.old/BitTorrent/Rerequester.py Mon Feb 27 12:54:46 2006 > +++ BTQueue-0.1.0/BitTorrent/Rerequester.py Thu Mar 2 04:23:13 2006 > @@ -62,9 +62,18 @@ > self.tracker_num_seeds = None > > def _makeurl(self, peerid, port): > - return ('%s?info_hash=%s&peer_id=%s&port=%s&key=%s' % > - (self.baseurl, quote(self.infohash), quote(peerid), str(port), > + url = ('info_hash=%s&peer_id=%s&port=%s&key=%s' % > + (quote(self.infohash), quote(peerid), str(port), > b2a_hex(''.join([chr(randrange(256)) for i in xrange(4)])))) > + try: > + url += '&local_ip=%s' % quote(gethostbyname(gethostname())) > + except: > + pass > + if self.baseurl.find('?') >= 0: > + c = '&' > + else: > + c = '?' > + return '%s%s%s' % (self.baseurl,c,url) > > def change_port(self, peerid, port): > self.wanted_peerid = peerid > diff -urN BTQueue-0.1.0.old/setup.cfg BTQueue-0.1.0/setup.cfg > --- BTQueue-0.1.0.old/setup.cfg Tue Feb 28 10:23:01 2006 > +++ BTQueue-0.1.0/setup.cfg Sat Mar 11 15:49:28 2006 > @@ -1,3 +1,3 @@ > [bdist_rpm] > -release = 406.2.2 > +release = 433.2.2 > packager = Sugree Phatanapherom <su...@hp...> |