Files
ankn b46de6dc7d
Deploy CV Site (andreknie.de) / deploy (push) Canceled after 0s
ci: migrate GitHub actions to Gitea actions
2026-07-22 15:42:06 +02:00

31 lines
1.2 KiB
Python

import os
import re
CONTENT_DIR = "content/podcast"
for filename in sorted(os.listdir(CONTENT_DIR)):
if filename.startswith("ep-") and filename.endswith(".yaml"):
# extract number
match = re.search(r'ep-(\d{3})-', filename)
if match:
num = match.group(1)
filepath = os.path.join(CONTENT_DIR, filename)
with open(filepath, 'r', encoding='utf-8') as f:
content = f.read()
# extract current title
title_match = re.search(r'^title:\s*"?(.+?)"?$', content, flags=re.MULTILINE)
if title_match:
current_title = title_match.group(1)
# strip existing number if any
current_title = re.sub(r'^\d{3}:\s*', '', current_title)
new_title = f"{num}: {current_title}"
# update title
content = re.sub(r'^title:\s*.*$', f'title: "{new_title}"', content, flags=re.MULTILINE)
with open(filepath, 'w', encoding='utf-8') as f:
f.write(content)
print(f"Updated {filename} -> {new_title}")