I realized having to host this potentially indefinitely might not be the best idea, so I am going to shut down this gitea instance eventually.
You’ll have time, at least until the end of 2022, probably longer, but please just get all your stuff somewhere safe in case we ever disappear.
If any of your build scripts rely on my (kageru’s) projects hosted here, check my Github or IEW on Github for encoding projects. If you can’t find what you’re looking there, tell me to migrate it.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

42 lines
1.1 KiB

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

#!/bin/sh
sleep $(dc -e "$RANDOM 1000 / p")
lockfile="/tmp/auto-encode-x264"
if [ -f "$lockfile" ]; then
exit 0
fi
touch "$lockfile"
notify() {
python "$script_dir/notify.py" '171327453212573696' "$1"
}
script=$1
script_dir=$(pwd)
base_dir=$(dirname $script)
done_dir="/home/sftp/kaleido/auto-encode/done"
cd "$base_dir"
if [ ! -f 'settings' ]; then
notify "Could not start encode, expected file settings in `pwd`."
rm "$lockfile"
exit 0
fi
settings=$(cat 'settings')
notify "Starting encode $script."
output_file=$(basename $script .vpy).264
output=$( { nice -n 17 vspipe $(basename $script) -y - | x264 --demuxer y4m - $settings --output-depth 10 --threads 1 -o $output_file; } 2>&1 )
ok=$?
output_filtered=$( echo $output | sed -E 's/(x264)?\s?\[/\n\[/g' | grep -v '
' )
if [ $ok -ne 0 ]; then
notify "Encode $script failed"
notify "$output_filtered"
rm "$lockfile"
exit 0
else
mv "$output_file" "$done_dir"
mv "$script" "$done_dir"
notify "$script successfully encoded."
notify "$output_filtered"
fi
rm -f "$lockfile"
rm -f /tmp/auto-encode