summaryrefslogtreecommitdiffstats
path: root/etc
diff options
context:
space:
mode:
authorAlexander Sulfrian <alex@spline.inf.fu-berlin.de>2012-07-27 14:41:21 +0200
committerwww-data <www-data@vm-staticweb.spline.inf.fu-berlin.de>2012-07-27 14:41:21 +0200
commitf2f8964a72f13657af301029c98bfd4b1732d9a6 (patch)
treeaf41fa0b12131d6e98b10784790f1d835bc6c99e /etc
parent676e7ac3abb5eb9d956a702adec2a21b97cb4ed6 (diff)
downloadcomics-f2f8964a72f13657af301029c98bfd4b1732d9a6.tar.gz
comics-f2f8964a72f13657af301029c98bfd4b1732d9a6.tar.bz2
comics-f2f8964a72f13657af301029c98bfd4b1732d9a6.zip
bin/comics/xkcd: get comic for specific date via the archive page
It is possible to get a xkcd comic for a specific date via the archive page. This eleminates the need of the state directory and xkcd was the only script that used it.
Diffstat (limited to 'etc')
-rw-r--r--etc/settings.sh15
1 files changed, 6 insertions, 9 deletions
diff --git a/etc/settings.sh b/etc/settings.sh
index d07293f..00947ac 100644
--- a/etc/settings.sh
+++ b/etc/settings.sh
@@ -1,7 +1,11 @@
# this file is sourced by the get scripts
-if [ "$1" = "" ]
-then
+if [ -z "$top" ]; then
+ echo "\$top needs to be set before sourcing settings.sh" 1>&2
+ exit 1
+fi
+
+if [ -z "$1" ]; then
daysago=0
else
daysago=$1
@@ -12,9 +16,6 @@ year=$(date -d"$daysago days ago" +%Y)
month=$(date -d"$daysago days ago" +%Y-%m)
day=$(date -d"$daysago days ago" +%d)
-top="$(pwd)/$(dirname $0)/../../"
-state_dir=${top}/var/state/
-state_file=${state_dir}/${comic}.state
comic_dir=${top}/htdocs/imgs/${comic}
image_offset=${month}/
image_dir=${comic_dir}/${image_offset}
@@ -23,8 +24,4 @@ if [ ! -d "${image_dir}" ]; then
mkdir -p "${image_dir}"
fi
-if [ ! -d "${state_dir}" ]; then
- mkdir -p "${state_dir}"
-fi
-
wget_args="--timeout 100 --wait=1000 --random-wait --no-cache"