mirror of
https://github.com/amiaopensource/ffmprovisr.git
synced 2024-11-10 07:27:23 +01:00
New version using getopts
... as in the other amiaopensource repository.
This commit is contained in:
parent
3ac0e21659
commit
94b0690594
@ -38,17 +38,15 @@ EOF
|
|||||||
}
|
}
|
||||||
|
|
||||||
while getopts ":hi:m:" opt; do
|
while getopts ":hi:m:" opt; do
|
||||||
case $opt in
|
case "${opt}" in
|
||||||
h) _output_help ;;
|
h) _output_help ;;
|
||||||
i) input_file=$OPTARG ;;
|
i) input_file=$OPTARG ;;
|
||||||
m) input_hash=$OPTARG ;;
|
m) input_hash=$OPTARG ;;
|
||||||
*) echo "bad option -${OPTARG}" ; _output_prompt ;;
|
*) echo -e "${RED}Error:${NC }bad option -${OPTARG}" ; _output_prompt ;;
|
||||||
:) echo "Option -${OPTARG} requires an argument" ; _output_prompt ;;
|
:) echo -e "${RED}Error:${NC} option -${OPTARG} requires an argument" ; _output_prompt ;;
|
||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
|
|
||||||
[ -z "$@" ] && _output_prompt
|
|
||||||
|
|
||||||
echo -e "${BLUE}Please wait...${NC}"
|
echo -e "${BLUE}Please wait...${NC}"
|
||||||
unset md5_tmp
|
unset md5_tmp
|
||||||
if [[ $OSTYPE = "cygwin" ]]; then
|
if [[ $OSTYPE = "cygwin" ]]; then
|
||||||
@ -57,9 +55,7 @@ else
|
|||||||
md5_tmp="${HOME}/$(basename ${input_hash}).tmp"
|
md5_tmp="${HOME}/$(basename ${input_hash}).tmp"
|
||||||
fi
|
fi
|
||||||
$(ffmpeg -i ${input_file} -loglevel 0 -f framemd5 -an ${md5_tmp})
|
$(ffmpeg -i ${input_file} -loglevel 0 -f framemd5 -an ${md5_tmp})
|
||||||
if [[ ! -f ${md5_tmp} ]]; then
|
[[ ! -f ${md5_tmp} ]] && _output_prompt
|
||||||
echo -e "${RED}ERROR:${NC} '$(basename ${input_file})' is not an audio-visual file."
|
|
||||||
_output_prompt
|
|
||||||
fi
|
fi
|
||||||
old_file=$(grep -v '^#' ${input_hash})
|
old_file=$(grep -v '^#' ${input_hash})
|
||||||
tmp_file=$(grep -v '^#' ${md5_tmp})
|
tmp_file=$(grep -v '^#' ${md5_tmp})
|
||||||
|
Loading…
Reference in New Issue
Block a user