Exemple #1
0
def setupAlexaService():
	if event_commands['startup']:
		subprocess.Popen(event_commands['startup'], shell=True, stdout=subprocess.PIPE)

	try:
		global capture
		capture = alexapi.capture.Capture(config, tmp_path)
	except ConfigurationException as exp:
		logger.critical(exp)
		sys.exit(1)

	capture.setup(platform.indicate_recording)

	triggers.init(config, trigger_callback, capture)
	triggers.setup()

	pHandler.setup()
	platform.setup()

	for sig in (signal.SIGABRT, signal.SIGILL, signal.SIGINT, signal.SIGSEGV, signal.SIGTERM):
		signal.signal(sig, cleanup)

	logger.info("Checking Internet Connection ...")
	while not internet_on():
		time.sleep(1)

	try:
		global token
		token = Token(config['alexa'])

		if not str(token):
			raise RuntimeError

	except (ConfigurationException, RuntimeError):
		platform.indicate_failure()
		sys.exit(1)

	platform_trigger_callback = triggers.triggers['platform'].platform_callback if 'platform' in triggers.triggers else None
	platform.after_setup(platform_trigger_callback)
	triggers.enable()
	platform.indicate_success()
Exemple #2
0
    sys.exit(0)


if __name__ == "__main__":

    if event_commands['startup']:
        subprocess.Popen(event_commands['startup'],
                         shell=True,
                         stdout=subprocess.PIPE)

    try:
        capture = alexapi.capture.Capture(config, tmp_path)
        capture.setup(platform.indicate_recording)

        triggers.init(config, trigger_callback, capture)
        triggers.setup()
    except ConfigurationException as exp:
        logger.critical(exp)
        sys.exit(1)

    pHandler.setup()
    platform.setup()

    for sig in (signal.SIGABRT, signal.SIGILL, signal.SIGINT, signal.SIGSEGV,
                signal.SIGTERM):
        signal.signal(sig, cleanup)

    logger.info("Checking Internet Connection ...")
    while not internet_on():
        time.sleep(1)
Exemple #3
0
        signal.signal(sig, cleanup)

    if event_commands['startup']:
        subprocess.Popen(event_commands['startup'],
                         shell=True,
                         stdout=subprocess.PIPE)

    try:
        capture = alexapi.capture.Capture(config, tmp_path)
    except ConfigurationException as exp:
        logger.critical(exp)
        sys.exit(1)

    capture.setup(platform.indicate_recording)

    triggers.init(config, trigger_callback)
    triggers.setup()

    pHandler.setup()
    platform.setup()

    logger.info("Checking Internet Connection ...")
    while not internet_on():
        time.sleep(1)

    try:
        token = Token(config['alexa'])

        if not str(token):
            raise RuntimeError
Exemple #4
0
	for sig in (signal.SIGABRT, signal.SIGILL, signal.SIGINT, signal.SIGSEGV, signal.SIGTERM):
		signal.signal(sig, cleanup)

	if event_commands['startup']:
		subprocess.Popen(event_commands['startup'], shell=True, stdout=subprocess.PIPE)

	try:
		capture = alexapi.capture.Capture(config, tmp_path)
	except ConfigurationException as exp:
		logger.critical(exp)
		sys.exit(1)

	capture.setup(platform.indicate_recording)

	triggers.init(config, trigger_callback)
	triggers.setup()

	pHandler.setup()
	platform.setup()

	logger.info("Checking Internet Connection ...")
	while not internet_on():
		time.sleep(1)

	try:
		token = Token(config['alexa'])

		if not str(token):
			raise RuntimeError