fix: file cleanup

This commit is contained in:
Vincent Riquer 2025-01-28 23:28:11 +01:00
parent 9b8113fdff
commit 60d259b200
5 changed files with 11 additions and 11 deletions

View File

@ -153,13 +153,13 @@ decodeFile() {
done done
) )
status 0 status 0
cleanup $tmpfile.wav
EOInsert EOInsert
) )
progressSpin progressSpin
fi fi
if (( sox_needed )) if (( sox_needed ))
then then
cleanup="$tempdir/$tmpfile"
decodeSox "$tempdir/$tmpfile.wav" decodeSox "$tempdir/$tmpfile.wav"
if ! soxtaskid=$( if ! soxtaskid=$(
Select tasks id <<<"key = $tmpfile" Select tasks id <<<"key = $tmpfile"
@ -183,7 +183,7 @@ decodeFile() {
) )
requires $decodetaskid requires $decodetaskid
status 0 status 0
cleanup $cleanup cleanup $tmpfile.wav
EOInsert EOInsert
) )
progressSpin progressSpin

View File

@ -65,7 +65,6 @@ encodeFile::mp3() {
echo "cmd_arg$key $cleanedopts" echo "cmd_arg$key $cleanedopts"
done done
) )
cleanup $tempdir/$tmpfile.wav
source_file $fileid source_file $fileid
status 0 status 0
rename_pattern ${destinationrenamepath[$destination]}/${destinationrename[$destination]} rename_pattern ${destinationrenamepath[$destination]}/${destinationrename[$destination]}

View File

@ -33,7 +33,6 @@ encodeFile::opus() {
echo "cmd_arg$key $cleanedopts" echo "cmd_arg$key $cleanedopts"
done done
) )
cleanup $tempdir/$tmpfile.wav
source_file $fileid source_file $fileid
status 0 status 0
rename_pattern ${destinationrenamepath[$destination]}/${destinationrename[$destination]} rename_pattern ${destinationrenamepath[$destination]}/${destinationrename[$destination]}

View File

@ -29,7 +29,6 @@ encodeFile::vorbis() {
echo "cmd_arg$key ${oggencopts[key]}" echo "cmd_arg$key ${oggencopts[key]}"
done done
) )
cleanup $tempdir/$tmpfile.wav
source_file $fileid source_file $fileid
status 0 status 0
rename_pattern ${destinationrenamepath[$destination]}/${destinationrename[$destination]} rename_pattern ${destinationrenamepath[$destination]}/${destinationrename[$destination]}

View File

@ -44,13 +44,13 @@ cleaner() {
" FROM tasks" \ " FROM tasks" \
" WHERE id=$taskid" \ " WHERE id=$taskid" \
" )," \ " )," \
" fat32compat=(" \ " fat32compat=(" \
" SELECT fat32compat" \ " SELECT fat32compat" \
" FROM tasks" \ " FROM tasks" \
" WHERE id=$taskid" \ " WHERE id=$taskid" \
" )," \ " )," \
" ascii=(" \ " ascii=(" \
" SELECT ascii" \ " SELECT ascii" \
" FROM tasks" \ " FROM tasks" \
" WHERE id=$taskid" \ " WHERE id=$taskid" \
" )" \ " )" \
@ -60,9 +60,12 @@ cleaner() {
count=$(Select tasks required_by <<<"id = $taskid") count=$(Select tasks required_by <<<"id = $taskid")
if (( count == 0 )) if (( count == 0 ))
then then
rm -f "$cleanup" [[ -n "$cleanup" ]] && rm -f "$tempdir/$cleanup"
Delete tasks <<<"id = $taskid"
unset finishedtasks[key]
else
Update tasks status 4 \
<<<"id = $taskid"
fi fi
Delete tasks <<<"id = $taskid"
unset finishedtasks[key]
done done
} }