test file to pipe from one py that reads chat stream to second py that sends keys--need to pop more often from sender
parent
8bbf2dd89c
commit
b476de0ea0
|
|
@ -0,0 +1 @@
|
|||
pyautogui
|
||||
|
|
@ -0,0 +1,28 @@
|
|||
import argparse
|
||||
import os
|
||||
from time import sleep
|
||||
|
||||
def main():
|
||||
args = get_args()
|
||||
with open(args.p, "r") as f:
|
||||
f.seek(0, os.SEEK_END)
|
||||
while True:
|
||||
line = f.readline()
|
||||
if not line:
|
||||
sleep(0.1)
|
||||
continue
|
||||
if line[0] == "T":
|
||||
for char in args.b:
|
||||
print(char)
|
||||
else:
|
||||
print("")
|
||||
|
||||
|
||||
def get_args():
|
||||
ap = argparse.ArgumentParser()
|
||||
ap.add_argument("-p", type=str, help="path to write out to", default="/tmp/cbappend.both.txt")
|
||||
ap.add_argument("-b", type=str, help="keys to send while on", default="a")
|
||||
return ap.parse_args()
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
|
|
@ -1,13 +1,21 @@
|
|||
#! /bin/bash
|
||||
|
||||
set -e
|
||||
set -o pipefail
|
||||
|
||||
cleanup() {
|
||||
kill -9 $(jobs -p) || true
|
||||
}
|
||||
trap cleanup EXIT
|
||||
|
||||
python3 ./state_to_buttons.py &
|
||||
|
||||
(
|
||||
for j in `seq 1 10`; do
|
||||
for i in `seq 1 10`; do
|
||||
echo $i
|
||||
true || printf "$j/$i " >&2
|
||||
if ((i%j==0)); then
|
||||
sleep $j
|
||||
fi
|
||||
done
|
||||
while echo ""; do
|
||||
if [ 0 == $((RANDOM%4)) ]; then
|
||||
sleep 3
|
||||
fi
|
||||
date >&2
|
||||
done
|
||||
) | python3 ./stream_to_state.py
|
||||
) | python3 ./stream_to_state.py
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue