dam/src/med_integrity
2018-12-27 22:23:50 -05:00

26 lines
650 B
Bash

#!/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 fileList=(${@})
for file in ${fileList[@]}; do
flac -wst "${file}" >${STDERR} 2>&1
[[ $? -eq 0 ]] || { echo "[>>>>>>] Error reported"; cat ${STDERR}; local ERR=true; }
done
echo >${STDERR}
[[ "${ERR}" == "true" ]] && { _msg EXEC "Integrity check completed with errors"; _msg WARN; return 1; } || { _msg EXEC "Integrity check completed succesfully"; _msg OK; return 0; }
}