desbma/GoogleSpeech

Is there a way to run this as a root user?

deltabravozulu opened this issue · 1 comments

I seem to be unable to run this as root. Use case: I share a .bashrc with my root account. I wanted to have it announce when a switch is made, but it doesn't work.

sudo google_speech -l en "hi"
Playing speech segment (en): 'hi'
Home directory not accessible: Permission denied
Home directory not accessible: Permission denied
sox WARN alsa: can't encode 0-bit Unknown or not applicable

If I try to use my user account, it results in a similar problem:

$ sudo -H -u username google_speech -l en "hi"
Playing speech segment(en): 'hi'
sox WARN alsa: can't encode 0-bit Unknown or not applicable

google_speech needs a writable cache dir which would be /root/.cache for root.

It also needs a way to play audio, which is though pulseaudio in most systems, which is only running for user sessions, not root.

There is probably a way to run pulseaudio for the root user, but this is highly discouraged in their documentation, and it's a bad idea to do multimedia stuff as root anyway.