blob: b8cfe272bcbcad940fdcbaad7121f79aa180b749 (
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
|
#!/bin/bash
source $(pwd)/$(dirname $0)/../../etc/settings.sh
tmp=$(mktemp -d)
date="$(date -d "$daysago days ago" +"%a, %d %b %Y")"
newn="${day}.jpg"
# get post link
rss="http://www.timesfreepress.com/rss/headlines/opinion/cartoons/"
rss_regex="<pubDate>${date}[^<]*</pubDate><guid>[^<]*</guid>"
url_regex=".*<guid>\([^<]*\)</guid>.*"
post=$(wget -O - "${rss}" | grep "${rss_regex}" | sed "s#${url_regex}#\1#")
# get img url from post
img=$(wget -O - "${post}" | grep '<div class="story_lead_photo">' -A 3 | \
sed -n 's#.*<img.*src="\([^"]*\)".*#\1#p')
echo "Hole claybennett von $server"
echo "fuer Datum: $(date -d"$daysago days ago" -I)"
echo "URL: $img"
echo
cd "${tmp}"
wget -t 0 --cache=off "${img}" -O "${newn}"
echo ${image_dir}
if [ -e "${tmp}/${newn}" ]; then
mv "${tmp}/${newn}" "${image_dir}/$newn"
rm -f "${comic_dir}/latest.jpg"
ln -s "${image_offset}/$newn" "${comic_dir}/latest.jpg"
fi
rm -rf "${tmp}"
|