mirror of
https://github.com/KrumpetPirate/AAXtoMP3.git
synced 2024-11-18 03:08:57 +01:00
read -r, trap and cleanup
This commit is contained in:
parent
69c1c2e77e
commit
f5c09d7270
@ -7,6 +7,8 @@ if ! command -v ffmpeg 2> /dev/null ; then
|
|||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
trap 'rm -f "tmp.txt"' EXIT TERM
|
||||||
|
|
||||||
while [ $# -gt 0 ]; do
|
while [ $# -gt 0 ]; do
|
||||||
FILE="$1"
|
FILE="$1"
|
||||||
echo "$(date "+%F %T%z") Decoding ${FILE} with AUTHCODE ${AUTHCODE}..."
|
echo "$(date "+%F %T%z") Decoding ${FILE} with AUTHCODE ${AUTHCODE}..."
|
||||||
@ -30,8 +32,8 @@ while [ $# -gt 0 ]; do
|
|||||||
set -x
|
set -x
|
||||||
while read -r first _ _ start _ end; do
|
while read -r first _ _ start _ end; do
|
||||||
if [[ "${first}" = "Chapter" ]]; then
|
if [[ "${first}" = "Chapter" ]]; then
|
||||||
read
|
read -r
|
||||||
read _ _ chapter
|
read -r _ _ chapter
|
||||||
ffmpeg -v error -stats -i "${OUTPUT}.mp3" -ss "${start%?}" -to "${end}" -acodec copy "${OUTPUT} - ${chapter}.mp3" < /dev/null
|
ffmpeg -v error -stats -i "${OUTPUT}.mp3" -ss "${start%?}" -to "${end}" -acodec copy "${OUTPUT} - ${chapter}.mp3" < /dev/null
|
||||||
mv "${OUTPUT} - ${chapter}.mp3" "${OUTPUT_DIR}"
|
mv "${OUTPUT} - ${chapter}.mp3" "${OUTPUT_DIR}"
|
||||||
set +x
|
set +x
|
||||||
|
Loading…
Reference in New Issue
Block a user