created code, for printing the Ruder-IDs

This commit is contained in:
2026-03-27 07:38:56 +01:00
parent cfe8aaa4e9
commit 46666a6088
5 changed files with 223 additions and 0 deletions

15
LaTex/Ruder-IDs.csv Normal file
View File

@@ -0,0 +1,15 @@
Ruder-ID
S-C2-H-201X-98-B-sk
S-C2-H-201X-97-B-sk
S-C2-H-201X-99-B-sk
S-C2-H-201X-96-B-sk
S-C2-H-201X-98-B-sk
S-C2-H-201X-97-B-sk
S-C2-H-201X-99-B-sk
S-C2-H-201X-96-B-sk
S-C2-H-201X-98-B-sk
S-C2-H-201X-97-B-sk
S-C2-H-201X-99-B-sk
S-C2-H-201X-96-B-sk
S-C2-H-201X-98-B-sk
S-C2-H-201X-97-B-sk
1 Ruder-ID
2 S-C2-H-201X-98-B-sk
3 S-C2-H-201X-97-B-sk
4 S-C2-H-201X-99-B-sk
5 S-C2-H-201X-96-B-sk
6 S-C2-H-201X-98-B-sk
7 S-C2-H-201X-97-B-sk
8 S-C2-H-201X-99-B-sk
9 S-C2-H-201X-96-B-sk
10 S-C2-H-201X-98-B-sk
11 S-C2-H-201X-97-B-sk
12 S-C2-H-201X-99-B-sk
13 S-C2-H-201X-96-B-sk
14 S-C2-H-201X-98-B-sk
15 S-C2-H-201X-97-B-sk

BIN
LaTex/print_Ruder-IDs.pdf Normal file

Binary file not shown.

27
LaTex/print_Ruder-IDs.tex Normal file
View File

@@ -0,0 +1,27 @@
\documentclass[a4paper,12pt]{article}
\usepackage[utf8]{inputenc}
\usepackage{csvsimple}
\usepackage{geometry}
\usepackage{array}
\usepackage{longtable}
\usepackage{anyfontsize}
\usepackage{xcolor}
\usepackage{colortbl}
\geometry{a4paper, margin=0in}
% Define light grey color
\definecolor{lightgrey}{gray}{0.9}
\begin{document}
\begin{center}
\renewcommand{\arraystretch}{1.6}
\bfseries
\fontsize{40}{50}\selectfont % Set font size to 50pt, line spacing to 60pt
\begin{longtable}{>{\centering\arraybackslash}p{\textwidth}}
\\[20pt]
\csvreader[head to column names]{Ruder-IDs.csv}{}{\csvcoli \\[20pt] \arrayrulecolor{lightgrey}\hline \\[20pt]}
\end{longtable}
\end{center}
\end{document}

View File

@@ -0,0 +1,91 @@
{
"cells": [
{
"cell_type": "code",
"execution_count": null,
"id": "3a384a62",
"metadata": {},
"outputs": [],
"source": [
"import requests\n",
"import pandas as pd\n",
"from io import BytesIO\n",
"import os"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "05055b94",
"metadata": {},
"outputs": [],
"source": [
"# --- Configuration ---\n",
"NEXTCLOUD_URL = \"https://nextcloud.karnelegger.eu\"\n",
"USERNAME = \"Georg Brantegger\"\n",
"with open('app_pw.txt','r') as f:\n",
" APP_PASSWORD = f.readline()\n"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "13fb9852",
"metadata": {},
"outputs": [],
"source": [
"# read list of boats\n",
"\n",
"FILE_PATH = \"Shared/Ruderverein/Material/Ruderliste.xlsx\"\n",
"\n",
"# Build the WebDAV URL\n",
"# Note: Path should be URL-encoded if it contains spaces or special characters\n",
"webdav_url = f\"{NEXTCLOUD_URL}/remote.php/dav/files/{USERNAME}/{FILE_PATH}\"\n",
"\n",
"# --- The Request ---\n",
"response = requests.get(webdav_url, auth=(USERNAME, APP_PASSWORD))\n",
"\n",
"if response.status_code == 200:\n",
" # Use BytesIO to turn the raw binary content into a file-like object\n",
" oars_df = pd.read_excel(BytesIO(response.content))\n",
" print(\"File loaded successfully!\")\n",
"else:\n",
" print(f\"Failed to fetch file. Status code: {response.status_code}\")\n",
" print(response.text)"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "d6394323",
"metadata": {},
"outputs": [],
"source": [
"parent_folder = os.path.dirname(os.getcwd())\n",
"target_path = os.path.join(parent_folder,'LaTex','Ruder-IDs.csv')\n",
"oars_df['Ruder-ID'].to_csv(target_path,index=False)"
]
}
],
"metadata": {
"kernelspec": {
"display_name": ".venv",
"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.12.3"
}
},
"nbformat": 4,
"nbformat_minor": 5
}

View File

@@ -0,0 +1,90 @@
{
"cells": [
{
"cell_type": "code",
"execution_count": null,
"id": "e4755f4e",
"metadata": {},
"outputs": [],
"source": [
"import requests\n",
"import os"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "689fd1ef",
"metadata": {},
"outputs": [],
"source": [
"# --- Configuration ---\n",
"NEXTCLOUD_URL = \"https://nextcloud.karnelegger.eu\"\n",
"USERNAME = \"Georg Brantegger\"\n",
"with open('app_pw.txt','r') as f:\n",
" APP_PASSWORD = f.readline()\n"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "4967214a",
"metadata": {},
"outputs": [],
"source": [
"parent_folder = os.path.dirname(os.getcwd())\n",
"LOCAL_FILE_PATH = os.path.join(parent_folder,'LaTex','print_Ruder-IDs.pdf')\n",
"REMOTE_FILE_PATH = \"Shared/Ruderverein/Material/print_Ruder-IDs.pdf\""
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "515eaaac",
"metadata": {},
"outputs": [],
"source": [
"\n",
"\n",
"# --- Construction ---\n",
"# The WebDAV endpoint for files is /remote.php/dav/files/USER/\n",
"upload_url = f\"{NEXTCLOUD_URL}/remote.php/dav/files/{USERNAME}/{REMOTE_FILE_PATH}\"\n",
"\n",
"with open(LOCAL_FILE_PATH, 'rb') as f:\n",
" response = requests.put(\n",
" upload_url, \n",
" data=f, \n",
" auth=(USERNAME, APP_PASSWORD)\n",
" )\n",
"\n",
"# --- Results ---\n",
"if response.status_code in [201, 204]:\n",
" print(\"Upload successful!\")\n",
"else:\n",
" print(f\"Failed! Status code: {response.status_code}\")\n",
" print(response.text)"
]
}
],
"metadata": {
"kernelspec": {
"display_name": ".venv",
"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.12.3"
}
},
"nbformat": 4,
"nbformat_minor": 5
}