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