ambevar-dotfiles/.scripts/tc-video-custom

37 lines
830 B
Plaintext
Raw Normal View History

#!/bin/sh
2013-10-23 20:15:15 +02:00
OUTPUT_NAME="tc-video"
_printhelp()
{
cat <<EOF
Usage: ${1##*/} [FILES]
2013-10-23 20:15:15 +02:00
Create a '$OUTPUT_NAME' script in current folder. The script provides a FFmpeg call
to transcode FILES with some useful options and instructive help.
This script is meant to be easily editable to fit the user needs.
EOF
}
2013-10-23 20:15:15 +02:00
if [ $# -eq 0 ] || [ "$1" = "-h" ]; then
_printhelp "$0"
exit
fi
SCRIPT_PATH="${0%/*}"
SCRIPT_NAME="${0##*/}"
2013-10-23 20:15:15 +02:00
FILELIST=""
if [ -f "$SCRIPT_PATH/.$SCRIPT_NAME.in" ]; then
cp -i "$SCRIPT_PATH/.$SCRIPT_NAME.in" "$OUTPUT_NAME"
for i ; do
2013-12-27 11:17:38 +01:00
FILELIST="${FILELIST:+$FILELIST -i }'$i'"
ex -sc "%s|###FILENAMES|'$i' ###FILENAMES|xit" "$OUTPUT_NAME"
done
ex -sc '%s|###FILELIST|'"$FILELIST"'|xit' "$OUTPUT_NAME"
chmod +x "$OUTPUT_NAME"
else
echo ".$SCRIPT_NAME.in not found!"
fi