diff --git a/atom b/atom index c42d154..671f4f5 100755 --- a/atom +++ b/atom @@ -974,9 +974,42 @@ decodeMpcdec() { commandline="mpcdec \"$sourcepath/$filename\" \"$tempdir/$tmpfile.wav\"" } -encodeFile::MP3() { - #lame - : +decodeFile() { + if ! decodetaskid=$( + Select tasks id <<<"key = $tmpfile" + ) + then + decodetaskid=$( + Insert tasks <<-EOInsert + key $tmpfile + source_file $fileid + command_line $commandline + status 0 + cleanup $tempdir/$tmpfile.wav + EOInsert + ) + progressSpin + fi + if (( sox_needed )) + then + decodeSox "$tempdir/$tmpfile.wav" + if ! soxtaskid=$( + Select tasks id <<<"key = $tmpfile" + ) + then + soxtaskid=$( + Insert tasks <<-EOInsert + key $tmpfile + source_file $fileid + command_line $commandline + requires $decodetaskid + status 0 + cleanup $tempdir/$tmpfile.wav + EOInsert + ) + progressSpin + fi + fi } copyFile() { @@ -997,11 +1030,6 @@ copyFile() { progressSpin } -encodeFile::Ogg() { - #oggenc - : -} - transcodeFile() { #sox -> wav for format in $targets["format"] @@ -1376,36 +1404,17 @@ do esac ;; esac - if ! decodetaskid=$( - Select tasks id <<<"key = $tmpfile" - ) + if ! (( copied )) then - decodetaskid=$( - Insert tasks <<-EOInsert - key $tmpfile - command_line $commandline - status 0 - EOInsert - ) - progressSpin + decodeFile fi - if (( sox_needed )) + getDestDir + getDestFile + if (( copied )) then - decodeSox "$tempdir/$tmpfile.wav" - if ! soxtaskid=$( - Select tasks id <<<"key = $tmpfile" - ) - then - soxtaskid=$( - Insert tasks <<-EOInsert - key $tmpfile - command_line $commandline - requires $decodetaskid - status 0 - EOInsert - ) - progressSpin - fi + copyFile + else + encodeFile::${destinationformat[$destination]} fi unset \ album \ @@ -1415,6 +1424,7 @@ do channels \ commandline \ composer \ + copied \ decodetaskid \ destfileid \ destination \