Compare commits

...

2 commits

Author SHA1 Message Date
gandalf 28db996362 seems to be fertig
Wohooo! Party!
2022-06-01 13:37:12 +02:00
gandalf 313ddd87ba Backend seems ready 2022-06-01 12:22:10 +02:00
5 changed files with 84 additions and 13 deletions

View file

@ -58,23 +58,31 @@ BASEPATH=$(dirname $(realpath $0))
alarme=$($BASEPATH/add_alarm.sh e $1 $2)
alarme=${alarme//$'\n'/\\$'\n'}
sed -i "s|replacemealarmt|${alarmt//\\n/\\\\n}|g" $ics
sed -i "s|replacemealarmt|${alarme//\\n/\\\\n}|g" $ics
sed -i "s|replacemealarme|${alarme//\\n/\\\\n}|g" $ics
# AktenzeichenXYZ
# take from deckblatt
aktenzeichen=""
if [ -e DECKBLATT.csv ]; then
azme=$(grep "0$" DECKBLATT.csv | cut -d, -f3)
azthem=$(grep "+$" DECKBLATT.csv | cut -d, -f3)
aktenzeichen="$azme -- $azthem"
fi
sed -i "s|AktenzeichenXYZ|$aktenzeichen|g" $ics
# human-readable date
sed -i "s|replacemedate|$(date -d $2 +%d.%m.%Y), 2300|g" $ics
# description:
sed -i "s|replacemedescription|${3//$'\n'/\\\\n}|g" $ics
# what we might need to replace, but not even that often:
# dtstart, time component optional. We only work with minutes here:
[ -n $4 ] && sed -i "s|2300|$4|g" $ics
[ -n "$4" ] && echo ${#4}
[ -n "$4" ] && sed -i "s|2300|$4|g" $ics
# dtend, same as dtstart:
[ -n $5 ] && sed -i "s|2359|$5|g" $ics
[ -n "$5" ] && sed -i "s|2359|$5|g" $ics
# UUID:
sed -i "s|99g999gggg|$UUID|g" $ics
user=$username:$secret
url=$domain/$username/$calendar
# curl -k --user $user -X PUT -H "Content-Type: text/calendar; charset=utf-8" --data-binary @./$ics --url $url/$ics
cat $ics
curl -k --user $user -X PUT -H "Content-Type: text/calendar; charset=utf-8" --data-binary @./$ics --url $url/$ics
fi

View file

@ -0,0 +1,69 @@
#! /bin/bash
# This is a front-end to make the use of add_date.sh more convenient
function usage {
echo "Usage:
$ $0 <category_options> [-d <date>|-P <relativ date>] <description> [-tstart <value>] [-tend <value>]
* <category_options> MUST contain EXACTLY ONE of -frist, -wv or -termin
and can be expanded by e.g. -jura, -personal, ...
Expansion options need to be specified in in your .env first.
* values for -tstart and -tend are military time (HHMM)
* date can be any format that is recognised by the standard tool of the same name.
* EXACTLY ONE of -d and -P is REQUIRED. If both are given, it is not defined which will be passed on.
$ $0 -help
Print this Message and exit"
exit 1
}
#Parsing Parameters:
BASEPATH=$(dirname $(realpath $0))
. $BASEPATH/.env
unset $GETOPT_COMPATIBLE
ARGV=$(getopt -n "$0" -a -o "d:P:" -l "frist,wv,termin,$catopts,help,tstart:,tend:" -- "$@")
if [ $? -ne 0 ]
then
usage
fi
eval set -- "$ARGV"
CATEGORIES=
#Now we have $@ clean and tidy and begin parsing
while :
do
case "$1" in
"--help") usage ;;
"--frist")
CATEGORIES=FRIST,$CATEGORIES
shift ;;
"--termin")
CATEGORIES=TERMIN,$CATEGORIES
shift ;;
"--wv")
CATEGORIES=WV,$CATEGORIES
shift ;;
"--tstart")
tstart=$2
shift ;;
"--tend")
tend=$2
shift ;;
"--"?*)
CATEGORIES=$CATEGORIES$(tr 'a-z' 'A-Z' <<< ${1/--/}),
shift ;;
"-d")
date=$(date -d "$2" +%Y%m%d)
shift
shift ;;
"-P")
date=$(date -d "${${${${2/Y/ years}/m/ months}/W/ weeks}/D/ days}" +%Y%m%d)
shift
shift ;;
"--")
shift
break ;;
esac
done
#letztes Komma aus CATEGORIES streichen
CATEGORIES=${CATEGORIES/%,/}
$BASEPATH/add_date.sh $CATEGORIES $date $1 $tstart $tend;

View file

@ -31,10 +31,10 @@ TRANS:TRANSPARENT
CLASS:PUBLIC
CATEGORIES:replacemecategory
X-MOZ-GENERATION:1
BEGIN:VALARM
replacemealarme
END:VALARM
END:VEVENT
END:VCALENDAR
BEGIN:VCALENDAR
BEGIN:VTODO
CREATED:20160224T172807Z
LAST-MODIFIED:20160224T172807Z
@ -48,8 +48,6 @@ STATUS:NEEDS-ACTION
CLASS:PUBLIC
CATEGORIES:replacemecategory
X-MOZ-GENERATION:1
BEGIN:VALARM
replacemealarmt
END:VALARM
END:VTODO
END:VCALENDAR

View file

@ -31,8 +31,6 @@ TRANS:TRANSPARENT
CLASS:PUBLIC
CATEGORIES:replacemecategory
X-MOZ-GENERATION:1
BEGIN:VALARM
replacemealarme
END:VALARM
END:VEVENT
END:VCALENDAR

View file

@ -30,8 +30,6 @@ STATUS:NEEDS-ACTION
CLASS:PUBLIC
CATEGORIES:replacemecategory
X-MOZ-GENERATION:1
BEGIN:VALARM
replacemealarmt
END:VALARM
END:VTODO
END:VCALENDAR