From 3c4e309868bd1ab316b50d7f143327686ca5bc97 Mon Sep 17 00:00:00 2001 From: Markus Birth Date: Sat, 10 May 2014 22:56:32 +0200 Subject: [PATCH] Added multithreading --- mp3gain_tracks.sh | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/mp3gain_tracks.sh b/mp3gain_tracks.sh index b6477b0..6ec2a81 100755 --- a/mp3gain_tracks.sh +++ b/mp3gain_tracks.sh @@ -1,2 +1,14 @@ #!/bin/sh -mp3gain -k -p -r -s i *.mp3 +if [ "$#" = "0" ]; then + echo "Usage: $0 file1 [file2 file3 ... fileN]" + exit 1 +fi + +if [ -z "$CONCURRENCY_LEVEL" ]; then + CONCURRENCY_LEVEL=1 +fi + +echo "Processing using $CONCURRENCY_LEVEL processes..." +find "$@" -print0 | xargs -0 -P $CONCURRENCY_LEVEL -n 1 -I {} mp3gain -q -k -p -r -s i "{}" + +echo "All done."