-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathbuild.sh
41 lines (36 loc) · 1.01 KB
/
build.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
#!/bin/bash
fileGrp="OCR-D-IMG"
_prompt_yn () {
echo
read -p ">>> $1 " -n 1
echo
if [[ $REPLY =~ ^[Yy]$ ]];then
return 0
else
return 1
fi
}
_prompt_yn "Downloading images?" && {
mkdir -p $fileGrp
while read l;do
work=$(echo "$l"|cut -d, -f 1)
page=$(echo "$l"|cut -d, -f 2)
wget -O "${fileGrp}/${work}-$page.jpg" "http://media.dwds.de/dta/images/${work}/${work}_${page}_1600px.jpg"
done < sources.csv
}
_prompt_yn "METSify?" && {
ocrd workspace init
while read l;do
work=$(echo "$l"|cut -d, -f 1)
page=$(echo "$l"|cut -d, -f 2)
ocrd workspace add \
--file-grp $fileGrp \
--mimetype image/jpeg \
--file-id ${fileGrp}-${work}-${page} \
--group-id ${work}-${page} \
$fileGrp/${work}-${page}.jpg
done < sources.csv
}
_prompt_yn "GitHub-ify local links?" && {
sed -i "s,file://$PWD,https://github.com/OCR-D/assets/raw/master/data/column-samples," mets.xml
}