diff options
author | Marcos Pinto <markybob@dipconsultants.com> | 2007-07-13 01:13:13 +0000 |
---|---|---|
committer | Marcos Pinto <markybob@dipconsultants.com> | 2007-07-13 01:13:13 +0000 |
commit | 63d19d05bc30cd410bcb48f7739e617450ef3c82 (patch) | |
tree | 5629071bca66562fac1f841a1862d64d86680a70 /scripts | |
parent | 77b5ce765bfc4d97c4323f966efc832609e5df12 (diff) | |
download | deluge-63d19d05bc30cd410bcb48f7739e617450ef3c82.tar.gz deluge-63d19d05bc30cd410bcb48f7739e617450ef3c82.tar.bz2 deluge-63d19d05bc30cd410bcb48f7739e617450ef3c82.zip |
mostly pep8 fixes
Diffstat (limited to 'scripts')
-rwxr-xr-x | scripts/deluge | 86 |
1 files changed, 43 insertions, 43 deletions
diff --git a/scripts/deluge b/scripts/deluge index 5190aac7c..4b44a40a7 100755 --- a/scripts/deluge +++ b/scripts/deluge @@ -20,9 +20,9 @@ # # You should have received a copy of the GNU General Public License # along with deluge. If not, write to: -# The Free Software Foundation, Inc., -# 51 Franklin Street, Fifth Floor -# Boston, MA 02110-1301, USA. +# The Free Software Foundation, Inc., +# 51 Franklin Street, Fifth Floor +# Boston, MA 02110-1301, USA. # # In addition, as a special exception, the copyright holders give # permission to link the code of portions of this program with the OpenSSL @@ -40,67 +40,67 @@ import os, os.path import gettext, locale import deluge, deluge.common, deluge.interface try: - import dbus - dbus_version = getattr(dbus, 'version', (0,0,0)) - if dbus_version >= (0,41,0) and dbus_version < (0,80,0): - import dbus.glib - elif dbus_version >= (0,80,0): - from dbus.mainloop.glib import DBusGMainLoop - DBusGMainLoop(set_as_default=True) - else: - pass + import dbus + dbus_version = getattr(dbus, 'version', (0,0,0)) + if dbus_version >= (0,41,0) and dbus_version < (0,80,0): + import dbus.glib + elif dbus_version >= (0,80,0): + from dbus.mainloop.glib import DBusGMainLoop + DBusGMainLoop(set_as_default=True) + else: + pass except: dbus_imported = False else: dbus_imported = True 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") + metavar="TRAY", action="store_true") parser.add_option("--url", dest="url", help="Load a torrent from a URL", - metavar="URL", action="store") + metavar="URL", action="store") (options, args) = parser.parse_args() def start_deluge(): - print "Starting new Deluge session..." - interface = deluge.interface.DelugeGTK() - add_args(interface) - interface.start(options.tray) + print "Starting new Deluge session..." + interface = deluge.interface.DelugeGTK() + add_args(interface) + interface.start(options.tray) def add_args(interface): - if options.url: - interface.external_add_url(options.url) - else: - for arg in args: - apath = os.path.abspath(arg) - if apath.endswith(".torrent"): - interface.external_add_torrent(apath) - else: - print "Error,", arg, " does not seem to be a .torrent file" + if options.url: + interface.external_add_url(options.url) + else: + for arg in args: + apath = os.path.abspath(arg) + if apath.endswith(".torrent"): + interface.external_add_torrent(apath) + else: + print "Error,", arg, " does not seem to be a .torrent file" if dbus_imported: - bus = dbus.SessionBus() + bus = dbus.SessionBus() - dbus_objects = dbus.Interface(bus.get_object('org.freedesktop.DBus', '/org/freedesktop/DBus'), 'org.freedesktop.DBus').ListNames() + dbus_objects = dbus.Interface(bus.get_object('org.freedesktop.DBus', '/org/freedesktop/DBus'), 'org.freedesktop.DBus').ListNames() - interface = None + interface = None - if not "org.deluge_torrent.Deluge" in dbus_objects: - print "no existing Deluge session" - start_deluge() - else: - ## This connects to the deluge interface - print "create proxy object" - proxy = bus.get_object('org.deluge_torrent.Deluge', '/org/deluge_torrent/DelugeObject') - print "create iface" - deluge_iface = dbus.Interface(proxy, 'org.deluge_torrent.Deluge') - print "send to iface" + if not "org.deluge_torrent.Deluge" in dbus_objects: + print "no existing Deluge session" + start_deluge() + else: + ## This connects to the deluge interface + print "create proxy object" + proxy = bus.get_object('org.deluge_torrent.Deluge', '/org/deluge_torrent/DelugeObject') + print "create iface" + deluge_iface = dbus.Interface(proxy, 'org.deluge_torrent.Deluge') + print "send to iface" - add_args(deluge_iface) + add_args(deluge_iface) else: - print "no existing Deluge session" - start_deluge() + print "no existing Deluge session" + start_deluge() |