-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathespres_o
53 lines (37 loc) · 2.6 KB
/
espres_o
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
#!/bin/bash
#You will need to change the filepaths!
#This is the watched file where output from whisper realtime is written
while inotifywait -rq -qq -e modify "/home/john/coqui/rtwhisp/whisper_real_time/testing.txt"
#After a write to the watched file, the last 15 lines are written to receiving.txt
do echo "$(tail -n 15 /home/john/coqui/rtwhisp/whisper_real_time/testing.txt)" >> /home/john/coqui/rtwhisp/whisper_real_time/receiving.txt
#This Line selects the language conversion and writes it to receivingtrans
#echo "argos-translate --from-lang pt --to-lang en \"" > /home/john/coqui/rtwhisp/whisper_real_time/receivingtrans.txt
#This Line simply selects an opposite language conversion
echo "argos-translate --from-lang en --to-lang pt \"" > /home/john/coqui/rtwhisp/whisper_real_time/receivingtrans.txt
#Combine the two previous lines into one
cat /home/john/coqui/rtwhisp/whisper_real_time/receivingtrans.txt /home/john/coqui/rtwhisp/whisper_real_time/receiving.txt > /home/john/coqui/rtwhisp/whisper_real_time/receivingfinal.txt
#This cp may be unnecessary
cp /home/john/coqui/rtwhisp/whisper_real_time/receivingfinal.txt /home/john/coqui/rtwhisp/whisper_real_time/receivingexec.txt
#clear any weird stuff in these files
paste -sd "" /home/john/coqui/rtwhisp/whisper_real_time/receivingexec.txt > /home/john/coqui/rtwhisp/whisper_real_time/receivingexec2.txt
paste -sd "" /home/john/coqui/rtwhisp/whisper_real_time/receivingexec2.txt > /home/john/coqui/rtwhisp/whisper_real_time/receivingexec3.txt
#Add a "
echo '"' 1>| /home/john/coqui/rtwhisp/whisper_real_time/receivingexec1.txt
> /home/john/coqui/rtwhisp/whisper_real_time/receivingexec4.txt
#Combine the final cmd string
cat /home/john/coqui/rtwhisp/whisper_real_time/receivingexec3.txt /home/john/coqui/rtwhisp/whisper_real_time/receivingexec1.txt > /home/john/coqui/rtwhisp/whisper_real_time/receivingexec4.txt
#make the file executable and run
var2=$(/home/john/offline_sst/receivingexec4.txt)
echo $var2 >> /home/john/offline_sst/receivingdisplay.txt
sed -e 's/\. */.\n/g' -e 's/\.$/.\n/g' /home/john/offline_sst/receivingdisplay.txt
#clean all the files except exec1, no need
echo “” > /home/john/offline_sst/receiving.txt
echo “” > /home/john/offline_sst/testing.txt
echo “” > /home/john/offline_sst/receivingtrans.txt
echo “” > /home/john/offline_sst/receivingfinal.txt
echo “” > /home/john/offline_sst/receivingexec.txt
echo “” > /home/john/offline_sst/receivingexec2.txt
echo “” > /home/john/offline_sst/receivingexec3.txt
echo “” > /home/john/offline_sst/receivingexec4.txt
echo “” > /home/john/offline_sst/receivingdisplay.txt
done