101 lines
4.1 KiB
Plaintext
101 lines
4.1 KiB
Plaintext
{
|
|
"cells": [
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": 6,
|
|
"metadata": {},
|
|
"outputs": [],
|
|
"source": [
|
|
"#import requests\n",
|
|
"#import re\n",
|
|
"#from bs4 import BeautifulSoup\n",
|
|
"import qrcode\n",
|
|
"from PIL import Image, ImageDraw, ImageFont\n",
|
|
" \n",
|
|
"#teamlinks = [[0 for x in range(3)] for y in range(17)]\n",
|
|
"teamlinks=[]\n",
|
|
"teamlinks.append(['1. Herren', 'https://www.esg-handball.de/teams/teammatches/90', 'H1'])\n",
|
|
"teamlinks.append(['1. Damen', 'https://www.esg-handball.de/teams/teammatches/12', 'D1'])\n",
|
|
"teamlinks.append(['2. Herren', 'https://www.esg-handball.de/teams/teammatches/2', 'H2'])\n",
|
|
"teamlinks.append(['2. Damen', 'https://www.esg-handball.de/teams/teammatches/39', 'D2'])\n",
|
|
"teamlinks.append(['3. Herren', 'https://www.esg-handball.de/teams/teammatches/48', 'H3'])\n",
|
|
"teamlinks.append(['4. Herren', 'https://www.esg-handball.de/teams/teammatches/11', 'H4'])\n",
|
|
"teamlinks.append(['5. Herren', 'https://www.esg-handball.de/teams/teammatches/80', 'H5'])\n",
|
|
"#teamlinks.append(['mA-Jugend', 'https://www.esg-handball.de/teams/teammatches/5', 'mA'])\n",
|
|
"teamlinks.append(['mB-Jugend', 'https://www.esg-handball.de/teams/teammatches/77', 'mB'])\n",
|
|
"teamlinks.append(['wB-Jugend', 'https://www.esg-handball.de/teams/teammatches/17', 'wB']) \n",
|
|
"teamlinks.append(['mC-Jugend', 'https://www.esg-handball.de/teams/teammatches/78', 'mC'])\n",
|
|
"teamlinks.append(['mC2-Jugend', 'https://www.esg-handball.de/teams/teammatches/14', 'mC2'])\n",
|
|
"#teamlinks.append(['wC-Jugend', 'https://www.esg-handball.de/teams/teammatches/16', 'wC'])\n",
|
|
"teamlinks.append(['gJD-Jugend', 'https://www.esg-handball.de/teams/teammatches/6', 'gJD'])\n",
|
|
"teamlinks.append(['gJD-Jugend', 'https://www.esg-handball.de/teams/teammatches/20', 'gJD2'])\n",
|
|
"teamlinks.append(['wd-Jugend', 'https://www.esg-handball.de/teams/teammatches/15', 'wD'])\n",
|
|
"teamlinks.append(['gJE-Jugend', 'https://www.esg-handball.de/teams/teammatches/7', 'gJE'])\n",
|
|
"teamlinks.append(['gJE-Jugend', 'https://www.esg-handball.de/teams/teammatches/20', 'gJE2'])\n",
|
|
"teamlinks.append(['gJE-Jugend', 'https://www.esg-handball.de/teams/teammatches/87', 'gJE3'])\n",
|
|
"teamlinks.append(['F-Jugend', 'https://www.esg-handball.de/teams/teammatches/8', 'F'])\n",
|
|
"teamlinks.append(['F-Jugend 2', 'https://www.esg-handball.de/teams/teammatches/64', 'F2'])\n",
|
|
"teamlinks.append(['Minis', 'https://www.esg-handball.de/teams/current/34', 'Mi'])\n",
|
|
" \n",
|
|
"\n",
|
|
"\n",
|
|
"\n",
|
|
"def gen_qrcode(name, link):\n",
|
|
"\timg_bg = Image.new('RGB', (135, 70), color = (0,0,0))\n",
|
|
"\tfnt = ImageFont.truetype('/System/Library/Fonts/Supplemental/Arial Bold.ttf', 60)\n",
|
|
"\td = ImageDraw.Draw(img_bg)\n",
|
|
"\tif len(name) == 3:\n",
|
|
"\t\td.text((5,3), name, font=fnt, fill=(255, 255, 255))\n",
|
|
"\telse :\n",
|
|
"\t\td.text((25,3), name, font=fnt, fill=(255, 255, 255))\n",
|
|
"\tqr = qrcode.QRCode(box_size=9,error_correction=qrcode.constants.ERROR_CORRECT_H)\n",
|
|
"\tqr.add_data(link)\n",
|
|
"\tqr.make()\n",
|
|
"\timg_qr = qr.make_image()\n",
|
|
"\n",
|
|
"\tpos = (int((img_qr.size[0] - img_bg.size[0])/2), int((img_qr.size[1] - img_bg.size[1])/2))\n",
|
|
"\n",
|
|
"\timg_qr.paste(img_bg, pos)\n",
|
|
"\timg_qr.save(name+'.png')\n",
|
|
"\t\t\n",
|
|
"#teamlinks.pop()\n",
|
|
"#teamlinks[len(teamlinks)-1][2]='F'\n",
|
|
"for team in (teamlinks):\n",
|
|
"\tgen_qrcode(team[2],team[1])\n"
|
|
]
|
|
},
|
|
{
|
|
"cell_type": "code",
|
|
"execution_count": null,
|
|
"metadata": {},
|
|
"outputs": [],
|
|
"source": []
|
|
}
|
|
],
|
|
"metadata": {
|
|
"@webio": {
|
|
"lastCommId": null,
|
|
"lastKernelId": null
|
|
},
|
|
"kernelspec": {
|
|
"display_name": "Python 3 (ipykernel)",
|
|
"language": "python",
|
|
"name": "python3"
|
|
},
|
|
"language_info": {
|
|
"codemirror_mode": {
|
|
"name": "ipython",
|
|
"version": 3
|
|
},
|
|
"file_extension": ".py",
|
|
"mimetype": "text/x-python",
|
|
"name": "python",
|
|
"nbconvert_exporter": "python",
|
|
"pygments_lexer": "ipython3",
|
|
"version": "3.13.6"
|
|
}
|
|
},
|
|
"nbformat": 4,
|
|
"nbformat_minor": 4
|
|
}
|