[Debtorrent-commits] r10 - in /debtorrent/trunk:
DebTorrent/BT1/makemetafile.py btcompletedir.py
camrdale-guest at users.alioth.debian.org
camrdale-guest at users.alioth.debian.org
Wed Apr 25 23:20:40 UTC 2007
Author: camrdale-guest
Date: Wed Apr 25 23:20:40 2007
New Revision: 10
URL: http://svn.debian.org/wsvn/debtorrent/?sc=1&rev=10
Log:
Make btcompletedir work for dtorrents
Modified:
debtorrent/trunk/DebTorrent/BT1/makemetafile.py
debtorrent/trunk/btcompletedir.py
Modified: debtorrent/trunk/DebTorrent/BT1/makemetafile.py
URL: http://svn.debian.org/wsvn/debtorrent/debtorrent/trunk/DebTorrent/BT1/makemetafile.py?rev=10&op=diff
==============================================================================
--- debtorrent/trunk/DebTorrent/BT1/makemetafile.py (original)
+++ debtorrent/trunk/DebTorrent/BT1/makemetafile.py Wed Apr 25 23:20:40 2007
@@ -215,14 +215,6 @@
if f[-len(ext):] != ext and (f + ext) not in files:
togen.append(join(dir, f))
- total = 0
- for i in togen:
- total += calcsize(i)
-
- subtotal = [0]
- def callback(x, subtotal = subtotal, total = total, vc = vc):
- subtotal[0] += x
- vc(float(subtotal[0]) / total)
for i in togen:
fc(i)
try:
@@ -230,6 +222,6 @@
if t not in ignore and t[0] != '.':
if target != '':
params['target'] = join(target,t+ext)
- make_meta_file(i, url, params, flag, progress = callback, progress_percent = 0)
+ make_meta_file(i, url, params, flag, progress = vc, progress_percent = 0)
except ValueError:
print_exc()
Modified: debtorrent/trunk/btcompletedir.py
URL: http://svn.debian.org/wsvn/debtorrent/debtorrent/trunk/btcompletedir.py?rev=10&op=diff
==============================================================================
--- debtorrent/trunk/btcompletedir.py (original)
+++ debtorrent/trunk/btcompletedir.py Wed Apr 25 23:20:40 2007
@@ -18,11 +18,16 @@
from DebTorrent.BT1.makemetafile import defaults, completedir, print_announcelist_details
from DebTorrent.parseargs import parseargs, formatDefinitions
-
+def prog(amount):
+ print '%d packages found\r' % amount,
+
+def next_file(file):
+ print "\nProcessing file: %s" % file
+
if len(argv) < 3:
a,b = split(argv[0])
print 'Usage: ' + b + ' <trackerurl> <dir> [dir...] [params...]'
- print 'makes a .torrent file for every file or directory present in each dir.'
+ print 'makes a .dtorrent file for every Packages file present in each dir.'
print
print formatDefinitions(defaults, 80)
print_announcelist_details()
@@ -32,7 +37,7 @@
try:
config, args = parseargs(argv[1:], defaults, 2, None)
for dir in args[1:]:
- completedir(dir, args[0], config)
+ completedir(dir, args[0], config, vc = prog, fc = next_file)
except ValueError, e:
print 'error: ' + str(e)
print 'run with no args for parameter explanations'
More information about the Debtorrent-commits
mailing list