summaryrefslogtreecommitdiffstats
path: root/scripts
diff options
context:
space:
mode:
authorAlex Dedul <rotmer@gmail.com>2007-07-16 16:07:06 +0000
committerAlex Dedul <rotmer@gmail.com>2007-07-16 16:07:06 +0000
commitdf898e22b8516d5b7620f5964ec7afd385be3699 (patch)
treecc78b2f5f49c8e074e57fd4784511b00e6d6abf2 /scripts
parent30b69cd85a4fee4e76dbf45df4aafb32ff6426ed (diff)
downloaddeluge-df898e22b8516d5b7620f5964ec7afd385be3699.tar.gz
deluge-df898e22b8516d5b7620f5964ec7afd385be3699.tar.bz2
deluge-df898e22b8516d5b7620f5964ec7afd385be3699.zip
Fixed #268 - Tweaks for torrents loading from command line, from url.
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/deluge23
1 files changed, 15 insertions, 8 deletions
diff --git a/scripts/deluge b/scripts/deluge
index a5d16f033..1fdfa7000 100755
--- a/scripts/deluge
+++ b/scripts/deluge
@@ -63,8 +63,6 @@ import deluge.interface
parser = OptionParser(usage="%prog [options] [actions]", version=deluge.common.PROGRAM_VERSION)
parser.add_option("--tray", dest="tray", help="start Deluge hidden in system tray",
metavar="TRAY", action="store_true")
-parser.add_option("--url", dest="url", help="Load a torrent from a URL",
- metavar="URL", action="store")
(options, args) = parser.parse_args()
@@ -106,7 +104,20 @@ Continuing...""" % pstate_file_path
print >> sys.stderr, "The error was: %s." % oopsie
def get_cmd_line_torrents():
- return [os.path.abspath(x) for x in args]
+ cmd_line_torrents = []
+
+ for torrent in args:
+ if deluge.common.is_url(torrent):
+ filename = deluge.common.fetch_url(torrent)
+ if filename:
+ cmd_line_torrents.append(filename)
+ else:
+ if not torrent.endswith(".torrent"):
+ print "Error,", torrent, " does not seem to be a .torrent file"
+ else:
+ cmd_line_torrents.append(os.path.abspath(torrent))
+
+ return cmd_line_torrents
def start_deluge():
print "Starting new Deluge session..."
@@ -115,7 +126,7 @@ def start_deluge():
interface = deluge.interface.DelugeGTK()
- interface.start(options.tray, get_cmd_line_torrents(), options.url)
+ interface.start(options.tray, get_cmd_line_torrents())
if dbus_imported:
bus = dbus.SessionBus()
@@ -137,10 +148,6 @@ if dbus_imported:
for filename in get_cmd_line_torrents():
deluge_iface.interactive_add_torrent(filename)
-
- if options.url:
- deluge_iface.interactive_add_torrent_url(options.url)
-
else:
print "no existing Deluge session"
start_deluge()