Removed soxi requirement.
parent
8d25557220
commit
7d073a56fd
|
@ -1,6 +1,5 @@
|
||||||
# Required applications
|
# Required applications
|
||||||
|
|
||||||
* soxi
|
|
||||||
* ffmpeg
|
* ffmpeg
|
||||||
|
|
||||||
# Usage
|
# Usage
|
||||||
|
|
|
@ -42,7 +42,6 @@ get_values(){
|
||||||
|
|
||||||
audio_file="$1"
|
audio_file="$1"
|
||||||
time_file="$2"
|
time_file="$2"
|
||||||
total_length=$(soxi -D "${audio_file}" | sed "s/\..*//") # integer values only
|
|
||||||
|
|
||||||
track_number=1
|
track_number=1
|
||||||
|
|
||||||
|
@ -69,7 +68,7 @@ get_values(){
|
||||||
track_number=$(echo $track_number + 1 | bc)
|
track_number=$(echo $track_number + 1 | bc)
|
||||||
done < "${time_file}"
|
done < "${time_file}"
|
||||||
|
|
||||||
echo "$from_s $total_length $title"
|
echo "$from_s $eof_marker $title"
|
||||||
}
|
}
|
||||||
|
|
||||||
run_ffmpeg(){
|
run_ffmpeg(){
|
||||||
|
@ -80,7 +79,11 @@ run_ffmpeg(){
|
||||||
|
|
||||||
LOG_LEVEL="-loglevel error"
|
LOG_LEVEL="-loglevel error"
|
||||||
FROM="-ss $from"
|
FROM="-ss $from"
|
||||||
|
if [ "$duration" = "" ]; then
|
||||||
|
DURATION=""
|
||||||
|
else
|
||||||
DURATION="-t $duration"
|
DURATION="-t $duration"
|
||||||
|
fi
|
||||||
INPUT_FILE="-i $file"
|
INPUT_FILE="-i $file"
|
||||||
OUTPUT_FILE="$final_title"
|
OUTPUT_FILE="$final_title"
|
||||||
|
|
||||||
|
@ -115,7 +118,11 @@ rip(){
|
||||||
track_start_s=$(echo $LINE | cut -d ' ' -f 1)
|
track_start_s=$(echo $LINE | cut -d ' ' -f 1)
|
||||||
track_end_s=$(echo $LINE | cut -d ' ' -f 2)
|
track_end_s=$(echo $LINE | cut -d ' ' -f 2)
|
||||||
track_title=$(echo $LINE | cut -d ' ' -f 3-)
|
track_title=$(echo $LINE | cut -d ' ' -f 3-)
|
||||||
|
if [ "$track_end_s" != "$eof_marker" ]; then
|
||||||
track_duration=$(echo "$track_end_s - $track_start_s" | bc)
|
track_duration=$(echo "$track_end_s - $track_start_s" | bc)
|
||||||
|
else
|
||||||
|
track_duration=""
|
||||||
|
fi
|
||||||
|
|
||||||
run_ffmpeg "${audio_file}" "${track_start_s}" "${track_duration}" "${track_title}.${FORMAT}"
|
run_ffmpeg "${audio_file}" "${track_start_s}" "${track_duration}" "${track_title}.${FORMAT}"
|
||||||
done
|
done
|
||||||
|
@ -168,6 +175,11 @@ if [ "$SIMULATION" != "" ]; then
|
||||||
echo "SIMULATION envvar is set: this is a simulation."
|
echo "SIMULATION envvar is set: this is a simulation."
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# soxi provides the total length of the music file.
|
||||||
|
#which soxi 2>/dev/null
|
||||||
|
#total_length=$(soxi -D "${audio_file}" | sed "s/\..*//") # integer values only
|
||||||
|
eof_marker="END_OF_FILE"
|
||||||
|
|
||||||
case "x-${command}" in
|
case "x-${command}" in
|
||||||
x-show)
|
x-show)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue