Release 1.2.0: wxPython migration + vacation exclusion

This commit is contained in:
2026-03-02 17:37:10 +01:00
parent 07c8905f47
commit db76fbf0d2
14 changed files with 190 additions and 939 deletions

View File

@@ -154,7 +154,7 @@ def parse_dienstplan_table(table, month_start_str):
return events
def create_ics_from_dienstplan(dienstplan, output_path=None, exclude_rest=False):
def create_ics_from_dienstplan(dienstplan, output_path=None, exclude_rest=False, exclude_vacation=False):
"""
Erstellt eine ICS-Datei aus den Dienstplan-Daten
@@ -162,6 +162,7 @@ def create_ics_from_dienstplan(dienstplan, output_path=None, exclude_rest=False)
dienstplan: Dictionary mit Dienstplan-Daten
output_path: Pfad für Output-Datei
exclude_rest: Wenn True, werden Ruhepausen nicht exportiert
exclude_vacation: Wenn True, wird Urlaub (060/0060) nicht exportiert
"""
# Erstelle Calendar
cal = Calendar()
@@ -182,12 +183,13 @@ def create_ics_from_dienstplan(dienstplan, output_path=None, exclude_rest=False)
continue
service_type = event_data['service']
normalized_service_type = service_type.lstrip('0') or '0'
event = Event()
# Titel - nur den Dienstart
# Spezielle Service-Typen mit aussagekräftigen Namen
if service_type == '0060':
if normalized_service_type == '60':
title = "Urlaub"
elif service_type in rest_types:
title = "Ruhe"
@@ -197,6 +199,10 @@ def create_ics_from_dienstplan(dienstplan, output_path=None, exclude_rest=False)
# Überspringe Ruhepausen wenn gewünscht (nach Titel-Erstellung)
if exclude_rest and title == "Ruhe":
continue
# Überspringe Urlaub wenn gewünscht (060/0060)
if exclude_vacation and title == "Urlaub":
continue
event.add('summary', title)
@@ -268,6 +274,7 @@ Beispiele:
python3 pdf_to_ics.py # Konvertiere alle PDFs im aktuellen Verzeichnis
python3 pdf_to_ics.py --input ./pdfs --output ./ics # PDFs aus ./pdfs → ICS zu ./ics
python3 pdf_to_ics.py --input ./pdfs --exclude-rest # Schließe Ruhetage aus
python3 pdf_to_ics.py --input ./pdfs --exclude-vacation # Schließe Urlaub (060) aus
python3 pdf_to_ics.py file.pdf # Konvertiere einzelne Datei
"""
)
@@ -296,6 +303,12 @@ Beispiele:
action='store_true',
help='Ruhetage ausschließen (Ruhe, R56, R36, vRWF48, RWE, vR48)'
)
parser.add_argument(
'-u', '--exclude-vacation',
action='store_true',
help='Urlaub ausschließen (060, 0060)'
)
parser.add_argument(
'-v', '--verbose',
@@ -336,6 +349,8 @@ Beispiele:
print(f"📄 PDF-Dateien gefunden: {len(pdf_files)}")
if args.exclude_rest:
print("🧘 Ruhetage werden ausgeschlossen")
if args.exclude_vacation:
print("🏖️ Urlaub (060) wird ausgeschlossen")
print()
success_count = 0
@@ -362,7 +377,12 @@ Beispiele:
# Erstelle ICS-Datei
ics_filename = pdf_file.stem + '.ics'
ics_path = output_dir / ics_filename
create_ics_from_dienstplan(dienstplan, str(ics_path), exclude_rest=args.exclude_rest)
create_ics_from_dienstplan(
dienstplan,
str(ics_path),
exclude_rest=args.exclude_rest,
exclude_vacation=args.exclude_vacation
)
print(f" ✓ ICS erstellt: {ics_path}")
success_count += 1