Update check_framemd5.sh

This commit is contained in:
Reto Kromer 2016-10-08 11:49:07 +02:00 committed by GitHub
parent 588482ff3b
commit 35d752a229

View File

@ -73,67 +73,3 @@ else
rm "${md5_tmp}" rm "${md5_tmp}"
exit 1 exit 1
fi fi
if [[ "${old_file}" = "${tmp_file}" ]]; then
echo -e "${BLUE}OK${NC} '$(basename ${input_file})' matches '$(basename ${input_hash})'."
rm "${md5_tmp}"
exit 0
else
echo -e "${RED}ERROR:${NC} The following differences were detected between '$(basename ${input_file})' and '$(basename ${input_hash})':"
diff "${input_hash}" "${md5_tmp}"
rm "${md5_tmp}"
exit 1
fi
fi
$(ffmpeg -i ${input_file} -loglevel 0 -f framemd5 -an ${md5_tmp})
if [[ ! -f ${md5_tmp} ]]; then
echo -e "${RED}ERROR:${NC} '$(basename ${input_file})' is not an audio-visual file."
_output_prompt
fi
old_file=$(grep -v '^#' ${input_hash})
tmp_file=$(grep -v '^#' ${md5_tmp})
if [[ "${old_file}" = "${tmp_file}" ]]; then
echo -e "${BLUE}OK${NC} '$(basename ${input_file})' matches '$(basename ${input_hash})'."
rm "${md5_tmp}"
exit 0
else
echo -e "${RED}ERROR:${NC} The following differences were detected between '$(basename ${input_file})' and '$(basename ${input_hash})':"
diff "${input_hash}" "${md5_tmp}"
rm "${md5_tmp}"
exit 1
fi
i) input_file=$OPTARG ;;
c) input_hash=$OPTARG ;;
m) echo "bad option -${OPTARG}" ; _output_prompt ;;
:) echo "Option -${OPTARG} requires an argument" ; _output_prompt ;;
esac
done
[ -z "$@" ] && _output_prompt
echo -e "${BLUE}Please wait...${NC}"
unset md5_tmp
if [[ $OSTYPE = "cygwin" ]]; then
md5_tmp=""${USERPROFILE}/$(basename ${input_hash}).tmp""
else
md5_tmp="${HOME}/$(basename ${input_hash}).tmp"
fi
$(ffmpeg -i ${input_file} -loglevel 0 -f framemd5 -an ${md5_tmp})
if [[ ! -f ${md5_tmp} ]]; then
echo -e "${RED}ERROR:${NC} '$(basename ${input_file})' is not an audio-visual file."
_output_prompt
fi
old_file=$(grep -v '^#' ${input_hash})
tmp_file=$(grep -v '^#' ${md5_tmp})
if [[ "${old_file}" = "${tmp_file}" ]]; then
echo -e "${BLUE}OK${NC} '$(basename ${input_file})' matches '$(basename ${input_hash})'."
rm "${md5_tmp}"
exit 0
else
echo -e "${RED}ERROR:${NC} The following differences were detected between '$(basename ${input_file})' and '$(basename ${input_hash})':"
diff "${input_hash}" "${md5_tmp}"
rm "${md5_tmp}"
exit 1
fi