-
Notifications
You must be signed in to change notification settings - Fork 1
/
generate-qr.py
executable file
·58 lines (51 loc) · 1.22 KB
/
generate-qr.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# (Copyleft) Harald
import os, qrcode
from qrcode.image.styledpil import StyledPilImage
fablabMainURL = "https://fablab.fau.de/"
'''
!!!
Only place wordpress-permalinks in this list. Otherwise, links will break since machines are on sub-pages now.
!!!
'''
maschines = {
"fablab",
"lasercutter",
"multifunktionstisch",
"schneideplotter",
"textilpresse",
"ultraschallbad",
"cnc-drehbank",
"cnc-fraese",
"3d-drucker",
"reflow-ofen",
"staubsauger",
"dremel",
"fein-kleinbohrmaschine",
"feinschleifer",
"oberfraese",
"pendelstichsaege",
"tauchsaege",
"platinenfertigung",
"naehmaschine",
"oesen-und-druckknopfpresse",
"stickmaschine",
"standbohrmaschine",
"vp"
}
def makeQR(toolName, url):
#print("generating qr code for " + toolName+"...")
qr = qrcode.QRCode(error_correction=qrcode.constants.ERROR_CORRECT_H)
qr.add_data(url)
img = qr.make_image(image_factory=StyledPilImage, embeded_image_path="./fab_cube.png")
img.save(toolName+".png")
def main():
os.chdir(os.path.dirname(os.path.abspath(__file__)))
for name in maschines:
if name != "fablab":
makeQR(name, fablabMainURL + name)
else:
makeQR(name, fablabMainURL)
if __name__=="__main__":
main()