Skip to content
This repository has been archived by the owner on Feb 9, 2023. It is now read-only.

Commit

Permalink
Modify daemon-mode settings
Browse files Browse the repository at this point in the history
  • Loading branch information
Michael Pemberton committed Aug 5, 2018
1 parent b634c92 commit 1cf3d1e
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions src/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,13 @@ def process_event(assistant, event):
elif event.type == EventType.ON_CONVERSATION_TURN_STARTED:
status_ui.status('listening')

elif event.type == EventType.ON_ALERT_STARTED and event.args:
logging.warning('An alert just started, type = ' + str(event.args['alert_type']))
assistant.stop_conversation()

elif event.type == EventType.ON_ALERT_FINISHED and event.args:
logging.warning('An alert just finished, type = ' + str(event.args['alert_type']))

elif event.type == EventType.ON_RECOGNIZING_SPEECH_FINISHED and event.args:

_cancelAction = False
Expand Down Expand Up @@ -254,7 +261,7 @@ def main():
help='Maximum LED brightness')
parser.add_argument('--brightness-min', default=1,
help='Minimum LED brightness')
parser.add_argument('-d', '--daemon', action='store_false',
parser.add_argument('-d', '--daemon', action='store_true',
help='Daemon Mode')

args = parser.parse_args()
Expand All @@ -267,7 +274,7 @@ def main():
credentials = aiy.assistant.auth_helpers.get_assistant_credentials()
model_id, device_id = aiy.assistant.device_helpers.get_ids_for_service(credentials)

if args.daemon is True:
if args.daemon is True or sys.stdout.isatty() is not True:
_podCatcher.start()
else:
logging.info("Starting in non-daemon mode")
Expand Down

0 comments on commit 1cf3d1e

Please sign in to comment.