Esempio n. 1
0
def main():
    """Main entry point for Command Line Interface"""

    logger.initialize()

    parser = CoreArgumentParser()
    plugin.load_plugins(parser)

    options = parser.parse_args()

    try:
        manager = Manager(options)
    except IOError as e:
        # failed to load config, TODO: why should it be handled here? So sys.exit isn't called in webui?
        log.critical(e)
        logger.flush_logging_to_console()
        sys.exit(1)

    log_level = logging.getLevelName(options.loglevel.upper())
    log_file = os.path.expanduser(manager.options.logfile)
    # If an absolute path is not specified, use the config directory.
    if not os.path.isabs(log_file):
        log_file = os.path.join(manager.config_base, log_file)
    logger.start(log_file, log_level)

    if options.profile:
        try:
            import cProfile as profile
        except ImportError:
            import profile
        profile.runctx('manager.execute()', globals(), locals(), os.path.join(manager.config_base, 'flexget.profile'))
    else:
        manager.execute()
    manager.shutdown()
Esempio n. 2
0
def main():
    """Main entry point for Command Line Interface"""

    logger.initialize()

    parser = CoreOptionParser()
    plugin.load_plugins(parser)

    options = parser.parse_args()[0]

    try:
        manager = Manager(options)
    except IOError, e:
        # failed to load config, TODO: why should it be handled here?
        log.exception(e)
        logger.flush_logging_to_console()
        sys.exit(1)
Esempio n. 3
0
def main():
    """Main entry point for Command Line Interface"""

    logger.initialize()

    parser = CoreArgumentParser()
    plugin.load_plugins(parser)

    options = parser.parse_args()

    try:
        manager = Manager(options)
    except IOError, e:
        # failed to load config, TODO: why should it be handled here? So sys.exit isn't called in webui?
        log.critical(e)
        logger.flush_logging_to_console()
        sys.exit(1)
Esempio n. 4
0
def main():
    """Main entry point for FlexGet UI"""

    logger.initialize()

    # The core plugins need a core parser to add their options to
    core_parser = CoreArgumentParser()
    plugin.load_plugins(core_parser)

    # Use the ui options parser to parse the cli
    parser = UIArgumentParser(core_parser)
    options = parser.parse_args()
    try:
        manager = UIManager(options, core_parser)
    except IOError, e:
        # failed to load config
        log.critical(e.message)
        logger.flush_logging_to_console()
        sys.exit(1)
Esempio n. 5
0
def main():
    """Main entry point for FlexGet UI"""

    logger.initialize()

    # The core plugins need a core parser to add their options to
    core_parser = CoreArgumentParser()
    plugin.load_plugins(core_parser)

    # Use the ui options parser to parse the cli
    parser = UIArgumentParser(core_parser)
    options = parser.parse_args()
    try:
        manager = UIManager(options, core_parser)
    except IOError as e:
        # failed to load config
        log.critical(e.message)
        logger.flush_logging_to_console()
        sys.exit(1)

    log_level = logging.getLevelName(options.loglevel.upper())
    logger.start(os.path.join(manager.config_base, 'flexget.log'), log_level)

    flexget.ui.webui.start(manager)