Added progress to the parallel output

This commit is contained in:
Jeroen De Meerleer 2020-02-12 18:55:04 +01:00
parent 2f39dc88e4
commit 9e2b515bed
1 changed files with 6 additions and 2 deletions

View File

@ -319,11 +319,10 @@ Execute() {
export verbose export verbose
export coverartsize export coverartsize
export begin export begin
parallel --jobs ${jobcount} --line-buffer --arg-file "/tmp/music-sync-filelist" ProcessFile parallel --jobs ${jobcount} --will-cite --line-buffer --arg-file "/tmp/music-sync-filelist" ProcessFile
else else
for line in $(cat "/tmp/music-sync-filelist") for line in $(cat "/tmp/music-sync-filelist")
do do
curline=$(expr ${curline} + 1) curline=$(expr ${curline} + 1)
total=$(cat /tmp/music-sync-filelist | wc -l) total=$(cat /tmp/music-sync-filelist | wc -l)
percentage=$(echo "scale=4;${curline}/${total}" | bc) percentage=$(echo "scale=4;${curline}/${total}" | bc)
@ -337,7 +336,12 @@ Execute() {
} }
ProcessFile() { ProcessFile() {
line=${1} line=${1}
curline="$(grep -n "$line" /tmp/music-sync-filelist | head -n 1 | cut -d: -f1)"
total=$(cat /tmp/music-sync-filelist | wc -l)
percentage=$(echo "scale=4;${curline}/${total}" | bc)
percentage=$(echo "scale=2;${percentage}*100" | bc)
VerboseOutput 2 "Current File: $line" VerboseOutput 2 "Current File: $line"
VerboseOutput 2 "Progress: $curline / $total (${percentage%00}%)"
if [[ $convert == true ]]; then if [[ $convert == true ]]; then
ConvertFile "$line" ConvertFile "$line"
fi fi