4 # description: Modifies updates ITG's cache with output
5 # tailiored to dialogs gauge widget.
7 while getopts ":d:" opt
; do
13 echo "Invalid option: -$OPTARG" >&2
17 echo "Option -$OPTARG requires an argument." >&2
23 if [[ -z
"$cache_dir" ]] ||
[[ "${cache_dir}xxx" = "xxx" ]]; then
24 echo "Cache directory not supplied.";
28 [[ ! -d
"$cache_dir" ]] && echo 100 && exit 0
30 num
=$
(wc -l
< /tmp
/newsongs.txt
)
33 if [[ $num -gt
0 ]]; then
35 read -r changes filename
<<< "$line"
36 #todo: change directory to be arg'able
37 cacheline
=$
(grep -F
"$filename" ${cache_dir}/*)
38 IFS
=":" read -r cachepath otherjunk
<<< "$cacheline"
40 if [[ ! -z
"$cachepath" ]]; then
45 printf '%i %i' $num_processed $num | mawk
-Winteractive
'{ pc=100*$1/$2; i=int(pc); print (pc-i<0.5)?i:i+1 }'
46 done < /tmp
/newsongs.txt