cleared outputs

This commit is contained in:
2026-03-26 14:40:48 +01:00
parent ad5286b043
commit cfe8aaa4e9
3 changed files with 179 additions and 55 deletions

View File

@@ -2,7 +2,7 @@
"cells": [
{
"cell_type": "code",
"execution_count": 8,
"execution_count": null,
"id": "152c4ce0",
"metadata": {},
"outputs": [],
@@ -12,7 +12,7 @@
},
{
"cell_type": "code",
"execution_count": 9,
"execution_count": null,
"id": "041b0ab6",
"metadata": {},
"outputs": [],
@@ -30,7 +30,7 @@
},
{
"cell_type": "code",
"execution_count": 10,
"execution_count": null,
"id": "19ec4c3e",
"metadata": {},
"outputs": [],
@@ -45,7 +45,7 @@
" # WebDAV returns 405 Method Not Allowed if the folder already exists\n",
" print(f\"⏩ Skipped: Folder already exists at {folder_url}\")\n",
" elif response.status_code == 409:\n",
" print(f\" Error: Parent folder doesn't exist for {folder_url}\")\n",
" print(f\" Error: Parent folder doesn't exist for {folder_url}\")\n",
" else:\n",
" print(f\"❌ Error {response.status_code}: Could not create folder.\")\n",
" print(response.text)"
@@ -53,7 +53,7 @@
},
{
"cell_type": "code",
"execution_count": 11,
"execution_count": null,
"id": "b4c04efb",
"metadata": {},
"outputs": [],
@@ -107,43 +107,10 @@
},
{
"cell_type": "code",
"execution_count": 12,
"execution_count": null,
"id": "306aef25",
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"⏩ Skipped: Folder already exists at https://nextcloud.karnelegger.eu/remote.php/dav/files/Georg Brantegger/Shared/Ruderverein/Videoanalyse\n",
"Fetching contacts from the 'rv-villach-athletinnen' address book...\n",
"✅ Success: Created folder at https://nextcloud.karnelegger.eu/remote.php/dav/files/Georg Brantegger/Shared/Ruderverein/Videoanalyse/Aufegger%20Tobias\n",
"✅ Success: Created folder at https://nextcloud.karnelegger.eu/remote.php/dav/files/Georg Brantegger/Shared/Ruderverein/Videoanalyse/Praschnig%20Flora\n",
"✅ Success: Created folder at https://nextcloud.karnelegger.eu/remote.php/dav/files/Georg Brantegger/Shared/Ruderverein/Videoanalyse/Buchacher%20Eva\n",
"✅ Success: Created folder at https://nextcloud.karnelegger.eu/remote.php/dav/files/Georg Brantegger/Shared/Ruderverein/Videoanalyse/Gigacher%20Olivia\n",
"✅ Success: Created folder at https://nextcloud.karnelegger.eu/remote.php/dav/files/Georg Brantegger/Shared/Ruderverein/Videoanalyse/McGrath%20Samuel\n",
"✅ Success: Created folder at https://nextcloud.karnelegger.eu/remote.php/dav/files/Georg Brantegger/Shared/Ruderverein/Videoanalyse/Magdalena%20Truppe\n",
"✅ Success: Created folder at https://nextcloud.karnelegger.eu/remote.php/dav/files/Georg Brantegger/Shared/Ruderverein/Videoanalyse/Yang%20Ruien\n",
"✅ Success: Created folder at https://nextcloud.karnelegger.eu/remote.php/dav/files/Georg Brantegger/Shared/Ruderverein/Videoanalyse/Yang%20Xiaoen\n",
"✅ Success: Created folder at https://nextcloud.karnelegger.eu/remote.php/dav/files/Georg Brantegger/Shared/Ruderverein/Videoanalyse/Kofler%20Hannah\n",
"✅ Success: Created folder at https://nextcloud.karnelegger.eu/remote.php/dav/files/Georg Brantegger/Shared/Ruderverein/Videoanalyse/Tropea%20Manfredi\n",
"✅ Success: Created folder at https://nextcloud.karnelegger.eu/remote.php/dav/files/Georg Brantegger/Shared/Ruderverein/Videoanalyse/Spath-Glantschnig%20%20Christoph\n",
"✅ Success: Created folder at https://nextcloud.karnelegger.eu/remote.php/dav/files/Georg Brantegger/Shared/Ruderverein/Videoanalyse/Acerbi%20Sofia\n",
"✅ Success: Created folder at https://nextcloud.karnelegger.eu/remote.php/dav/files/Georg Brantegger/Shared/Ruderverein/Videoanalyse/Aufegger%20Emilia\n",
"✅ Success: Created folder at https://nextcloud.karnelegger.eu/remote.php/dav/files/Georg Brantegger/Shared/Ruderverein/Videoanalyse/Henriks%20Alva\n",
"✅ Success: Created folder at https://nextcloud.karnelegger.eu/remote.php/dav/files/Georg Brantegger/Shared/Ruderverein/Videoanalyse/Tscherne%20Tobias\n",
"✅ Success: Created folder at https://nextcloud.karnelegger.eu/remote.php/dav/files/Georg Brantegger/Shared/Ruderverein/Videoanalyse/Pressinger%20Laurin\n",
"✅ Success: Created folder at https://nextcloud.karnelegger.eu/remote.php/dav/files/Georg Brantegger/Shared/Ruderverein/Videoanalyse/Bodner%20Emma\n",
"✅ Success: Created folder at https://nextcloud.karnelegger.eu/remote.php/dav/files/Georg Brantegger/Shared/Ruderverein/Videoanalyse/Jop%20Nicolas\n",
"✅ Success: Created folder at https://nextcloud.karnelegger.eu/remote.php/dav/files/Georg Brantegger/Shared/Ruderverein/Videoanalyse/Assmann-Hafenscherer%20Felix\n",
"✅ Success: Created folder at https://nextcloud.karnelegger.eu/remote.php/dav/files/Georg Brantegger/Shared/Ruderverein/Videoanalyse/Henriks%20Konstantin\n",
"✅ Success: Created folder at https://nextcloud.karnelegger.eu/remote.php/dav/files/Georg Brantegger/Shared/Ruderverein/Videoanalyse/Loidl%20Lieselotte\n",
"✅ Success: Created folder at https://nextcloud.karnelegger.eu/remote.php/dav/files/Georg Brantegger/Shared/Ruderverein/Videoanalyse/Poga%C4%8Dar%20Anamary\n",
"✅ Success: Created folder at https://nextcloud.karnelegger.eu/remote.php/dav/files/Georg Brantegger/Shared/Ruderverein/Videoanalyse/Polessnig%20Valentina\n",
"✅ Success: Created folder at https://nextcloud.karnelegger.eu/remote.php/dav/files/Georg Brantegger/Shared/Ruderverein/Videoanalyse/Paulik%20Elena\n"
]
}
],
"outputs": [],
"source": [
"# 1. Create the main base folder first (just in case it doesn't exist)\n",
"create_nextcloud_folder(WEBDAV_BASE_URL)\n",

View File

@@ -2,7 +2,7 @@
"cells": [
{
"cell_type": "code",
"execution_count": 83,
"execution_count": null,
"id": "152c4ce0",
"metadata": {},
"outputs": [],
@@ -15,7 +15,7 @@
},
{
"cell_type": "code",
"execution_count": 84,
"execution_count": null,
"id": "041b0ab6",
"metadata": {},
"outputs": [],
@@ -29,7 +29,7 @@
},
{
"cell_type": "code",
"execution_count": 85,
"execution_count": null,
"id": "b4c04efb",
"metadata": {},
"outputs": [],
@@ -86,18 +86,10 @@
},
{
"cell_type": "code",
"execution_count": 86,
"execution_count": null,
"id": "3efe3bb1",
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Fetching contacts from the 'rv-villach-athletinnen' address book...\n"
]
}
],
"outputs": [],
"source": [
"a,b,c,d = get_athlete_data()\n",
"data_dict = {'Nachname':a,'Vorname':b,'Gender':c,'Jahrgang':d}\n",
@@ -107,7 +99,7 @@
},
{
"cell_type": "code",
"execution_count": 87,
"execution_count": null,
"id": "a65d7693",
"metadata": {},
"outputs": [],
@@ -152,7 +144,7 @@
},
{
"cell_type": "code",
"execution_count": 90,
"execution_count": null,
"id": "7ff6f41c",
"metadata": {},
"outputs": [],

View File

@@ -0,0 +1,165 @@
{
"cells": [
{
"cell_type": "code",
"execution_count": null,
"id": "f46948ac",
"metadata": {},
"outputs": [],
"source": [
"import requests\n",
"import pandas as pd\n",
"from io import BytesIO"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "3a1de802",
"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": "1fdfef34",
"metadata": {},
"outputs": [],
"source": [
"# read list of boats\n",
"\n",
"FILE_PATH = \"Shared/Ruderverein/Material/Bootsliste.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",
" boats_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": "80f97e18",
"metadata": {},
"outputs": [],
"source": [
"def analyse_class(row):\n",
" boot_class = row['Bootsklasse']\n",
"\n",
" number_seats = 0\n",
" variable = False\n",
"\n",
" for i in range(8+1):\n",
" if str(i) in boot_class:\n",
" number_seats = i\n",
" break\n",
" \n",
" if '/' in boot_class:\n",
" variable = True\n",
"\n",
" return number_seats, variable\n",
"\n"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "70fb2327",
"metadata": {},
"outputs": [],
"source": [
"boats_df[['number_seats','variable']] = boats_df.apply(analyse_class,axis=1,result_type='expand')"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "bf18a0fd",
"metadata": {},
"outputs": [],
"source": [
"boat_names = []\n",
"variants = []\n",
"places = []\n",
"\n",
"for boat_name in df['Name'].unique():\n",
" number_seats = df.loc[df['Name']==boat_name,'number_seats'].values[0]\n",
" variable = df.loc[df['Name']==boat_name,'variable'].values[0]\n",
"\n",
" if bool(variable) is False:\n",
" for place in range(1,number_seats+1):\n",
" boat_names.append(boat_name)\n",
" variants.append(f\"{number_seats}x\")\n",
" places.append(place)\n",
" elif bool(variable) is True:\n",
" for place in range(1,number_seats+1):\n",
" boat_names.append(boat_name)\n",
" variants.append(f\"{number_seats}x\")\n",
" places.append(place)\n",
" for place in range(1,number_seats+1):\n",
" boat_names.append(boat_name)\n",
" variants.append(f\"{number_seats}-\")\n",
" places.append(place)"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "85059518",
"metadata": {},
"outputs": [],
"source": [
"data_dict = {'Bootsname':boat_names,'Trimmung':variants,'Bootsplatz':places,'Ruder-ID':[None for _ in boat_names]}\n",
"places_df = pd.DataFrame(data_dict)"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "3071bf52",
"metadata": {},
"outputs": [],
"source": [
"places_df.to_excel('temp.xlsx')"
]
}
],
"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
}