Beispiel #1
0
def do_serve(pure=False):
    """ Create a ZicDB instance
    parameters:
        pure (default: False): just start DB serving, no player
    """
    import socket
    import sys

    set_proc_title('zicserve')
    sys.argv = ['zicdb', '0.0.0.0:%s'%(config.default_port)]

    try:
        make_app(no_player=pure).run()
    except SystemExit:
        print "ciao!"
    except socket.error:
        print "Already running!"
        try:
            abort()
        finally:
            raise SystemExit()
    except:
        DEBUG()
        try:
            abort()
        finally:
            print os.kill(os.getpid(), 9)
Beispiel #2
0
    def __init__(self):
        self._history = os.path.join(DB_DIR, 'wasp_history.txt')
        self._last_line = None
        try:
            readline.read_history_file(self._history)
        except IOError:
            'First time you launch Wasp! type "help" to get a list of commands.'

        for cmd, infos in commands.iteritems():
            try:
                completer = commands[cmd][2]['complete']
            except (IndexError, KeyError):
                pass # no completor
            else:
                setattr(self, 'complete_%s'%cmd, partial(complete_command, cmd, completer))
        Cmd.__init__(self)
        print "Playing on http://%s songs from http://%s/db"%(config['player_host'][0], config['db_host'][0])
        self.names = ['do_%s'%c for c in commands.keys()] + ['do_help']
        set_proc_title('wasp')