예제 #1
0
    def __init__(self,
                 update=None,
                 createNewConfig=False,
                 dropfiledb=False,
                 setup=False,
                 cfg_override={},
                 adduser=None):
        self.setup_services()
        self.setup_config(createNewConfig, setup, cfg_override)

        if config['media.basedir'] is None:
            print(_("Invalid basedir. Please provide a valid basedir path."))
            sys.exit(1)
        else:
            log.debug("Basedir is %r", config['media.basedir'])

        signal.signal(signal.SIGTERM, CherryMusic.stopAndCleanUp)
        signal.signal(signal.SIGINT, CherryMusic.stopAndCleanUp)
        if os.name == 'posix':
            signal.signal(signal.SIGHUP, CherryMusic.stopAndCleanUp)
        if adduser:
            if CherryMusic.createUser(adduser):
                sys.exit(0)
            else:
                sys.exit(1)
        self.setup_databases(update, dropfiledb, setup)
        CherryMusic.create_pid_file()
        self.start_server(httphandler.HTTPHandler(config))
        CherryMusic.delete_pid_file()
예제 #2
0
    def __init__(self, cfg_override=None):
        self.setup_config(cfg_override)
        setup_services()

        if config['media.basedir'] is None:
            print(_("Invalid basedir. Please provide a valid basedir path."))
            sys.exit(1)
        else:
            log.debug("Basedir is %r", config['media.basedir'])

        signal.signal(signal.SIGTERM, CherryMusic.stopAndCleanUp)
        signal.signal(signal.SIGINT, CherryMusic.stopAndCleanUp)
        if os.name == 'posix':
            signal.signal(signal.SIGHUP, CherryMusic.stopAndCleanUp)

        CherryMusic.create_pid_file()
        self.start_server(httphandler.HTTPHandler(config))
        CherryMusic.delete_pid_file()
예제 #3
0
    def __init__(self, cfg_override=None):
        self.setup_config(cfg_override)
        setup_services()

        if config['media.basedir'] is None:
            print(_("Invalid basedir. Please provide a valid basedir path."))
            sys.exit(1)
        else:
            log.debug("Basedir is %r", config['media.basedir'])

        signal.signal(signal.SIGTERM, CherryMusic.stopAndCleanUp)
        signal.signal(signal.SIGINT, CherryMusic.stopAndCleanUp)
        if os.name == 'posix':
            signal.signal(signal.SIGHUP, CherryMusic.stopAndCleanUp)

        CherryMusic.create_pid_file()
        self.start_server(httphandler.HTTPHandler(config))
        CherryMusic.delete_pid_file()
예제 #4
0
    def __init__(self, update=None, createNewConfig=False, dropfiledb=False,
                 setup=False, cfg_override={}, adduser=None):
        self.setup_services()
        self.setup_config(createNewConfig, setup, cfg_override)

        if config['media.basedir'] is None:
            print(_("Invalid basedir. Please provide a valid basedir path."))
            sys.exit(1)
        else:
            log.debug("Basedir is %r", config['media.basedir'])

        signal.signal(signal.SIGTERM, CherryMusic.stopAndCleanUp)
        signal.signal(signal.SIGINT, CherryMusic.stopAndCleanUp)
        if os.name == 'posix':
            signal.signal(signal.SIGHUP, CherryMusic.stopAndCleanUp)
        if adduser:
            if CherryMusic.createUser(adduser):
                sys.exit(0)
            else:
                sys.exit(1)
        self.setup_databases(update, dropfiledb, setup)
        CherryMusic.create_pid_file()
        self.start_server(httphandler.HTTPHandler(config))
        CherryMusic.delete_pid_file()