diff --git a/deluge/ui/null/deluge-shell.py b/deluge/ui/null/deluge_shell.py similarity index 92% rename from deluge/ui/null/deluge-shell.py rename to deluge/ui/null/deluge_shell.py index 796dec934..a521d5556 100755 --- a/deluge/ui/null/deluge-shell.py +++ b/deluge/ui/null/deluge_shell.py @@ -219,25 +219,27 @@ commands = (('add', add_torrent, 'Add a torrent'), client.set_core_uri("http://localhost:58846") -print "Welcome to deluge-shell. Type 'help' to see a list of available commands." +class NullUI: + def __init__(self, args): + print "Welcome to deluge-shell. Type 'help' to see a list of available commands." -readline.read_init_file() -while True: - inp = raw_input("> ") - if len(inp) == 0: break - inp = inp.strip().split(" ") + readline.read_init_file() + while True: + inp = raw_input("> ") + if len(inp) == 0: break + inp = inp.strip().split(" ") - print "" - cmd = inp[0] - found = False - for command, action, help in commands: - if command != cmd: - continue - action(inp) - found = True - break - if not found: - print "Invalid command!" - show_help([]) + print "" + cmd = inp[0] + found = False + for command, action, help in commands: + if command != cmd: + continue + action(inp) + found = True + break + if not found: + print "Invalid command!" + show_help([]) -print "Thanks." + print "Thanks." diff --git a/deluge/ui/ui.py b/deluge/ui/ui.py index 6612ae1ed..1fc6138a5 100644 --- a/deluge/ui/ui.py +++ b/deluge/ui/ui.py @@ -59,4 +59,8 @@ class UI: log.info("Starting WebUI..") from deluge.ui.webui.webui import WebUI ui = WebUI(args) - + elif selected_ui == "null": + log.info("Starting NullUI..") + from deluge.ui.null.deluge_shell import NullUI + ui = NullUI(args) +