blob: c8a849aa95d17cfd088b613a2abb04ccf96169d0 (
plain)
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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
|
#!/bin/sh
site="https://mesacsclub.com/kaa/Photo";
neocities="https://kaa.neocities.org/Photo";
getyear() {
sed -e 's|-.*||'
}
getmonth() {
sed -e 's|^[0-9][0-9][0-9][0-9]-||' -e 's|-.*||'
}
getday() {
sed -e 's|^[0-9][0-9][0-9][0-9]-[0-9][0-9]-||' -e 's|-.*||'
}
padimg() {
p=$1
printf "\t\t\t<a href=\"$site/$p"
printf "\n%s\n" "\" target=\"_blank\">"
printf "\t\t\t\t%s%s%s" "<img src=\"" $site $p
printf "%s\n" "\" loading=\"lazy\">"
printf "\t\t\t</a>\n"
printf "\t\t\t<br>\n"
}
humonth() {
if [ "$1" -eq 1 ]
then
echo "january"
elif [ "$1" -eq 2 ]
then
echo "february"
elif [ "$1" -eq 3 ]
then
echo "march"
elif [ "$1" -eq 4 ]
then
echo "april"
elif [ "$1" -eq 5 ]
then
echo "may"
elif [ "$1" -eq 6 ]
then
echo "june"
elif [ "$1" -eq 7 ]
then
echo "july"
elif [ "$1" -eq 8 ]
then
echo "august"
elif [ "$1" -eq 9 ]
then
echo "september"
elif [ "$1" -eq 10 ]
then
echo "october"
elif [ "$1" -eq 11 ]
then
echo "november"
elif [ "$1" -eq 12 ]
then
echo "december"
else
echo "mystery"
fi
}
pyear=0
pmonth=0
pday=0
poutfn=""
outfn=""
newday=0
lastfn=$(cat photo | while read -r line
do
if [ $newday -eq 1 ]
then
printf "\t\t\t<h2>$pyear<br>$(humonth $pmonth) $pday</h2>" >> $outfn
newday=0
fi
year=$(echo $line | getyear)
month=$(echo $line | getmonth)
day=$(echo $line | getday)
if [ $year -ne $pyear ] || [ $month -ne $pmonth ]
then
nextoutfn=photographed/${year}-${month}.html
if ! [ -z $outfn ]
then
printf "\t\t\t<br><a href=\"$poutfn\"><h2>later</h2></a>" >> $outfn
printf "\t\t\t<br><a href=\"$nextoutfn\"><h2>earlier</h2></a>" >> $outfn
cat footer/photographed.txt >> $outfn
fi
outfn=$nextoutfn
echo $outfn
cat header/photographed.txt > $outfn
fi
if [ $pday -ne $day ]
then
newday=1
fi
padimg $line >> $outfn
pyear=$year
pmonth=$month
pday=$day
done | tail -1)
printf "\t\t\t<br><a href=\"$poutfn\"><h2>later</h2></a>" >> $lastfn
cat footer/photographed.txt >> $lastfn
|