diff options
Diffstat (limited to 'bin/comics/erzaehlmirnix')
-rwxr-xr-x | bin/comics/erzaehlmirnix | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/bin/comics/erzaehlmirnix b/bin/comics/erzaehlmirnix new file mode 100755 index 0000000..229c2d8 --- /dev/null +++ b/bin/comics/erzaehlmirnix @@ -0,0 +1,31 @@ +#!/bin/bash + +if [ -z "$1" -o ! -d "$1" ]; then + echo "Usage: $0 <top-directory> [<days ago>]" 1>&2 + exit 1 +fi + +top="${1}" +shift + +source "${top}/etc/settings.sh" +tmp="$(mktemp -d)" +cd "${tmp}" + +webaddress="https://erzaehlmirnix.wordpress.com/$(date -d"$daysago days ago" +%Y/%m/%d)" +grepurl="https://erzaehlmirnix.files.wordpress.com/$(date -d"$daysago days ago" +%Y/%m)" +newn="${day}.png" + +echo "Search $webaddress" +STRIP=$(curl -L "$webaddress" | grep -oE ${grepurl}'/[^"]+' | head -n1) +echo "Strip URL $STRIP" + +if [ -n "$STRIP" ]; then + wget ${wget_args} "$STRIP" -O erzaehlmirnix.png + mv "erzaehlmirnix.png" "${image_dir}/$newn" + rm -f "${comic_dir}/latest.png" + ln -s "${image_offset}/$newn" "${comic_dir}/latest.png" +fi + +cd .. +rm -rf "${tmp}" |