-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathrun
executable file
·63 lines (49 loc) · 1.22 KB
/
run
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
#!/bin/bash
set -e
set -x
set -o pipefail
TEMPLATE="template.tex.jinja2"
SCRIPTPATH="$(readlink -f "$(dirname "$BASH_SOURCE")")"
TMP_DIR="$(mktemp -d)"
cleanup () {
rm -rf "$TMP_DIR"
}
trap cleanup EXIT
gather () {
"${SCRIPTPATH}/gather_weather_icons.py"
"${SCRIPTPATH}/gather_weather.py"
"${SCRIPTPATH}/gather_caldav.py"
"${SCRIPTPATH}/gather_webcal.py"
}
render_data_to_latex () {
"${SCRIPTPATH}/templater.py" "${TEMPLATE}"
}
render_latex_to_png () {
xelatex "display.tex"
pdftocairo -png -mono -singlefile -antialias none "display.pdf" display
convert -rotate 90 display.png "display.png"
}
display () {
$DISPLAY_TOOL "display.png"
}
run () {
if [[ -f "${SCRIPTPATH}/venv/bin/activate" ]]; then
source "${SCRIPTPATH}/venv/bin/activate"
fi
if [[ -f "${SCRIPTPATH}/environment" ]]; then
set +x
set -o allexport
source "${SCRIPTPATH}/environment"
set +o allexport
set -x
fi
cd "$TMP_DIR"
ln -s "${SCRIPTPATH}/beamerthemeseriinfodisplay.sty" .
ln -s "${SCRIPTPATH}/calendarweek.tex" .
gather | tee "/tmp/last_comporellon_gather" | render_data_to_latex > "display.tex"
render_latex_to_png
display
}
if [[ "${BASH_SOURCE[0]}" = "${0}" ]]; then
run
fi