diff options
| author | diogo464 <[email protected]> | 2025-07-24 11:15:17 +0100 |
|---|---|---|
| committer | diogo464 <[email protected]> | 2025-07-24 11:15:17 +0100 |
| commit | 9111cb454a6ea62dacbafad49a0aabafc7066bf8 (patch) | |
| tree | e93269cd93f588c9db456dc7768b17059e499553 /extract-title | |
| parent | 47b06ad0b6fa9c6e6a352ef7d6f25297ad3aaf72 (diff) | |
added extract-title
Diffstat (limited to 'extract-title')
| -rwxr-xr-x | extract-title | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/extract-title b/extract-title new file mode 100755 index 000000000..46b4d3630 --- /dev/null +++ b/extract-title | |||
| @@ -0,0 +1,16 @@ | |||
| 1 | #!/usr/bin/env python3 | ||
| 2 | import os | ||
| 3 | import sys | ||
| 4 | import json | ||
| 5 | |||
| 6 | for slug in sys.argv[1:]: | ||
| 7 | data_path = os.path.join("events", slug, "data.json") | ||
| 8 | title_path = os.path.join("events", slug, "title") | ||
| 9 | with open(data_path, "r") as f: | ||
| 10 | data = json.load(f) | ||
| 11 | title = data["title"]["rendered"] | ||
| 12 | if os.path.exists(title_path): | ||
| 13 | continue | ||
| 14 | with open(title_path, "w") as f: | ||
| 15 | f.write(title) | ||
| 16 | |||
