-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmp3
More file actions
76 lines (63 loc) · 1.15 KB
/
mp3
File metadata and controls
76 lines (63 loc) · 1.15 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
#!/bin/sh
n=0
done=0
count=0
maxjobs=5
args=()
while [[ $# -gt 0 ]]; do
case $1 in
-c|--count)
count="$2"
shift # past argument
shift # past value
;;
-j|--jobs)
maxjobs="$2"
shift # past argument
shift # past value
;;
-*|--*)
echo "Unknown option $1"
exit 1
;;
*)
args+=("$1") # save positional arg
shift # past argument
;;
esac
done
set -- "${args[@]}" # restore positional parameters
arg=""
do_mp3(){
if [[ $arg == *.mp3 ]]; then continue; fi
if [ $(stat -c %s "$arg") -eq 0 ]; then
echo "file [$arg] is empty, skip"
continue
fi
if [ $count -ne 0 ] && [ $done -eq $count ]; then
wait
echo "done [$count], exit"
exit 0
fi
RHVoice-test -q max -p marianna+slt -R 48000 -i $arg -o "$arg.mp3" &
((++done))
# limit jobs
if (( $(($((++n)) % $maxjobs)) == 0 )) ; then
wait # wait until all have finished (not optimal, but most times good enough)
echo "done [$n:$#]"
fi
}
echo "running"
if [ $# -eq 0 ]; then
for arg in $(ls | sort -V)
do
do_mp3
done
else
for arg in "$@"
do
do_mp3
done
fi
wait
echo "finish"