BitTorrent
Make BitTorrent accept torrent filenames and URLs on the command-line as the final (or only) argument without --url and --responsefile, so that you can just say "btdownloadcurses foo.torrent" or "btdownloadcurses https://www.example.net/bar.torrent":
--- BitTorrent-3.2.1b/BitTorrent/download.py.orig 2003-05-03 23:50:30.000000000 -0700
+++ BitTorrent-3.2.1b/BitTorrent/download.py 2003-05-04 13:16:31.000000000 -0700
@@ -2,7 +2,7 @@
# see LICENSE.txt for license information
from zurllib import urlopen
-from urlparse import urljoin
+from urlparse import urljoin, urlparse
from btformats import check_message
from Choker import Choker
from Storage import Storage
@@ -89,10 +89,13 @@
if len(params) == 0:
errorfunc('arguments are -\n' + formatDefinitions(defaults, cols))
return
- if len(params) == 1:
- params = ['--responsefile'] + params
try:
- config, garbage = parseargs(params, defaults, 0, 0)
+ config, garbage = parseargs(params, defaults, 0, 1)
+ if garbage:
+ if urlparse(garbage[0])[0] in ( 'http', 'https', 'ftp', 'file' ):
+ config['url'] = garbage[0]
+ else:
+ config['responsefile'] = garbage[0]
if (config['responsefile'] == '') == (config['url'] == ''):
raise ValueError, 'need responsefile or url'
except ValueError, e: