mirror of
https://github.com/KrumpetPirate/AAXtoMP3.git
synced 2024-11-18 03:08:57 +01:00
Check for GNU grep because script fails with BSD
This commit is contained in:
parent
05274634d4
commit
9cb3e52697
16
AAXtoMP3
16
AAXtoMP3
@ -2,6 +2,19 @@
|
|||||||
|
|
||||||
set -o errexit -o noclobber -o nounset -o pipefail
|
set -o errexit -o noclobber -o nounset -o pipefail
|
||||||
|
|
||||||
|
|
||||||
|
# Check for GNU grep
|
||||||
|
grep_version=$(grep -V)
|
||||||
|
|
||||||
|
if [[ ! "$grep_version" =~ "GNU" ]]
|
||||||
|
then
|
||||||
|
echo "This script requires GNU grep"
|
||||||
|
echo "exiting"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "starting"
|
||||||
|
|
||||||
codec=libmp3lame
|
codec=libmp3lame
|
||||||
extension=mp3
|
extension=mp3
|
||||||
mode=chaptered
|
mode=chaptered
|
||||||
@ -36,6 +49,7 @@ debug() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
trap 'rm -r -f "${working_directory}"' EXIT
|
trap 'rm -r -f "${working_directory}"' EXIT
|
||||||
|
|
||||||
working_directory=`mktemp -d 2>/dev/null || mktemp -d -t 'mytmpdir'`
|
working_directory=`mktemp -d 2>/dev/null || mktemp -d -t 'mytmpdir'`
|
||||||
metadata_file="${working_directory}/metadata.txt"
|
metadata_file="${working_directory}/metadata.txt"
|
||||||
|
|
||||||
@ -48,7 +62,7 @@ save_metadata() {
|
|||||||
get_metadata_value() {
|
get_metadata_value() {
|
||||||
local key
|
local key
|
||||||
key="$1"
|
key="$1"
|
||||||
normalize_whitespace "$(grep --max-count=1 --only-matching "${key} *: .*" "$metadata_file" | cut -d : -f 2 | sed -e 's#/##g;s/ (Unabridged)//' | tr -s '[:blank:]' ' ')"
|
normalize_whitespace "$(grep --max-count=1 --only-matching "${key} *: .*" "$metadata_file" | cut -d : -f 2 | sed -e 's#/##g;s/ (Unabridged)//' | tr -s '[:blank:]' ' ')" || echo "failed normalizing"
|
||||||
}
|
}
|
||||||
|
|
||||||
get_bitrate() {
|
get_bitrate() {
|
||||||
|
Loading…
Reference in New Issue
Block a user