-
Notifications
You must be signed in to change notification settings - Fork 0
/
order.sh
executable file
·52 lines (45 loc) · 1.18 KB
/
order.sh
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
STREAM="$1"
if [ -z "$NO_RM" ]; then
mkdir ordered || rm ordered/* || :
[ -z "$ZIP_FILE" ] || rm "$ZIP_FILE"
fi
if [ -z "$STREAM" ]; then
first_file="$(find 'képek/' -name '*_Files' -type d | head -n1)/stats.txt"
files="$(find "képek/" -name "stats.txt" -newer "$first_file")"
count="$(echo "$files" | wc -l)"
else
count="?"
fi
i=0
if [ -z "$STREAM" ]; then
echo "$files"
else
cat "$STREAM"
fi | while IFS= read file; do
let i++
if [ -z "$STREAM" ]; then
folder="../$(dirname "$file")"
else
folder="$file"
file="$folder/stats.txt"
fi
if [ -n "$NO_RM" ]; then
if [ -n "$(find ordered/ -name "*-$(basename "$folder")" -maxdepth 1 -print -quit)" ]; then
continue
fi
fi
printf "$i / $count\r"
if [ $(cat "$file" | wc -l) -lt 2 ]; then
echo "Warning: $file is invalid - skipping"
continue
fi
linkname="ordered/$(cat "$file" | grep -oP 'Ratio: \K.*')-$(basename "$folder")"
ln -s "$folder/composite.tif" "$linkname.tif"
ln -s "$folder" "$linkname"
# convert "$folder"/*_c?.tif -combine "$linkname"
done
echo
if [ -n "$ZIP_FILE" ]; then
zip ${NO_RM:+-u} "$ZIP_FILE" ordered/*/composite.jpg ordered/*/*.txt
du -h "$ZIP_FILE"
fi