start work on allowing "packages"
This commit is contained in:
BIN
fsmi_fsr/fslogo.png
Normal file
BIN
fsmi_fsr/fslogo.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 6.1 KiB |
141
fsmi_fsr/generator.conf
Normal file
141
fsmi_fsr/generator.conf
Normal file
@@ -0,0 +1,141 @@
|
||||
redeleitung:
|
||||
name: "@file(data/redeleitung)"
|
||||
email: "@import(personal.conf:email_redeleitung)"
|
||||
|
||||
protokoll:
|
||||
name: "@file(data/protokoll)"
|
||||
|
||||
default_weekday: 2 #Mittwoch
|
||||
default_time: "17:30"
|
||||
meeting_link: https://meet.vs.kit.edu/b/len-prm-rv4
|
||||
place: "@file(data/ort)"
|
||||
mm_url: "@import(personal.conf:mattermost_url)"
|
||||
|
||||
invite_mail: fsr-einladung@fsmi.uni-karlsruhe.de
|
||||
invite_subject: 'Einladung zum Fachschaftsrat am {{date|weekday}}, dem {{date|date}}'
|
||||
|
||||
presentation_save_path: data/
|
||||
protocol_save_path: protokolle/
|
||||
|
||||
sequencer:
|
||||
invite_mbox_nosend:
|
||||
- read_db
|
||||
- generate --invite
|
||||
invite_maildir_nosend:
|
||||
- clean_data
|
||||
- read_db
|
||||
- read_topmails
|
||||
- generate --invite
|
||||
invite_mbox:
|
||||
- read_db
|
||||
- generate --invite --send-mail
|
||||
invite_maildir:
|
||||
- clean_data
|
||||
- read_db
|
||||
- read_topmails
|
||||
- generate --invite --send-mail
|
||||
presentation_mbox:
|
||||
- read_db
|
||||
- generate --presentation --save
|
||||
- compile_presentation
|
||||
presentation_maildir:
|
||||
- clean_data
|
||||
- read_db
|
||||
- read_topmails
|
||||
- generate --presentation --save
|
||||
- compile_presentation
|
||||
protocol_mbox:
|
||||
- read_db
|
||||
- generate --protocol --save
|
||||
protocol_maildir:
|
||||
- clean_data
|
||||
- read_db
|
||||
- read_topmails
|
||||
- generate --protocol --save
|
||||
invite:
|
||||
- "@import(personal.conf:inviteseq)"
|
||||
presentation:
|
||||
- "@import(personal.conf:presentationseq)"
|
||||
protocol:
|
||||
- "@import(personal.conf:protocolseq)"
|
||||
|
||||
pre_tops:
|
||||
- title: Begrüßung
|
||||
protostub: Der FSR wird begrüßt.
|
||||
- title: Feststellung der Beschlussfähigkeit
|
||||
protostub: Der FSR ist beschlussfähig.
|
||||
- title: Tagesordnung
|
||||
body: '\tableofcontents'
|
||||
protostub: '{% for top in to %}# {{top.title}}
|
||||
|
||||
{% endfor %}'
|
||||
- title: Unveröffentlichte Protokolle
|
||||
file: "data/uvproto.txt"
|
||||
command: helpers/get_uvproto.sh
|
||||
body: "* FSR-Protokoll vom {{last_date|date}}"
|
||||
- title: Berichte
|
||||
protostub:
|
||||
|
||||
post_tops:
|
||||
- title: Unbeantwortete E-Mails
|
||||
command: helpers/read_ubmails.py
|
||||
protostub: '<intern>
|
||||
|
||||
{{top.body}}
|
||||
|
||||
</intern>Die E-Mails wurden verteilt.'
|
||||
file: "data/ubemails.txt"
|
||||
- title: Nächster FSR
|
||||
body: 'Wann: {{next_date.strftime("%d.%m.%Y")}} {{time.strftime("%H:%M")}} \linebreak
|
||||
Wo: {{place}} \linebreak
|
||||
Redeleitung: ? \linebreak
|
||||
Protokoll: ?'
|
||||
protostub: '{{"{{"}}NextFsr
|
||||
|
||||
| termin = {{next_date.strftime("%d.%m.%Y")}} {{time.strftime("%H:%M")}}
|
||||
|
||||
| ort = {{place}}
|
||||
|
||||
| redeleitung = XXXXXXXX
|
||||
|
||||
| protokoll = XXXXXXXX
|
||||
|
||||
{{"}}"}}'
|
||||
- title: Termine
|
||||
file: "data/termine.txt"
|
||||
command: "helpers/list_termine.sh" # if khal is setup correctly, uncomment this to read events from there
|
||||
proto_command: "helpers/list_termine_proto.sh"
|
||||
protostub: '{|
|
||||
|
||||
{{"{{"}}Termin|was=AAAAAAAAAA|wann=XX.YY.{{"}}"}}
|
||||
|
||||
{{top.body}}
|
||||
|
||||
|}'
|
||||
- title: Sonstiges
|
||||
|
||||
invite_template_file: templates/fsr_einladung.j2
|
||||
mminvite_template_file: templates/fsr_einladung_mm.j2
|
||||
presentation_template_file: templates/fsr_presentation.tex.j2
|
||||
protocol_template_file: templates/fsr_protokoll.j2
|
||||
|
||||
top_mbox_file: data/fsr_tops.mbox
|
||||
mbox_out: data/invitemail.mbox
|
||||
top_inbox_maildir: "@import(personal.conf:top_inbox_maildir)"
|
||||
ubmails_inbox_maildir: "@import(personal.conf:ubmails_inbox_maildir)"
|
||||
top_list_id: top.fsmi.uni-karlsruhe.de
|
||||
|
||||
last_date_file: data/last_date
|
||||
|
||||
protoreplace:
|
||||
Beschlussvorlage: "{{Beschluss |text=
|
||||
|
||||
|pos=x |neg=x |neu=x |f=1}}
|
||||
|
||||
Beschlussvorlage"
|
||||
|
||||
sendmail: ["/usr/sbin/sendmail"]
|
||||
override_file: "@import(personal.conf:override_file)"
|
||||
|
||||
|
||||
# vim: filetype=yaml
|
||||
10
fsmi_fsr/helpers/compile_presentation.sh
Executable file
10
fsmi_fsr/helpers/compile_presentation.sh
Executable file
@@ -0,0 +1,10 @@
|
||||
#!/bin/sh
|
||||
set -e
|
||||
dest_file="presentation_$(date +%Y-%m-%d).tex"
|
||||
|
||||
echo Compiling
|
||||
mkdir -p data/presentation
|
||||
cd data/presentation/
|
||||
|
||||
latexmk -pdf "../$dest_file"
|
||||
ln -srnf "presentation_$(date +%Y-%m-%d).pdf" ../../presentation.pdf
|
||||
17
fsmi_fsr/helpers/get_uvproto.sh
Executable file
17
fsmi_fsr/helpers/get_uvproto.sh
Executable file
@@ -0,0 +1,17 @@
|
||||
#!/bin/sh
|
||||
set -e
|
||||
|
||||
: "${FSR_GEN_SSH_TO:=fsmi-login.fsmi.uni-karlsruhe.de}"
|
||||
: "${FSR_GEN_SSH:=$(test "$(hostname -d)" = "fsmi.uni-karlsruhe.de" || echo 1)}"
|
||||
|
||||
QUERY="select '* FSR-Protokoll vom '||datum|| case when protokoll like '%TODO%' then ' (hat noch TODOs)' else '' end from protokolle where ist_veroeffentlicht=false and name is null order by datum asc"
|
||||
|
||||
cmd="psql --no-align --tuples-only service=fsmi -c \"$QUERY\""
|
||||
|
||||
if [ -z "$FSR_GEN_SSH" ] || [ "$FSR_GEN_SSH" -eq 0 ]; then
|
||||
raw_proto="$(sh -c "$cmd")"
|
||||
else
|
||||
raw_proto="$(ssh -- "$FSR_GEN_SSH_TO" "$cmd")"
|
||||
fi
|
||||
|
||||
echo "$raw_proto"
|
||||
6
fsmi_fsr/helpers/list_termine.sh
Executable file
6
fsmi_fsr/helpers/list_termine.sh
Executable file
@@ -0,0 +1,6 @@
|
||||
#!/bin/sh -e
|
||||
|
||||
khal --version > /dev/null
|
||||
|
||||
khal list --day-format "" --format "* {start} {title}" -a calendars_fsmi today 30d | grep -v Fachschaftsrat | grep -v Feriensprechstunde || true
|
||||
|
||||
5
fsmi_fsr/helpers/list_termine_proto.sh
Executable file
5
fsmi_fsr/helpers/list_termine_proto.sh
Executable file
@@ -0,0 +1,5 @@
|
||||
#!/bin/sh -e
|
||||
khal --version > /dev/null
|
||||
echo "{{'{|'}}"
|
||||
khal list --day-format "" --format "{{{{'{{{{'}}}}Termin|was={title}|wann={start}{{{{'}}}}'}}}}" -a calendars_fsmi today 30d | grep -v Fachschaftsrat | grep -v Feriensprechstunde || true
|
||||
echo "{{'|}'}}"
|
||||
38
fsmi_fsr/helpers/read_db.sh
Executable file
38
fsmi_fsr/helpers/read_db.sh
Executable file
@@ -0,0 +1,38 @@
|
||||
#!/bin/sh
|
||||
set -e
|
||||
|
||||
: "${FSR_GEN_SSH_TO:=fsmi-login.fsmi.uni-karlsruhe.de}"
|
||||
: "${FSR_GEN_SSH:=$(test "$(hostname -d)" = "fsmi.uni-karlsruhe.de" || echo 1)}"
|
||||
|
||||
sql() {
|
||||
# $1: select
|
||||
# $2: order_by
|
||||
select="$1"
|
||||
order_by="$2"
|
||||
printf "
|
||||
SELECT %s FROM protokolle
|
||||
WHERE ist_veroeffentlicht=false AND name IS NULL
|
||||
ORDER BY %s
|
||||
" "$select" "$order_by" | tr '\n' ' '
|
||||
}
|
||||
|
||||
cmd="psql --no-align --tuples-only service=fsmi -c"
|
||||
cmd_raw="$cmd '$(sql "datum" "datum ASC")'"
|
||||
cmd_last="$cmd '$(sql "protokoll" "datum DESC LIMIT 1")'"
|
||||
|
||||
if [ -z "$FSR_GEN_SSH" ] || [ "$FSR_GEN_SSH" -eq 0 ]; then
|
||||
raw_proto="$(sh -c "$cmd_raw")"
|
||||
sh -c "$cmd_last" >data/last_proto
|
||||
else
|
||||
raw_proto="$(ssh -- "$FSR_GEN_SSH_TO" "$cmd_raw")"
|
||||
ssh -- "$FSR_GEN_SSH_TO" "$cmd_last" >data/last_proto
|
||||
fi
|
||||
|
||||
for proto in $raw_proto; do
|
||||
echo "* FSR-Protokoll vom $proto"
|
||||
done > data/uvproto.txt
|
||||
echo "$proto" > data/last_date
|
||||
|
||||
grep -ioP '(?<=nächste Redeleitung: ).*(?=</li>)' data/last_proto > data/redeleitung
|
||||
grep -ioP '(?<=nächstes Protokoll: ).*(?=</li>)' data/last_proto > data/protokoll
|
||||
grep -ioP '(?<=Ort: ).*(?=</li>)' data/last_proto > data/ort
|
||||
55
fsmi_fsr/helpers/read_ubmails.py
Executable file
55
fsmi_fsr/helpers/read_ubmails.py
Executable file
@@ -0,0 +1,55 @@
|
||||
#!/usr/bin/python3
|
||||
import mailbox
|
||||
import jinja2
|
||||
import email.header
|
||||
import email.utils
|
||||
import yaml
|
||||
import datetime
|
||||
import sys, os
|
||||
import pypandoc
|
||||
import argparse
|
||||
import quopri
|
||||
from pprint import pprint
|
||||
from dateutil import parser as dateutilparser
|
||||
|
||||
import generate
|
||||
|
||||
CONFIG_FILE = "generator.conf"
|
||||
|
||||
def decode_header(header):
|
||||
decoded_header = email.header.decode_header(header)[0]
|
||||
encoding = decoded_header[1] or "ascii"
|
||||
if encoding == "unknown-8bit":
|
||||
encoding = "ascii"
|
||||
return decoded_header[0].decode(encoding, errors="replace") if isinstance(decoded_header[0], bytes) else decoded_header[0]
|
||||
|
||||
if __name__ == "__main__":
|
||||
aparser = argparse.ArgumentParser()
|
||||
aparser.add_argument("--config", "-c", default=CONFIG_FILE)
|
||||
args = aparser.parse_args()
|
||||
|
||||
config = generate.get_config(args.config)
|
||||
mbox = mailbox.Maildir(config["ubmails_inbox_maildir"])
|
||||
|
||||
latest = None
|
||||
latest_date = None
|
||||
|
||||
for message in mbox:
|
||||
if message["Subject"]:
|
||||
if decode_header(message["Subject"]).strip() == "Unbeantwortete Mails":
|
||||
date = dateutilparser.parse(message["Date"])
|
||||
if latest is None:
|
||||
latest = message
|
||||
latest_date = date
|
||||
elif latest_date < date:
|
||||
latest = message
|
||||
latest_date = date
|
||||
|
||||
if not latest:
|
||||
print("ERROR: No Mail found", file=sys.stderr)
|
||||
sys.exit(1)
|
||||
if latest_date.date() != datetime.date.today():
|
||||
print("WARNING: Mail is not from today", file=sys.stderr)
|
||||
payload = latest.get_payload(decode=True).decode("utf8").strip()
|
||||
result = (payload.rpartition("\n--")[0].strip() if "\n--" in payload else payload)
|
||||
print(result)
|
||||
31
fsmi_fsr/templates/fsr_einladung.j2
Normal file
31
fsmi_fsr/templates/fsr_einladung.j2
Normal file
@@ -0,0 +1,31 @@
|
||||
Hallo,
|
||||
|
||||
hiermit lade ich euch zum nächsten Fachschaftsrat ein. Er findet statt
|
||||
am:
|
||||
|
||||
{{date|weekday}}, den {{date|date}} um {{time|time}} Uhr
|
||||
|
||||
in {{place}}
|
||||
|
||||
{% if email_tops %}Die Antragstexte für die eingereichten TOPs sind unten angehangen.{% endif %}
|
||||
Die vorläufige Tagesordnung lautet:
|
||||
|
||||
{% for top in to %}{{ "%02d" % loop.index}} {{top.title}}
|
||||
{% endfor %}
|
||||
|
||||
Bitte sendet vorher die Berichte dem Protokollamt[0] zu.
|
||||
|
||||
[0] protokollant@fsmi.uni-karlsruhe.de
|
||||
|
||||
Viele Grüße,
|
||||
{{redeleitung.name}}
|
||||
|
||||
{% if email_tops %}
|
||||
Eingereichte TOPs:
|
||||
{% for top in email_tops %}
|
||||
== {{top.title}} ==
|
||||
Eingereicht von: {{top.sender}}
|
||||
|
||||
{{top.body}}
|
||||
{% endfor %}
|
||||
{% endif %}
|
||||
12
fsmi_fsr/templates/fsr_einladung_mm.j2
Normal file
12
fsmi_fsr/templates/fsr_einladung_mm.j2
Normal file
@@ -0,0 +1,12 @@
|
||||
Hallo,
|
||||
|
||||
der nächste FSR findet statt am
|
||||
|
||||
{{date|weekday}}, den {{date|date}} um {{time|time}} Uhr
|
||||
|
||||
auf {{meeting_link}}
|
||||
|
||||
Die vorläufige Tagesordnung lautet:
|
||||
|
||||
{% for top in to %}{{ "%02d" % loop.index}} {{top.title}}
|
||||
{% endfor %}
|
||||
41
fsmi_fsr/templates/fsr_presentation.tex.j2
Normal file
41
fsmi_fsr/templates/fsr_presentation.tex.j2
Normal file
@@ -0,0 +1,41 @@
|
||||
\documentclass[aspectratio=169, smaller]{beamer}
|
||||
\mode<beamer> {
|
||||
%\setbeameroption{show notes on second screen=right}
|
||||
%\setbeameroption{show only notes}
|
||||
}
|
||||
|
||||
{% raw %}
|
||||
\providecommand{\tightlist}{%
|
||||
\setlength{\itemsep}{0pt}\setlength{\parskip}{0pt}}
|
||||
{% endraw %}
|
||||
|
||||
\usepackage{pgfpages}
|
||||
\usepackage[ngerman]{babel}
|
||||
\usepackage[utf8]{inputenc}
|
||||
\usepackage[T1]{fontenc}
|
||||
\usepackage{graphicx}
|
||||
\usepackage{fancyvrb}
|
||||
|
||||
\usetheme[width=3cm]{Berkeley}
|
||||
\usecolortheme{sidebartab}
|
||||
\setbeamertemplate{navigation symbols}{}
|
||||
|
||||
\title{Fachschaftsrat Mathe/Info}
|
||||
\author{Redeleitung: {{redeleitung.name}} \\Protokoll: {{protokoll.name}} }
|
||||
\date{ {{date.strftime("%d.%m.%Y")}} }
|
||||
\logo{\includegraphics[width=17mm]{../../fslogo}}
|
||||
|
||||
\begin{document}
|
||||
\begin{frame}
|
||||
\maketitle
|
||||
\end{frame}
|
||||
|
||||
{% for top in to %}
|
||||
\section{ {{top.title}} }
|
||||
\begin{frame}{% if top.body and top.body|length > 500 %}[allowframebreaks]{%endif%}
|
||||
\frametitle{ {{top.title}} }
|
||||
{{top.body|j2replace|wiki2latex if top.body}}
|
||||
\end{frame}
|
||||
{% endfor %}
|
||||
|
||||
\end{document}
|
||||
23
fsmi_fsr/templates/fsr_protokoll.j2
Normal file
23
fsmi_fsr/templates/fsr_protokoll.j2
Normal file
@@ -0,0 +1,23 @@
|
||||
{{ '{{' }}Protokollkopf
|
||||
|was=Fachschaftsrat
|
||||
|datum={{date.strftime("%d.%m.%Y")}}
|
||||
|ort={{place}}
|
||||
|anfang={{time.strftime("%H:%M")}}
|
||||
|ende=XX:YY
|
||||
|redeleitung={{redeleitung.name}}
|
||||
|protokollant={{protokoll.name}}
|
||||
|anwesende=
|
||||
|
||||
* {{redeleitung.name}} (Fakultät)
|
||||
* {{protokoll.name}} (Fakultät)
|
||||
* Weitere (Fakultät)
|
||||
|
||||
|veröffentlicht=Unveröffentlicht{{ '}}' }}
|
||||
|
||||
{% for top in to %}
|
||||
== {{top.title}} ==
|
||||
|
||||
{{top|prototop}}
|
||||
{% endfor %}
|
||||
|
||||
[[Kategorie:Protokoll]]
|
||||
Reference in New Issue
Block a user