This commit is contained in:
Vincent Riquer 2013-04-05 13:52:27 +02:00
parent 6297dd6af7
commit 89f16624d7

63
atom
View File

@ -42,6 +42,8 @@ declare -r \
\ \
oldIFS="$IFS" oldIFS="$IFS"
LC_ALL=C
source $SHAREDIR/id3genres source $SHAREDIR/id3genres
shopt -s extglob shopt -s extglob
@ -1347,15 +1349,15 @@ encodeFile::opus() {
encodeFile::vorbis() { encodeFile::vorbis() {
oggencopts=(oggenc -Q -q ${destinationquality[$destination]}) oggencopts=(oggenc -Q -q ${destinationquality[$destination]})
[ -n "$albumartist" ] && oggencopts+=(-c "ALBUMARTIST=$albumartist") [ -n "$albumartist" ] && oggencopts+=(-c "ALBUMARTIST=$albumartist")
[ -n "$album" ] && oggencopts+=(-l "$album") [ -n "$album" ] && oggencopts+=(-l "$album")
[ -n "$artist" ] && oggencopts+=(-a "$artist") [ -n "$artist" ] && oggencopts+=(-a "$artist")
[ -n "$composer" ] && oggencopts+=(-c "COMPOSER=$composer") [ -n "$composer" ] && oggencopts+=(-c "COMPOSER=$composer")
[ -n "$disc" ] && oggencopts+=(-c "DISCNUMBER=$disc") [ -n "$disc" ] && oggencopts+=(-c "DISCNUMBER=$disc")
[ -n "$genre" ] && oggencopts+=(-G "$genre") [ -n "$genre" ] && oggencopts+=(-G "$genre")
[ -n "$performer" ] && oggencopts+=(-c "PERFORMER=$performer") [ -n "$performer" ] && oggencopts+=(-c "PERFORMER=$performer")
[ -n "$title" ] && oggencopts+=(-t "$title") [ -n "$title" ] && oggencopts+=(-t "$title")
[ -n "$track" ] && oggencopts+=(-N "$track") [ -n "$track" ] && oggencopts+=(-N "$track")
[ -n "$year" ] && oggencopts+=(-d "$year") [ -n "$year" ] && oggencopts+=(-d "$year")
oggencopts+=(-o "$destdir/$destfile.ogg" "$tempdir/$tmpfile.wav") oggencopts+=(-o "$destdir/$destfile.ogg" "$tempdir/$tmpfile.wav")
encodetaskid=$( encodetaskid=$(
Insert tasks <<-EOInsert Insert tasks <<-EOInsert
@ -2142,16 +2144,12 @@ echo -e "\rCreated ${count:-0} tasks for $filecount files (${copies:-0} immediat
concurrency=$(( maxload / 2 )) concurrency=$(( maxload / 2 ))
(( concurrency )) || concurrency=1 (( concurrency )) || concurrency=1
active=0 active=0
#set -x
for (( i=0 ; i < concurrency ; i++ ))
do
master
done
concurrencychange=$(date +%s) concurrencychange=$(date +%s)
starttime=$concurrencychange starttime=$concurrencychange
taskcount=$count taskcount=$count
remaining=$taskcount
failed=0 failed=0
while (( ${#workers[@]} )) while (( remaining && ! quit ))
do do
if read -n 1 -t 0.1 userinput if read -n 1 -t 0.1 userinput
then then
@ -2218,19 +2216,32 @@ do
avgdsec=${avgduration:0:-3} avgdsec=${avgduration:0:-3}
avgdmsec=${avgduration#$avgdsec} avgdmsec=${avgduration#$avgdsec}
fi fi
dran=$(printf %${#taskcount}i ${ran:-0}) fmtload='L:%4.1f/%i'
rtime=$( fmtworkers='W:%i/%i'
printf '%2id %2ih%02im%02is' \ fmtprogress="T:%${#taskcount}i/%i (F:%i) %3i%%"
${days:-0} \ fmttime='%2id %2ih%02im%02is (A:%4.1fs/task)'
${hours:-0} \ eta="ETA:$(
${minutes:-0} \ date -d "${days:-0} days
${seconds:-0} ${hours:-0} hours
) ${minutes:-0} minutes
percent=$(printf %3i $((ran * 100 / taskcount))) ${seconds:-0} seconds" \
echo -en "\rL: $humanload/$maxload" \ +'%d/%m %H:%M:%S'
"W: $active/$concurrency" \ )"
"T: ${dran}/$taskcount (F:$failed) $percent% $rtime" \ printf \
"(A: ${avgdsec:--}.${avgdmsec:--}s/task)" "\r$fmtload $fmtworkers $fmtprogress $fmttime $eta\033[K"\
$humanload \
$maxload \
${active:-0} \
${concurrency:-0} \
${ran:-0} \
${taskcount:-0} \
${failed:-0} \
$(( ran * 100 / taskcount )) \
${days:-0} \
${hours:-0} \
${minutes:-0} \
${seconds:-0} \
${avgdsec:-0}.${avgdmsec:-0}
done done
unset count unset count
@ -2259,7 +2270,7 @@ endtime=$(date +%s)
)) || true )) || true
echo -e "\rRan ${ran:=0} tasks, $failed of which failed, in $days" \ echo -e "\rRan ${ran:=0} tasks, $failed of which failed, in $days" \
"days, $hours hours, $minutes minutes and $seconds seconds." "days, $hours hours, $minutes minutes and $seconds seconds.\033[K"
if [ -n "$quit" ] if [ -n "$quit" ]
then then
@ -2362,7 +2373,7 @@ do
fi fi
read -u4 line read -u4 line
done done
echo $'\r'"$destination: Renamed ${count:-0} files " echo -e $'\r'"$destination: Renamed ${count:-0} files\033[K"
fi fi
unset count unset count
done done