36 |
kaklik |
1 |
#!/usr/bin/env python
|
|
|
2 |
|
|
|
3 |
# Written by Bram Cohen
|
|
|
4 |
# multitracker extensions by John Hoffman
|
|
|
5 |
# see LICENSE.txt for license information
|
|
|
6 |
|
|
|
7 |
from BitTornado import PSYCO
|
|
|
8 |
if PSYCO.psyco:
|
|
|
9 |
try:
|
|
|
10 |
import psyco
|
|
|
11 |
assert psyco.__version__ >= 0x010100f0
|
|
|
12 |
psyco.full()
|
|
|
13 |
except:
|
|
|
14 |
pass
|
|
|
15 |
|
|
|
16 |
from sys import argv, version, exit
|
|
|
17 |
from os.path import split
|
|
|
18 |
assert version >= '2', "Install Python 2.0 or greater"
|
|
|
19 |
from BitTornado.BT1.makemetafile import make_meta_file, defaults, print_announcelist_details
|
|
|
20 |
from BitTornado.parseargs import parseargs, formatDefinitions
|
|
|
21 |
|
|
|
22 |
|
|
|
23 |
def prog(amount):
|
|
|
24 |
print '%.1f%% complete\r' % (amount * 100),
|
|
|
25 |
|
|
|
26 |
if len(argv) < 3:
|
|
|
27 |
a,b = split(argv[0])
|
|
|
28 |
print 'Usage: ' + b + ' <trackerurl> <file> [file...] [params...]'
|
|
|
29 |
print
|
|
|
30 |
print formatDefinitions(defaults, 80)
|
|
|
31 |
print_announcelist_details()
|
|
|
32 |
print ('')
|
|
|
33 |
exit(2)
|
|
|
34 |
|
|
|
35 |
try:
|
|
|
36 |
config, args = parseargs(argv[1:], defaults, 2, None)
|
|
|
37 |
for file in args[1:]:
|
|
|
38 |
make_meta_file(file, args[0], config, progress = prog)
|
|
|
39 |
except ValueError, e:
|
|
|
40 |
print 'error: ' + str(e)
|
|
|
41 |
print 'run with no args for parameter explanations'
|