Compare commits

...

2 Commits

8 changed files with 243 additions and 1003 deletions

2
.gitignore vendored
View File

@@ -507,3 +507,5 @@ TSWLatexianTemp*
# Uncomment the next line to have this generated file ignored.
#*Notes.bib
LaTex/print_Ruder-IDs.pdf
LaTex/Ruder-IDs.csv

View File

@@ -1,79 +1,47 @@
S-C2-M-19XX-01-B/S
S-Sw-M-201X-01-B/S
S-Sw-M-201X-02-B/S
S-Sw-M-201X-03-B/S
S-Sw-M-201X-04-B/S
S-Cr-M-200X-01-B/S
S-Cr-M-200X-02-B/S
S-Cr-M-200X-03-B/S
S-Cr-M-200X-04-B/S
S-Cr-M-200X-05-B/S
S-Cr-M-200X-06-B/S
S-Cr-M-200X-07-B/S
S-Cr-M-200X-08-B/S
S-Cr-M-200X-09-B/S
S-Cr-M-200X-10-B/S
S-Cr-M-200X-11-B/S
S-Cr-H-200X-01-B/S
S-Cr-H-200X-02-B/S
S-Cr-H-200X-03-B/S
S-Cr-H-200X-04-B/S
S-Cr-H-200X-05-B/S
S-C2-H-201X-01-B/S
S-C2-H-201X-02-B/S
S-C2-H-201X-03-B/S
S-C2-H-201X-04-B/S
S-C2-H-201X-05-B/S
S-C2-H-201X-06-B/S
S-C2-H-201X-07-B/S
S-C2-H-201X-08-B/S
S-C2-H-201X-09-B/S
S-C2-H-201X-10-B/S
S-C2-H-201X-11-B/S
S-C2-H-201X-12-B/S
S-C2-H-201X-13-B/S
S-C2-H-201X-14-B/S
S-C2-H-201X-15-B/S
S-C2-H-201X-16-B/S
S-C2-H-201X-17-B/S
S-C2-H-201X-20-B/S-sk
S-C2-H-201X-21-B/S-sk
S-C2-H-201X-22-B/S-sk
S-C2-H-201X-23-B/S-sk
S-C2-H-201X-24-B/S-sk
S-C2-H-201X-25-B/S-sk
S-C2-H-201X-26-B/S-sk
S-C2-H-202X-01-B/S-sk
S-C2-H-202X-02-B/S-sk
S-C2-H-202X-03-B/S-sk
R-Em-H-19XX-00/01
R-Em-H-19XX-02/3
R-Em-H-19XX-02/03
R-Em-H-19XX-04/5
R-Em-H-19XX-04/05
R-Em-H-19XX-06/7
R-Em-H-19XX-06/07
R-Em-H-19XX-08/9
R-Cr-H-200X-00/01
R-Cr-H-200X-02/3
R-Cr-H-200X-02/03
R-Cr-H-200X-04/5
R-Cr-H-200X-04/05
R-Cr-H-200X-06/7
R-Cr-H-200X-06/07
R-Cr-H-200X-08/9
R-Cr-H-200X-08/09
R-Cr-H-200X-10/11
R-Cr-H-200X-12/13
R-Cr-H-200X-14/15
R-C2-H-201X-00/01-sk
R-C2-H-201X-02/3-sk
R-C2-H-201X-02/03-sk
R-C2-H-201X-04/5-sk
R-C2-H-201X-04/05-sk
R-C2-H-201X-06/7-sk
R-C2-H-201X-06/07-sk
R-C2-H-201X-08/9-sk
R-C2-H-201X-08/09-sk
R-C2-H-201X-10/11-sk
R-C2-H-201X-12/13-sk
Angie
Architekten Lechner
ASVK
Autohaus Velden
Bootolo
C3er
C4er
Carb\&Curvy
Carinthischer Sommer
Cito
E.H.
Empacher 2
Feuerberg
Flugbügel CL1
Gelber Schelle 2x
Hans und Erni
HGC Group/Max
HGC/Felix/Thor
Hydrant
in Ligno
Kärnten Sport
Killer
Kleine Zeitung
Leonie
Lupo
Manze
Mastä
Niebelungen
Noze
Paracelsus
Pegasus
Peter Pan
Phönix
Pra
Regnitz
Skye
State of the Art
Steinstark
Ulli
Velocitas
Veronika
Victoria
Villach Sport
Villach:Sport 8+
Villacher Bier
Villacher Faschingsgilde
Zernatto
1 S-C2-M-19XX-01-B/S Angie
2 S-Sw-M-201X-01-B/S Architekten Lechner
3 S-Sw-M-201X-02-B/S ASVK
4 S-Sw-M-201X-03-B/S Autohaus Velden
5 S-Sw-M-201X-04-B/S Bootolo
6 S-Cr-M-200X-01-B/S C3er
7 S-Cr-M-200X-02-B/S C4er
8 S-Cr-M-200X-03-B/S Carb\&Curvy
9 S-Cr-M-200X-04-B/S Carinthischer Sommer
10 S-Cr-M-200X-05-B/S Cito
11 S-Cr-M-200X-06-B/S E.H.
12 S-Cr-M-200X-07-B/S Empacher 2
13 S-Cr-M-200X-08-B/S Feuerberg
14 S-Cr-M-200X-09-B/S Flugbügel CL1
15 S-Cr-M-200X-10-B/S Gelber Schelle 2x
16 S-Cr-M-200X-11-B/S Hans und Erni
17 S-Cr-H-200X-01-B/S HGC Group/Max
18 S-Cr-H-200X-02-B/S HGC/Felix/Thor
19 S-Cr-H-200X-03-B/S Hydrant
20 S-Cr-H-200X-04-B/S in Ligno
21 S-Cr-H-200X-05-B/S Kärnten Sport
22 S-C2-H-201X-01-B/S Killer
23 S-C2-H-201X-02-B/S Kleine Zeitung
24 S-C2-H-201X-03-B/S Leonie
25 S-C2-H-201X-04-B/S Lupo
26 S-C2-H-201X-05-B/S Manze
27 S-C2-H-201X-06-B/S Mastä
28 S-C2-H-201X-07-B/S Niebelungen
29 S-C2-H-201X-08-B/S Noze
30 S-C2-H-201X-09-B/S Paracelsus
31 S-C2-H-201X-10-B/S Pegasus
32 S-C2-H-201X-11-B/S Peter Pan
33 S-C2-H-201X-12-B/S Phönix
34 S-C2-H-201X-13-B/S Pra
35 S-C2-H-201X-14-B/S Regnitz
36 S-C2-H-201X-15-B/S Skye
37 S-C2-H-201X-16-B/S State of the Art
38 S-C2-H-201X-17-B/S Steinstark
39 S-C2-H-201X-20-B/S-sk Ulli
40 S-C2-H-201X-21-B/S-sk Velocitas
41 S-C2-H-201X-22-B/S-sk Veronika
42 S-C2-H-201X-23-B/S-sk Victoria
43 S-C2-H-201X-24-B/S-sk Villach Sport
44 S-C2-H-201X-25-B/S-sk Villach:Sport 8+
45 S-C2-H-201X-26-B/S-sk Villacher Bier
46 S-C2-H-202X-01-B/S-sk Villacher Faschingsgilde
47 S-C2-H-202X-02-B/S-sk Zernatto
S-C2-H-202X-03-B/S-sk
R-Em-H-19XX-00/01
R-Em-H-19XX-02/3
R-Em-H-19XX-02/03
R-Em-H-19XX-04/5
R-Em-H-19XX-04/05
R-Em-H-19XX-06/7
R-Em-H-19XX-06/07
R-Em-H-19XX-08/9
R-Cr-H-200X-00/01
R-Cr-H-200X-02/3
R-Cr-H-200X-02/03
R-Cr-H-200X-04/5
R-Cr-H-200X-04/05
R-Cr-H-200X-06/7
R-Cr-H-200X-06/07
R-Cr-H-200X-08/9
R-Cr-H-200X-08/09
R-Cr-H-200X-10/11
R-Cr-H-200X-12/13
R-Cr-H-200X-14/15
R-C2-H-201X-00/01-sk
R-C2-H-201X-02/3-sk
R-C2-H-201X-02/03-sk
R-C2-H-201X-04/5-sk
R-C2-H-201X-04/05-sk
R-C2-H-201X-06/7-sk
R-C2-H-201X-06/07-sk
R-C2-H-201X-08/9-sk
R-C2-H-201X-08/09-sk
R-C2-H-201X-10/11-sk
R-C2-H-201X-12/13-sk

