-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathbatch_transcode_ofcom_ffv1_v210_start.sh
More file actions
executable file
·46 lines (36 loc) · 1.9 KB
/
batch_transcode_ofcom_ffv1_v210_start.sh
File metadata and controls
executable file
·46 lines (36 loc) · 1.9 KB
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
#!/bin/bash -x
# =========================================================
# Launcher script for H22 batch_transcode_h22_ffv1_v210.py
# =========================================================
date_FULL=$(date +'%Y-%m-%d - %T')
# Local variables from environmental vars
transcode_path1="${QNAP08_AUTOMATION}"
dump_to="$GIT_TRANSCODE"
log_path="${SCRIPT_LOG}batch_transcode_ofcom_ffv1_v210.log"
python_script="$SCRIPT_FFV1_V210_OFCOM"
function control {
boole=$(cat "${CONTROL_JSON}" | grep "power_off_all" | awk -F': ' '{print $2}')
if [ "$boole" = false, ] ; then
echo "Control json requests script exit immediately" >> "${LOG}"
echo 'Control json requests script exit immediately'
exit 0
fi
}
# Control check inserted into code
control
# replace list to ensure clean data
rm "${dump_to}batch_transcode_ofcom_ffv1_v210_dump_text.txt"
touch "${dump_to}batch_transcode_ofcom_ffv1_v210_dump_text.txt"
# Command to build MKV list from two v210 paths containing multiple archive folders
find "${transcode_path1}" -maxdepth 1 -mindepth 1 -name "*.mkv" -mmin +30 >> "${dump_to}batch_transcode_ofcom_ffv1_v210_dump_text.txt"
if [ -s "${dump_to}batch_transcode_ofcom_ffv1_v210_dump_text.txt" ]
then
echo " ========================= SHELL SCRIPT LAUNCH ========================== $date_FULL" >> "${log_path}"
echo " == Start batch_transcode_h22_ffv1_v210 in $transcode_path1 and $transcode_path2 == " >> "${log_path}"
echo " == Shell script creating dump_text.txt output for parallel launch of Python scripts == " >> "${log_path}"
echo " == Launching GNU parallel to run muliple Python3 scripts for encoding == " >> "${log_path}"
grep '/mnt/' "${dump_to}batch_transcode_ofcom_ffv1_v210_dump_text.txt" | sort -u | parallel --jobs 3 "${PY3_ENV} $python_script {}"
echo " ========================= SHELL SCRIPT END ========================== $date_FULL" >> "${log_path}"
else
exit 1
fi