Support filenames with spaces. Bash is magic sometimes.
parent
af3ca28430
commit
19a2dd8bb8
|
|
@ -33,6 +33,12 @@ function v2gif {
|
||||||
# Parse the options
|
# Parse the options
|
||||||
local args=$(getopt -l "alert:" -l "lossy:" -l "width:" -l del,delete -l high -l tag -l "fps:" -l webm -o "a:l:w:f:dhmt" -- "$@")
|
local args=$(getopt -l "alert:" -l "lossy:" -l "width:" -l del,delete -l high -l tag -l "fps:" -l webm -o "a:l:w:f:dhmt" -- "$@")
|
||||||
|
|
||||||
|
if [ $? -ne 0 ]; then
|
||||||
|
echo 'Terminating...' >&2
|
||||||
|
return 2
|
||||||
|
fi
|
||||||
|
|
||||||
|
eval set -- "$args"
|
||||||
local use_gifski=""
|
local use_gifski=""
|
||||||
local opt_del_after=""
|
local opt_del_after=""
|
||||||
local maxsize=""
|
local maxsize=""
|
||||||
|
|
@ -45,7 +51,6 @@ function v2gif {
|
||||||
local fps=""
|
local fps=""
|
||||||
local make_webm=""
|
local make_webm=""
|
||||||
local alert=5000
|
local alert=5000
|
||||||
eval set -- "$args"
|
|
||||||
while [ $# -ge 1 ]; do
|
while [ $# -ge 1 ]; do
|
||||||
case "$1" in
|
case "$1" in
|
||||||
--)
|
--)
|
||||||
|
|
@ -100,10 +105,7 @@ function v2gif {
|
||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
|
|
||||||
# Done Parsing, all that's left are the filenames
|
if [[ -z "$*" ]]; then
|
||||||
local movies="$*"
|
|
||||||
|
|
||||||
if [[ -z "$movies" ]]; then
|
|
||||||
echo "$(tput setaf 1)No input files given. Example: v2gif file [file...] [-w <max width (pixels)>] [-l <lossy level>] < $(tput sgr 0)"
|
echo "$(tput setaf 1)No input files given. Example: v2gif file [file...] [-w <max width (pixels)>] [-l <lossy level>] < $(tput sgr 0)"
|
||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
|
|
@ -112,7 +114,7 @@ function v2gif {
|
||||||
[[ -z "$giftag" ]] && giftag="-default"
|
[[ -z "$giftag" ]] && giftag="-default"
|
||||||
[[ -z "$giftagopt" ]] && giftag=""
|
[[ -z "$giftagopt" ]] && giftag=""
|
||||||
|
|
||||||
for file in $movies ; do
|
for file ; do
|
||||||
|
|
||||||
local output_file="${file%.*}${giftag}.gif"
|
local output_file="${file%.*}${giftag}.gif"
|
||||||
local del_after=$opt_del_after
|
local del_after=$opt_del_after
|
||||||
|
|
@ -181,6 +183,12 @@ function any2webm() {
|
||||||
# Parse the options
|
# Parse the options
|
||||||
local args=$(getopt -l alert -l "bandwidth:" -l "width:" -l del,delete -l tag -l "fps:" -l webm -o "a:b:w:f:dt" -- "$@")
|
local args=$(getopt -l alert -l "bandwidth:" -l "width:" -l del,delete -l tag -l "fps:" -l webm -o "a:b:w:f:dt" -- "$@")
|
||||||
|
|
||||||
|
if [ $? -ne 0 ]; then
|
||||||
|
echo 'Terminating...' >&2
|
||||||
|
return 2
|
||||||
|
fi
|
||||||
|
|
||||||
|
eval set -- "$args"
|
||||||
local opt_del_after=""
|
local opt_del_after=""
|
||||||
local size=""
|
local size=""
|
||||||
local webmtagopt=""
|
local webmtagopt=""
|
||||||
|
|
@ -189,7 +197,6 @@ function any2webm() {
|
||||||
local fps=""
|
local fps=""
|
||||||
local bandwidth="2M"
|
local bandwidth="2M"
|
||||||
local alert=5000
|
local alert=5000
|
||||||
eval set -- "$args"
|
|
||||||
while [ $# -ge 1 ]; do
|
while [ $# -ge 1 ]; do
|
||||||
case "$1" in
|
case "$1" in
|
||||||
--)
|
--)
|
||||||
|
|
@ -232,10 +239,7 @@ function any2webm() {
|
||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
|
|
||||||
# Done Parsing, all that's left are the filenames
|
if [[ -z "$*" ]]; then
|
||||||
local movies="$*"
|
|
||||||
|
|
||||||
if [[ -z "$movies" ]]; then
|
|
||||||
echo "$(tput setaf 1)No input files given. Example: any2webm file [file...] [-w <max width (pixels)>] < $(tput sgr 0)"
|
echo "$(tput setaf 1)No input files given. Example: any2webm file [file...] [-w <max width (pixels)>] < $(tput sgr 0)"
|
||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
|
|
@ -244,7 +248,7 @@ function any2webm() {
|
||||||
[[ -z "$webmtag" ]] && webmtag="-default"
|
[[ -z "$webmtag" ]] && webmtag="-default"
|
||||||
[[ -z "$webmtagopt" ]] && webmtag=""
|
[[ -z "$webmtagopt" ]] && webmtag=""
|
||||||
|
|
||||||
for file in $movies ; do
|
for file ; do
|
||||||
|
|
||||||
local output_file="${file%.*}${webmtag}.webm"
|
local output_file="${file%.*}${webmtag}.webm"
|
||||||
local del_after=$opt_del_after
|
local del_after=$opt_del_after
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue