.
675 |
--------------------------------------------------------------------------------
/booth.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | action=$1
4 |
5 | local_portrait_path="portraits"
6 | upload_path="vilmibm@tilde.town:/home/vilmibm/public_html/asciigallery"
7 | screenshot=00000001.png
8 | final="$local_portrait_path/$(date --iso-8601=seconds -u).portrait"
9 |
10 | function print () {
11 | echo "printing..." >&2
12 | lpr $final.txt
13 | }
14 |
15 | function upload () {
16 | echo "uploading..." >&2
17 | jp2a --height=30 --width=60 --output=$final.html --html --colors --fill /tmp/shotsmall.jpg
18 |
19 | if [ ! -z $(ls index.html 2>/dev/null) ]; then
20 | cp index.html index.html.bak
21 | fi
22 |
23 | cp index.top.html index.html
24 |
25 | for portrait in $(ls $local_portrait_path | egrep "html$" | sort -r | head -n24); do
26 | echo "" >> index.html
27 | echo $(tail -n +18 $local_portrait_path/$portrait | head -n +3 | perl -p -e 's/\n//') >> index.html
28 | echo "$(echo $portrait | sed 's/.portrait.html//')" >> index.html
29 | echo "
" >> index.html
30 | done
31 |
32 | echo "