Speak sayto bash pipes (#2111)

- Change mycroft-speak & mycroft-say-to to accept bash pipes
- add feature to allow all args to read into message
pull/2115/head
FruityWelsh 2019-05-13 02:29:50 -04:00 committed by Åke
parent b95c8c990b
commit f90e3fbfc7
2 changed files with 9 additions and 3 deletions

View File

@ -21,5 +21,9 @@ DIR="$( pwd )"
# Enter the Mycroft venv
source "$DIR/../venv-activate.sh" -q
# Sets var 1 to stdin if no args were given
set -- "${1:-$(</dev/stdin)}" "${@:2}"
# Send a message to be spoken
output=$(python -m mycroft.messagebus.send "recognizer_loop:utterance" "{\"utterances\": [\"$@\"], \"lang\": \"en-us\"}")
data="$@"
output=$(python -m mycroft.messagebus.send "recognizer_loop:utterance" "{\"utterances\": [\"$data\"], \"lang\": \"en-us\"}")

View File

@ -13,13 +13,15 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
SOURCE="${BASH_SOURCE[0]}"
cd -P "$( dirname "$SOURCE" )"
DIR="$( pwd )"
# Sets var 1 to stdin if no args were given
set -- "${1:-$(</dev/stdin)}" "${@:2}"
# Enter the Mycroft venv
source "$DIR/../venv-activate.sh" -q
# Send a message to be spoken
output=$(python -m mycroft.messagebus.send "speak" "{\"utterance\": \"$@\"}")
data="$@"
output=$(python -m mycroft.messagebus.send "speak" "{\"utterance\": \"$data\"}")