37 lines
840 B
Bash
Executable File
37 lines
840 B
Bash
Executable File
#!/bin/sh
|
|
|
|
OUTPUT_NAME="tc-video"
|
|
|
|
if [ $# -eq 0 ] || [ "$1" = "-h" ]; then
|
|
cat <<EOF
|
|
Usage: ${1##*/} [FILES]
|
|
|
|
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
|
|
exit
|
|
fi
|
|
|
|
_escname () {
|
|
echo "$@" | sed 's|/|\\/|g'
|
|
}
|
|
|
|
SCRIPT_PATH="${0%/*}"
|
|
SCRIPT_NAME="${0##*/}"
|
|
FILELIST=""
|
|
if [ -f "$SCRIPT_PATH/.$SCRIPT_NAME.in" ]; then
|
|
cp -i "$SCRIPT_PATH/.$SCRIPT_NAME.in" "$OUTPUT_NAME"
|
|
for i ; do
|
|
esci="$(_escname "$i")"
|
|
FILELIST="${FILELIST:+$FILELIST -i }'$esci'"
|
|
ex -sc "%s/###FILENAMES/'$esci' ###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
|