fix fix_campuszeit
This commit is contained in:
@@ -20,17 +20,16 @@ def replace_campus_timezone(directory):
|
|||||||
with open(filepath, 'r', encoding='utf-8') as f:
|
with open(filepath, 'r', encoding='utf-8') as f:
|
||||||
content = f.read()
|
content = f.read()
|
||||||
|
|
||||||
if 'TZID:Europe/Berlin' in content or 'TZID="Europe/Berlin"' in content:
|
|
||||||
# Remove VTIMEZONE block for CampusNetZeit (optional depending on needs)
|
|
||||||
# Use a regex if multiple VTIMEZONE blocks may exist
|
|
||||||
start_idx = content.find('BEGIN:VTIMEZONE')
|
start_idx = content.find('BEGIN:VTIMEZONE')
|
||||||
end_idx = content.find('END:VTIMEZONE', start_idx)
|
end_idx = content.find('END:VTIMEZONE', start_idx)
|
||||||
if start_idx != -1 and end_idx != -1:
|
if start_idx != -1 and end_idx != -1:
|
||||||
content = content[:start_idx] + content[end_idx + len('END:VTIMEZONE\n'):]
|
content = content[:start_idx] + content[end_idx + len('END:VTIMEZONE\n'):]
|
||||||
|
|
||||||
# Replace all TZID references
|
# Replace all TZID references
|
||||||
content = content.replace('TZID:Europe/Berlin', 'TZID:Europe/Berlin')
|
content = content.replace('TZID:CampusNetZeit', 'TZID:Europe/Berlin')
|
||||||
content = content.replace('TZID="Europe/Berlin"', 'TZID="Europe/Berlin"')
|
content = content.replace('TZID=CampusNetZeit', 'TZID=Europe/Berlin')
|
||||||
|
content = content.replace('TZID:"CampusNetZeit"', 'TZID:"Europe/Berlin"')
|
||||||
|
content = content.replace('TZID="CampusNetZeit"', 'TZID="Europe/Berlin"')
|
||||||
|
|
||||||
with open(filepath, 'w', encoding='utf-8') as f:
|
with open(filepath, 'w', encoding='utf-8') as f:
|
||||||
f.write(content)
|
f.write(content)
|
||||||
|
|||||||
Reference in New Issue
Block a user