Compare commits

..

No commits in common. "cc1c687118bf68dabc6584d375dafdd9f27d9157" and "b90d4d553af5ff83943786ba7bd8d61abde49a74" have entirely different histories.

5 changed files with 19 additions and 48 deletions

44
atom
View File

@ -64,7 +64,6 @@ help() {
-c <file> Load configuration file <file> -c <file> Load configuration file <file>
-C Dump configuration and exit -C Dump configuration and exit
-l <load> Override max-load -l <load> Override max-load
-f <workers> Use exactly <workers> child processes
-T <seconds> override load-interval -T <seconds> override load-interval
-F <destination> Force re-generation of all files in -F <destination> Force re-generation of all files in
<destination> <destination>
@ -78,7 +77,7 @@ help() {
#parse arguments #parse arguments
OPTERR=0 OPTERR=0
while getopts ':c:Cl:T:F:f:B:ShDq' opt while getopts ':c:Cl:T:F:B:ShDq' opt
do do
case $opt in case $opt in
c) c)
@ -96,9 +95,6 @@ do
F) F)
forceall+=("$OPTARG") forceall+=("$OPTARG")
;; ;;
f)
fixed_workers="$OPTARG"
;;
B) B)
maxbatch="$OPTARG" maxbatch="$OPTARG"
;; ;;
@ -353,7 +349,6 @@ updateMimes
removeObsoleteFiles removeObsoleteFiles
(( cron )) || echo -n 'Gathering files for cleaning...'
echo ' echo '
SELECT COUNT(id) SELECT COUNT(id)
FROM destination_files FROM destination_files
@ -401,7 +396,7 @@ do
then then
echo 'COMMIT;BEGIN TRANSACTION;' >&3 echo 'COMMIT;BEGIN TRANSACTION;' >&3
fi fi
(( cron )) || echo -en "\rClean obsolete data: $(((deleted+removed)*100/removecount))%\033[K" (( cron )) || echo -en "\rClean obsolete data: $(((deleted+removed)*100/removecount))%"
done done
echo 'COMMIT;' >&3 echo 'COMMIT;' >&3
(( cron )) || echo -n $'\r' (( cron )) || echo -n $'\r'
@ -697,35 +692,23 @@ starttime=$concurrencychange
taskcount=$count taskcount=$count
remaining=$taskcount remaining=$taskcount
failed=0 failed=0
echo 'BEGIN TRANSACTION;' >&3
committime=$(date +%s)
while (( (remaining || ${#workers[@]}) && ! quit )) while (( (remaining || ${#workers[@]}) && ! quit ))
do do
if (( $(date +%s) - committime >= 60 ))
then
echo $'COMMIT;\nBEGIN TRANSACTION;' >&3
committime=$(date +%s)
fi
read humanload garbage < /proc/loadavg read humanload garbage < /proc/loadavg
load=${humanload%.*} load=${humanload%.*}
if (( fixed_workers )) if [ -z "$quit" ] \
&& (( ! pause )) \
&& (( $(date +%s)-concurrencychange >= loadinterval ))
then then
concurrency="$fixed_workers" if (( concurrency > 1 )) \
else && (( load > maxload ))
if [ -z "$quit" ] \
&& (( ! pause )) \
&& (( $(date +%s)-concurrencychange >= loadinterval ))
then then
if (( concurrency > 1 )) \ concurrencychange=$(date +%s)
&& (( load > maxload )) (( --concurrency ))
then elif (( load < maxload )) && (( active > concurrency - 1 ))
concurrencychange=$(date +%s) then
(( --concurrency )) concurrencychange=$(date +%s)
elif (( load < maxload )) && (( active > concurrency - 1 )) (( ++concurrency ))
then
concurrencychange=$(date +%s)
(( ++concurrency ))
fi
fi fi
fi fi
checkworkers checkworkers
@ -806,7 +789,6 @@ do
fi fi
fi fi
done done
echo 'COMMIT;' >&3
unset count unset count
endtime=$(date +%s) endtime=$(date +%s)

View File

@ -22,7 +22,7 @@ encodeFile::opus() {
requires ${soxtaskid:-$decodetaskid} requires ${soxtaskid:-$decodetaskid}
required ${soxtaskid:-$decodetaskid} required ${soxtaskid:-$decodetaskid}
fileid $destfileid fileid $destfileid
filename $destdir/$destfile.opus filename $destdir/$destfile.ogg
$( $(
for key in ${!opusencopts[@]} for key in ${!opusencopts[@]}
do do

View File

@ -3,7 +3,7 @@ getFiles() {
scantime=$(date +%s) scantime=$(date +%s)
for prune_expression in "${skippeddirectories[@]}" for prune_expression in "${skippeddirectories[@]}"
do do
prunes+=( -path "$sourcepath$prune_expression" -prune -o ) prunes+="-path $sourcepath$prune_expression -prune -o "
done done
(( cron )) || echo -n "Scanning $sourcepath... " (( cron )) || echo -n "Scanning $sourcepath... "
# We probably have thousands of files, don't waste time on disk writes # We probably have thousands of files, don't waste time on disk writes
@ -56,10 +56,10 @@ getFiles() {
fi fi
progressSpin progressSpin
done < <( done < <(
find "$sourcepath" "${prunes[@]}" -type f -not -name '.*' -printf "%T@ %s %P\n" find "$sourcepath" $prunes -type f -printf "%T@ %s %P\n"
) )
echo 'COMMIT;' >&3 echo 'COMMIT;' >&3
(( cron )) || echo -n $'\r' (( cron )) || echo -n $'\r'
echo "${count:-0} files found, ${new:=0} new or changed."$'\033[K' echo "${count:-0} files found, ${new:=0} new or changed."
unset count unset count
} }

View File

@ -1,5 +1,5 @@
#!/bin/bash #!/bin/bash
getInfosffmpeg_version='ffmpeg-6' getInfosffmpeg_version='ffmpeg-5'
tagreaders+=( "$getInfosffmpeg_version" ) tagreaders+=( "$getInfosffmpeg_version" )
getInfos::ffmpeg() { getInfos::ffmpeg() {
tagreader="$getInfosffmpeg_version" tagreader="$getInfosffmpeg_version"
@ -8,8 +8,7 @@ getInfos::ffmpeg() {
-i "$sourcepath/$filename" 2>&1 \ -i "$sourcepath/$filename" 2>&1 \
|sed ' |sed '
/^Input/,/.* Audio: /{s/ *: */=/} /^Input/,/.* Audio: /{s/ *: */=/}
s/^[[:space:]]*// s/^[[:space:]]*//'
s/\0//g'
) )
local metadata=$( local metadata=$(
echo -e "$allinfos" \ echo -e "$allinfos" \

View File

@ -11,15 +11,5 @@ progressSpin() {
30) echo -n $'\b\\' ;; 30) echo -n $'\b\\' ;;
*) ;; *) ;;
esac esac
if ! (( count % 100 ))
then
echo -n " $count"
until (( backspace > ${#count} ))
do
(( backspace++ ))
echo -n $'\b'
done
unset backspace
fi
fi fi
} }