[med_integrity] Audio file integrity checker

[import_src] Checks importing audio for errors
This commit is contained in:
ayakael 2018-12-26 20:56:27 -05:00
parent c66412f9aa
commit c2938037e6
No known key found for this signature in database
GPG key ID: 575626A4AE5F4026
2 changed files with 30 additions and 0 deletions

View file

@ -30,10 +30,16 @@ import_src() {
echo "Processing audio files"
case ${SOURCE} in
FLAC)
chk_integrity ${fileList[@]} >${STDERR} 2>&1
[[ $? -eq 0 ]] || return 4
gen_image "${TRACK_DIR}/flac" $(printf "%s\t" ${fileList[@]})
local EXIT="$?"
[[ $? -eq 0 ]] || return 3
;;
CUETOOLS|EAC)
chk_integrity "${TRACK_DIR}/flac" >${STDERR} 2>&1
[[ $? -eq 0 ]] || return 4
;;
esac

24
src/med_integrity Normal file
View file

@ -0,0 +1,24 @@
#!/bin/bash
# doc med_integrity {
#
# DESCRIPTION
# med_integrity - Checks integrity of audio files
#
# USAGE
# med_integrity </path/to/audio/file/1> </path/to/audio/file/2> <...>
#
# DEPENDENCIES bunc/src/*
#
# }
med_integrity() {
local FILE="${1}"
for file in ${fileList[@]}; do
flac -wst "${file}" >${STDERR} 2>&1
local EXIT=$?
[[ $? -eq 0 ]] || { echo "[>>>>>>] Error reported"; cat ${STDERR}; local ERR=true; }
done
[[ "${ERR}" == "true" ]] && { _msg EXEC "Integrity check completed with errors"; _msg WARN; return 1; } || { _msg EXEC "Integrity check completed succesfully"; _msg OK; return 0; }
}