diff --git a/data.py b/data.py
new file mode 100644
index 0000000..8d56825
--- /dev/null
+++ b/data.py
@@ -0,0 +1,13 @@
+class BlowerdoorData:
+ def __init__(self, path, docName, location, customer, pdfDate, blowerdoorDate):
+ self.path = path
+ self.docName = docName
+ self.location = location
+ self.customer = customer
+ self.blowerdoorDate = blowerdoorDate
+ self.pdfDate = pdfDate
+
+
+#print("Bauort: " + location)
+#print("Bauherr: " + customer)
+#print("Blowerdoor: " + blowerdoorDate)
\ No newline at end of file
diff --git a/eg-geiss-bauherren.py b/eg-geiss-bauherren.py
deleted file mode 100644
index 974a19b..0000000
--- a/eg-geiss-bauherren.py
+++ /dev/null
@@ -1,62 +0,0 @@
-import fitz
-import dateutil.parser
-
-BLOCK_TUP_TEXT = 4
-doc = fitz.open("Bauablaufplan.pdf")
-
-FIRST_P = True
-
-# pop vars
-customer = "NOT_FOUND"
-location = ""
-startDate = doc.metadata["creationDate"].split("D:")[1].split("+")[0]
-startDateParsed = dateutil.parser.parse(startDate)
-blowerdoorDate = "NOT_FOUND"
-
-for p in doc:
- blocks = p.get_text("blocks")
- for i in range(0, len(blocks)):
-
- text = blocks[i][BLOCK_TUP_TEXT]
-
- textNoSpaceNewline = text.replace("\n", "")
- textNoSpaceNewline = textNoSpaceNewline.replace(" ", "")
- if FIRST_P and i < 3 and textNoSpaceNewline:
- FIRST_P = False
- customer = text
-
- if "Bauort:" in text:
- location += text.split("Bauort:")[1]
-
- if "Thermoscan" in text:
- kwParts = text.split("\n")
- kw = ""
- title = ""
- contractor = ""
- for p in kwParts:
- pClean = p.strip()
- if not pClean:
- continue
- elif not kw:
- kw = int(pClean.split(". KW")[0])
- elif not title:
- title = pClean
- elif not contractor:
- contractor = pClean
-
- ISO_CAL_KW_LOC = 1
- kwStartDate = startDateParsed.isocalendar()[ISO_CAL_KW_LOC]
- if kw < kwStartDate:
- blowerdoorDate = "{} KW-{} (assumed next year)".format(startDateParsed.year +1, kw)
- else:
- blowerdoorDate = "{} KW-{}".format(startDateParsed.year, kw)
-
-
-
-localtion = location.replace("\n\n", "\n").strip("n")
-customer = customer.replace("\n \n", "\n").strip("n")
-customer = customer.replace("\n\n", "\n").strip("n")
-
-print("Bauort: " + location)
-print("Bauherr: " + customer)
-print("Blowerdoor: " + blowerdoorDate)
\ No newline at end of file
diff --git a/eg_geiss_bauherren.py b/eg_geiss_bauherren.py
new file mode 100644
index 0000000..471a761
--- /dev/null
+++ b/eg_geiss_bauherren.py
@@ -0,0 +1,66 @@
+import fitz
+import data
+import dateutil.parser
+import os.path
+
+
+BLOCK_TUP_TEXT = 4
+
+def load(filename):
+ doc = fitz.open(filename)
+ FIRST_P = True
+
+ # pop vars
+ customer = "NOT_FOUND"
+ location = ""
+ startDate = doc.metadata["creationDate"].split("D:")[1].split("+")[0]
+ startDateParsed = dateutil.parser.parse(startDate)
+ blowerdoorDate = "NOT_FOUND"
+
+ for p in doc:
+ blocks = p.get_text("blocks")
+ for i in range(0, len(blocks)):
+
+ text = blocks[i][BLOCK_TUP_TEXT]
+
+ textNoSpaceNewline = text.replace("\n", "")
+ textNoSpaceNewline = textNoSpaceNewline.replace(" ", "")
+ if FIRST_P and i < 3 and textNoSpaceNewline:
+ FIRST_P = False
+ customer = text
+
+ if "Bauort:" in text:
+ location += text.split("Bauort:")[1]
+
+ if "Thermoscan" in text:
+ kwParts = text.split("\n")
+ kw = ""
+ title = ""
+ contractor = ""
+ for p in kwParts:
+ pClean = p.strip()
+ if not pClean:
+ continue
+ elif not kw:
+ kw = int(pClean.split(". KW")[0])
+ elif not title:
+ title = pClean
+ elif not contractor:
+ contractor = pClean
+
+ ISO_CAL_KW_LOC = 1
+ kwStartDate = startDateParsed.isocalendar()[ISO_CAL_KW_LOC]
+ if kw < kwStartDate:
+ blowerdoorDate = "{} KW-{}".format(startDateParsed.year +1, kw)
+ else:
+ blowerdoorDate = "{} KW-{}".format(startDateParsed.year, kw)
+
+
+
+ location = location.replace("\n\n", "\n").strip("n")
+ customer = customer.replace("\n \n", "\n").strip("n")
+ customer = customer.replace("\n\n", "\n").strip("n")
+
+ filename = filename.replace("\\","/")
+ return data.BlowerdoorData(filename, os.path.basename(filename), location,
+ customer, startDateParsed, blowerdoorDate)
diff --git a/server.py b/server.py
new file mode 100644
index 0000000..57f8ec9
--- /dev/null
+++ b/server.py
@@ -0,0 +1,36 @@
+import flask
+import argparse
+import glob
+import os
+
+import eg_geiss_bauherren as parserBackend
+
+app = flask.Flask("THS-Raven")
+
+@app.route("/")
+def root():
+ allFiles = []
+ for filename in glob.glob("static/files/*.pdf"):
+ allFiles.append(parserBackend.load(filename))
+
+ return flask.render_template("index.html", listContent=allFiles)
+
+@app.route("/get-file")
+def getFile():
+ return flask.send_from_directory("static/files/", flask.request.args.get("basename"), mimetype="application/pdf")
+
+@app.before_first_request
+def init():
+ pass
+
+if __name__ == "__main__":
+ parser = argparse.ArgumentParser(description='Start THS-Raven', \
+ formatter_class=argparse.ArgumentDefaultsHelpFormatter)
+ parser.add_argument('--interface', default="localhost", \
+ help='Interface on which flask (this server) will take requests on')
+ parser.add_argument('--port', default="5000", \
+ help='Port on which flask (this server) will take requests on')
+
+
+ args = parser.parse_args()
+ app.run(host=args.interface, port=args.port)
\ No newline at end of file
diff --git a/static/files/.gitkeep b/static/files/.gitkeep
new file mode 100644
index 0000000..e69de29
diff --git a/templates/head.html b/templates/head.html
new file mode 100644
index 0000000..6105517
--- /dev/null
+++ b/templates/head.html
@@ -0,0 +1,22 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/templates/index.html b/templates/index.html
new file mode 100644
index 0000000..935b156
--- /dev/null
+++ b/templates/index.html
@@ -0,0 +1,43 @@
+
+
+
+ {% include 'head.html' %}
+
+
+
+ {% include 'navbar.html' %}
+
+
+
+
+ | Dokument |
+ Ort |
+ Blowerdoor KW |
+ Bauherr |
+ Dokument Erstellungsdatum |
+
+
+
+ {% for bd in listContent %}
+
+ | {{ bd.docName }} |
+ {{ bd.location }} |
+ {{ bd.blowerdoorDate }} |
+ {{ bd.customer }} |
+ {{ bd.pdfDate.strftime("%d.%m.%Y") }} |
+
+ {% endfor %}
+
+
+
+
+
+
+
+
diff --git a/templates/navbar.html b/templates/navbar.html
new file mode 100644
index 0000000..7f30e7a
--- /dev/null
+++ b/templates/navbar.html
@@ -0,0 +1,27 @@
+
+
+