diff options
author | Jürgen Schweizer <oe6jue@oevsv.at> | 2019-02-20 17:13:42 +0100 |
---|---|---|
committer | Jürgen Schweizer <oe6jue@oevsv.at> | 2019-02-20 17:13:42 +0100 |
commit | 27cddbf97ff4b191f90400d71512194497c96554 (patch) | |
tree | f67321308115729ab3ec4734a28f9d58193d6a67 | |
parent | a29928417f7dfa5475800fb6f35362e05a503310 (diff) |
new meetup mode
-rw-r--r-- | index.shtml | 4 | ||||
-rwxr-xr-x | meetup/gen_dates.sh | 26 | ||||
-rw-r--r-- | meetup/gen_dates2.sh | 76 |
3 files changed, 99 insertions, 7 deletions
diff --git a/index.shtml b/index.shtml index 0fd29e6..763c0c2 100644 --- a/index.shtml +++ b/index.shtml @@ -5,10 +5,6 @@ <!--#if expr="${SITE} = index" --> <h1>Funkfeuer Graz</h1> <!--#include virtual="/inc/${LANG}/meetup.shtml" --> -<p> - Nächstes Tech/Core-Treffen:<br> - Montag, <em>25.02.2019 20 Uhr</em> -</p> <!--#include virtual="/content/${LANG}/news.html" --> <!--#else --> <!--#include virtual="/content/${LANG}/${SITE}.html" --> diff --git a/meetup/gen_dates.sh b/meetup/gen_dates.sh index 0bc4479..6e73c02 100755 --- a/meetup/gen_dates.sh +++ b/meetup/gen_dates.sh @@ -6,11 +6,13 @@ LIMIT=3 # uncomment to enable debug -#DEBUG=1 +DEBUG=0 # where to put the output files? NEXT_FILE="next.html" AFTER_FILE="after.html" +STANDARD_FILE="standard.html" +TECHCORE_FILE="techcore.html" DOW=`date +"%u"` if [ $DOW -eq 1 ]; then @@ -22,13 +24,20 @@ else fi MEETUPS="" +MEETUPTYPES="" CNT=0 while true; do if [ -n "$DEBUG" ]; then echo -n "check day($TS): "`date --date="@$TS" +"%d.%m.%Y"`; fi if [ $DOM -le 7 ] || ([ $DOM -ge 15 ] && [ $DOM -le 21 ]); then - if [ -n "$DEBUG" ]; then echo " -> ok"; fi + if [ $DOM -le 7 ]; then + MTYP="Tech/Core" + else + MTYP="gemütliches" + fi + if [ -n "$DEBUG" ]; then echo " -> ok $MTYP"; fi MEETUPS="$MEETUPS $TS" + MEETUPTYPES="$MEETUPTYPES $MTYP" CNT=$((CNT + 1)) if [ $CNT -ge $LIMIT ]; then break; @@ -45,11 +54,22 @@ NEXT=$1 shift FUTURE=$@ +set -- $MEETUPTYPES +NEXTMTYP=$1 +shift +FUTUREMTYP=$@ + date --date="@$NEXT" +"%d.%m.%Y" > "$NEXT_FILE.new" +CNT=0 echo "<ul>" > "$AFTER_FILE.new" for meetup in $FUTURE; do - echo " <li>"`date --date="@$meetup" +"%d.%m.%Y"`"</li>" >> "$AFTER_FILE.new" + set -- $FUTUREMTYP + mtext=$1 + shift + FUTUREMTYP=$@ + echo " <li>"`date --date="@$meetup" +"%d.%m.%Y"`": $mtext Treffen </li>" >> "$AFTER_FILE.new" + CNT=$((CNT + 1)) done echo "</ul>" >> "$AFTER_FILE.new" mv "$NEXT_FILE.new" "$NEXT_FILE" diff --git a/meetup/gen_dates2.sh b/meetup/gen_dates2.sh new file mode 100644 index 0000000..5b9160d --- /dev/null +++ b/meetup/gen_dates2.sh @@ -0,0 +1,76 @@ +#!/bin/sh +# generates the upcoming meetups for Funkfeuer Graz Homepage +# +# this script should be called by cron every day (night) +# how far in the future should i go? +LIMIT=3 + +# uncomment to enable debug +DEBUG=0 + +# where to put the output files? +NEXT_FILE="next.html" +AFTER_FILE="after.html" + +DOW=`date +"%u"` +if [ $DOW -eq 1 ]; then + DOM=`date +"%e"` + TS=`date +"%s"` +else + DOM=`date --date="next monday" +"%e"` + TS=`date --date="next monday" +"%s"` +fi + +MEETUPS="" +MEETUPTYPES="" +CNT=0 +while true; do + if [ -n "$DEBUG" ]; then echo -n "check day($TS): "`date --date="@$TS" +"%d.%m.%Y"`; fi + + if [ $DOM -le 7 ] || ([ $DOM -ge 15 ] && [ $DOM -le 21 ]); then + if [ $DOM -le 7 ]; then + MTYP="Tech/Core" + else + MTYP="gemütliches" + fi + if [ -n "$DEBUG" ]; then echo " -> ok $MTYP"; fi + MEETUPS="$MEETUPS $TS" + MEETUPTYPES="$MEETUPTYPES $MTYP" + CNT=$((CNT + 1)) + if [ $CNT -ge $LIMIT ]; then + break; + fi + else + if [ -n "$DEBUG" ]; then echo ""; fi + fi + TS=$((TS + (7 * 24 * 3600))) + DOM=`date --date="@$TS" +"%e"` +done + +set -- $MEETUPS +NEXT=$1 +shift +FUTURE=$@ + +set -- $MEETUPTYPES +NEXTMTYP=$1 +shift +FUTUREMTYP=$@ + +date --date="@$NEXT" +"%d.%m.%Y" > "$NEXT_FILE.new" +CNT=0 +echo "<ul>" > "$AFTER_FILE.new" +for meetup in $FUTURE; do + set -- $FUTUREMTYP + mtext=$1 + shift + FUTUREMTYP=$@ + + echo " <li>"`date --date="@$meetup" +"%d.%m.%Y"`": $mtext Treffen </li>" >> "$AFTER_FILE.new" + CNT=$((CNT + 1)) +done +echo "</ul>" >> "$AFTER_FILE.new" +mv "$NEXT_FILE.new" "$NEXT_FILE" +mv "$AFTER_FILE.new" "$AFTER_FILE" + +exit 0 |