Created
March 9, 2018 16:31
-
-
Save wilm0x42/312d69674605debe8d54a2c8c43fc384 to your computer and use it in GitHub Desktop.
Bash script to assist in memorizing scripts for plays
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
if [ $# -lt 1 ]; then | |
echo "Usage: linerunner.sh <script>" | |
exit 0 | |
fi | |
if [ -d work ]; then | |
echo -n | |
else | |
mkdir work | |
fi | |
cat $1 > work/lines | |
curLine=0 | |
cd work | |
while [ $(wc -l lines | cut -d" " -f1) -ge $curLine ]; do | |
curLine=$(($curLine+1)) | |
l=$(head lines --lines=$curLine | tail --lines=1) | |
if [ -z "$l" ]; then | |
continue; | |
fi | |
if [ $(echo "$l" | cut -c1) == "_" ]; then | |
read input | |
if [ $input ]; then | |
echo "$l" | cut -c2- | |
read delay | |
fi | |
continue; | |
fi | |
echo "" | |
echo "$l" | |
pico2wave -w curline.wav "$l" | |
if [ $mute ]; then | |
if [ $mute == 1 ]; then | |
pico2wave -w curline.wav "." | |
fi | |
fi | |
mpv curline.wav --no-terminal | |
sleep 0.4; | |
done | |
cd .. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
@Kate1776
Here's the play we're doing, formatted to work with this script: