40 lines
1.6 KiB
Bash
40 lines
1.6 KiB
Bash
#!/bin/bash
|
|
encodeFile::opus() {
|
|
opusencopts=(${ionice}opusenc --music --quiet)
|
|
opusencopts+=(--bitrate ${destinationquality[$destination]})
|
|
[ -n "${destinationloss["$destination"]}" ] \
|
|
&& opusencopts+=(--expect-loss "${destinationloss["$destination"]}")
|
|
[ -n "$albumartist" ] && opusencopts+=(--comment "ALBUMARTIST=$albumartist")
|
|
[ -n "$album" ] && opusencopts+=(--comment "ALBUM=$album")
|
|
[ -n "$artist" ] && opusencopts+=(--artist "$artist")
|
|
[ -n "$composer" ] && opusencopts+=(--comment "COMPOSER=$composer")
|
|
[ -n "$disc" ] && opusencopts+=(--comment "DISCNUMBER=$disc")
|
|
[ -n "$genre" ] && opusencopts+=(--comment "GENRE=$genre")
|
|
[ -n "$performer" ] && opusencopts+=(--comment "PERFORMER=$performer")
|
|
[ -n "$title" ] && opusencopts+=(--title "$title")
|
|
[ -n "$track" ] && opusencopts+=(--comment "TRACKNUMBER=${track%/*}")
|
|
[ -n "${track#*/}" ] && opusencopts+=(--comment "TRACKTOTAL=${track#*/}")
|
|
[ -n "$year" ] && opusencopts+=(--comment "DATE=$year")
|
|
opusencopts+=("$tempdir/$tmpfile.wav" "$destdir/$destfile.opus")
|
|
encodetaskid=$(
|
|
Insert tasks <<-EOInsert
|
|
key ${fileid}opusenc$destination
|
|
requires ${soxtaskid:-$decodetaskid}
|
|
required ${soxtaskid:-$decodetaskid}
|
|
fileid $destfileid
|
|
filename $destdir/$destfile.ogg
|
|
$(
|
|
for key in ${!opusencopts[@]}
|
|
do
|
|
echo "cmd_arg$key ${opusencopts[key]}"
|
|
done
|
|
)
|
|
cleanup $tempdir/$tmpfile.wav
|
|
source_file $fileid
|
|
status 0
|
|
rename_pattern ${destinationrenamepath[$destination]}/${destinationrename[$destination]}:${destinationfat32compat["$destination"]}
|
|
EOInsert
|
|
)
|
|
progressSpin
|
|
}
|