docker-android/src/record.sh

48 lines
1.2 KiB
Bash
Raw Normal View History

2017-07-14 19:40:14 +01:00
#!/bin/bash
function start() {
mkdir -p $VIDEO_PATH
2017-10-27 20:02:00 +01:00
name="$(date '+%d_%m_%Y_%H_%M_%S').mp4"
2017-07-14 19:40:14 +01:00
echo "Start video recording"
2017-10-27 20:02:00 +01:00
ffmpeg -video_size 1599x899 -framerate 15 -f x11grab -i $DISPLAY $VIDEO_PATH/$name -y
2017-07-14 19:40:14 +01:00
}
function stop() {
echo "Stop video recording"
2017-10-30 19:42:36 +00:00
kill $(ps -ef | grep [f]fmpeg | awk '{print $2}')
2017-07-14 19:40:14 +01:00
}
function auto_record() {
2017-10-30 19:42:36 +00:00
echo "Auto record: $AUTO_RECORD"
sleep 6
2017-07-14 19:40:14 +01:00
2018-06-20 22:28:41 +01:00
while [ $AUTO_RECORD == true ]; do
2017-10-30 19:42:36 +00:00
# Check if there is test running
no_test=true
while $no_test; do
task=$(curl -s localhost:4723/wd/hub/sessions | jq -r '.value')
if [ "$task" == "" ] || [ "$task" == "[]" ]; then
sleep .5
else
start &
no_test=false
fi
done
2017-07-14 19:40:14 +01:00
2017-10-30 19:42:36 +00:00
# Check if test is finished
while [ $no_test == false ]; do
task=$(curl -s localhost:4723/wd/hub/sessions | jq -r '.value')
if [ "$task" == "" ] || [ "$task" == "[]" ]; then
stop
no_test=true
else
sleep .5
fi
done
done
echo "Auto recording is disabled!"
2017-10-27 20:02:00 +01:00
}
$@