Binary file not shown.

View File

@@ -141,7 +141,7 @@
"df['Nachname'] = df['Nachname'].str.strip()\n",
"df['rower'] = df.apply(evaluate_rower,axis=1,args=('rower',))\n",
"df['Telefonnummer'] = df.apply(extract_tel,axis=1,args=('Telefonnummer',))\n",
"df['Foto'] = df['Foto'].str.replace(' ','-').fillna('-')"
"df['Foto'] = df['Foto'].fillna('-').str.replace(' ','-').fillna('-')"
]
},
{
@@ -277,7 +277,7 @@
],
"metadata": {
"kernelspec": {
"display_name": ".venv (3.13.7)",
"display_name": ".venv (3.14.4)",
"language": "python",
"name": "python3"
},
@@ -291,7 +291,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.13.7"
"version": "3.14.4"
}
},
"nbformat": 4,

View File

@@ -129,7 +129,7 @@
],
"metadata": {
"kernelspec": {
"display_name": ".venv (3.13.7)",
"display_name": ".venv (3.14.4.final.0)",
"language": "python",
"name": "python3"
},
@@ -143,7 +143,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.13.7"
"version": "3.14.4"
}
},
"nbformat": 4,

View File

@@ -0,0 +1,149 @@
{
"cells": [
{
"cell_type": "code",
"execution_count": null,
"id": "1b3ec01f",
"metadata": {},
"outputs": [],
"source": [
"# ===== CONFIGURATION =====\n",
"# --- 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",
"\n",
"\n",
"# Modern Nextcloud WebDAV endpoint format:\n",
"WEBDAV_BASE_URL = f\"{NEXTCLOUD_URL}/remote.php/dav/files/{USERNAME}/Shared/Ruderverein/02_Athlet:innen/01_Videoanalyse\"\n"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "c1f60f39",
"metadata": {},
"outputs": [],
"source": [
"import os\n",
"from nc_py_api import Nextcloud\n",
"\n",
"def rename_videos_via_api():\n",
" # Initialize the Nextcloud client\n",
" nc = Nextcloud(\n",
" nextcloud_url=NEXTCLOUD_URL, \n",
" nc_auth_user=USERNAME, \n",
" nc_auth_pass=APP_PASSWORD\n",
" )\n",
"\n",
" # The path to your shared folder relative to your user's root\n",
" base_folder = \"Shared/Ruderverein/02_Athlet:innen/01_Videoanalyse\" \n",
"\n",
" print(f\"Fetching folders from: {base_folder}...\")\n",
" \n",
" # 1. Get all items in the base directory\n",
" try:\n",
" items_in_base = nc.files.listdir(base_folder)\n",
" except Exception as e:\n",
" print(f\"Error accessing base folder: {e}\")\n",
" return\n",
"\n",
" # Filter for directories only (the athlete subfolders)\n",
" athlete_folders = [item for item in items_in_base if item.is_dir]\n",
"\n",
" for folder in athlete_folders:\n",
" print(f\"\\nProcessing athlete: {folder.name}\")\n",
"\n",
" # 2. Gather files inside the athlete's folder\n",
" folder_contents = nc.files.listdir(folder.user_path)\n",
" \n",
" # Gather all valid files (ignoring directories and hidden files)\n",
" all_files = [f for f in folder_contents if not f.is_dir and not f.name.startswith('.')]\n",
"\n",
" if not all_files:\n",
" print(\" No files found. Skipping.\")\n",
" continue\n",
"\n",
" # Lists to separate files we want to rename\n",
" files_to_rename = []\n",
"\n",
" # 1. Check for XMLs to delete, and separate the rest for renaming\n",
" for file_node in all_files:\n",
" extension = os.path.splitext(file_node.name)[1].lower()\n",
" \n",
" if extension == '.xml':\n",
" print(f\" -> 🗑️ Deleting XML: {file_node.name}\")\n",
" nc.files.delete(file_node.user_path)\n",
" else:\n",
" files_to_rename.append(file_node)\n",
"\n",
" # If there were only XMLs and now nothing is left, move to the next athlete\n",
" if not files_to_rename:\n",
" continue\n",
"\n",
" # 2. Sort the remaining files by modification date\n",
" files_to_rename.sort(key=lambda x: x.info._last_modified)\n",
" new_filenames =[x.info._last_modified.strftime('%Y-%m-%d_%H-%M-%S') for x in files_to_rename]\n",
"\n",
"\n",
" # 4. Safety Step: Rename to temporary names to avoid collisions\n",
" temp_files = []\n",
" for index, file_node in enumerate(files_to_rename):\n",
" # Extract the directory path and the original file extension\n",
" directory, old_filename = os.path.split(file_node.user_path)\n",
" extension = os.path.splitext(old_filename)[1]\n",
" \n",
" temp_name = f\"__temp_{index}__{extension}\"\n",
" temp_path = f\"{directory}/{temp_name}\"\n",
" \n",
" # In Nextcloud/WebDAV APIs, renaming a file is executed as a \"move\" command\n",
" nc.files.move(file_node.user_path, temp_path)\n",
" temp_files.append((temp_path, extension, old_filename))\n",
"\n",
" # 5. Final Rename: Apply the sequential counting names\n",
" for index, (temp_path, extension, old_filename) in enumerate(temp_files, start=1):\n",
" directory, _ = os.path.split(temp_path)\n",
" new_name = f\"{new_filenames[index-1]}{extension}\"\n",
" final_path = f\"{directory}/{new_name}\"\n",
" \n",
" i = 1\n",
" try:\n",
" nc.files.move(temp_path, final_path)\n",
" print(f\" -> Renamed {old_filename} to {new_name}\")\n",
" except:\n",
" new_name = f\"{new_filenames[index-1]}_{i}{extension}\"\n",
" final_path = f\"{directory}/{new_name}\"\n",
" nc.files.move(temp_path, final_path)\n",
" i += 1\n",
" print(f\" -> Renamed {old_filename} to {new_name}\")\n",
"\n",
" print(\"\\n✅ All athlete folders have been processed via the API!\")\n",
"\n",
"if __name__ == \"__main__\":\n",
" rename_videos_via_api()"
]
}
],
"metadata": {
"kernelspec": {
"display_name": ".venv (3.14.4.final.0)",
"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.14.4"
}
},
"nbformat": 4,
"nbformat_minor": 5
}

File diff suppressed because it is too large Load Diff

View File

@@ -21,6 +21,8 @@ def get_list_of_packages_to_load():
packages.append('requests')
packages.append('openpyxl')
packages.append('jinja2') # for styling
packages.append('nc-py-api')
packages.append('urllib3')
# packages.append('matplotlib')
# packages.append('pyqt5')