From 9e2b515bed91d95cf2d6b2bb1449cb263ea09ae2 Mon Sep 17 00:00:00 2001 From: Jeroen De Meerleer Date: Wed, 12 Feb 2020 18:55:04 +0100 Subject: [PATCH] Added progress to the parallel output --- music-sync.sh | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/music-sync.sh b/music-sync.sh index 0e26cab..8b3cc36 100755 --- a/music-sync.sh +++ b/music-sync.sh @@ -319,11 +319,10 @@ Execute() { export verbose export coverartsize 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 for line in $(cat "/tmp/music-sync-filelist") do - curline=$(expr ${curline} + 1) total=$(cat /tmp/music-sync-filelist | wc -l) percentage=$(echo "scale=4;${curline}/${total}" | bc) @@ -337,7 +336,12 @@ Execute() { } ProcessFile() { 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 "Progress: $curline / $total (${percentage%00}%)" if [[ $convert == true ]]; then ConvertFile "$line" fi