mirror of
https://github.com/KrumpetPirate/AAXtoMP3.git
synced 2024-11-17 18:58:58 +01:00
check for GNU sed, recommend gnu-sed for mac os x if missing
This commit is contained in:
parent
4040fb7ab9
commit
35308ccb11
14
AAXtoMP3
14
AAXtoMP3
@ -146,6 +146,16 @@ if ! [[ $(type -P "$GREP") ]]; then
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# -----
|
||||
# Detect which annoying version of sed we have
|
||||
SED=$(sed --version 2>&1 | $GREP -q GNU && echo "sed" || echo "gsed")
|
||||
if ! [[ $(type -P "$SED") ]]; then
|
||||
echo "$SED (GNU sed) is not in your PATH"
|
||||
echo "Without it, this script will break."
|
||||
echo "On macOS, you may want to try: brew install gnu-sed"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# -----
|
||||
# Detect ffmpeg and ffprobe
|
||||
if [[ "x$(type -P ffmpeg)" == "x" ]]; then
|
||||
@ -296,7 +306,7 @@ get_metadata_value() {
|
||||
local key
|
||||
key="$1"
|
||||
# Find the key in the meta data file # Extract field value # Remove the following /'s "(Unabridged) <blanks> at start end and multiples.
|
||||
echo "$($GREP --max-count=1 --only-matching "${key} *: .*" "$metadata_file" | cut -d : -f 2- | sed -e 's#/##g;s/ (Unabridged)//;s/^[[:blank:]]\+//g;s/[[:blank:]]\+$//g' | sed 's/[[:blank:]]\+/ /g')"
|
||||
echo "$($GREP --max-count=1 --only-matching "${key} *: .*" "$metadata_file" | cut -d : -f 2- | $SED -e 's#/##g;s/ (Unabridged)//;s/^[[:blank:]]\+//g;s/[[:blank:]]\+$//g' | $SED 's/[[:blank:]]\+/ /g')"
|
||||
}
|
||||
|
||||
# -----
|
||||
@ -325,7 +335,7 @@ do
|
||||
save_metadata "${aax_file}"
|
||||
genre=$(get_metadata_value genre)
|
||||
artist=$(get_metadata_value artist)
|
||||
title=$(get_metadata_value title | sed 's/'\:'/'-'/g' | sed 's/- /-/g' | xargs -0)
|
||||
title=$(get_metadata_value title | $SED 's/'\:'/'-'/g' | $SED 's/- /-/g' | xargs -0)
|
||||
if [ "x${targetdir}" != "x" ] ; then
|
||||
output_directory="${targetdir}/${genre}/${artist}/${title}"
|
||||
else
|
||||
|
Loading…
Reference in New Issue
Block a user