Files
intellecton/scripts/update_readmes.py
T

48 lines
1.4 KiB
Python
Raw Normal View History

2026-06-12 17:15:23 +00:00
import os
import glob
base_dir = '/home/antigravity/intellecton/papers'
vols = [
('project_paper_1_relativity', 1),
('project_paper_2_neuroscience', 2),
('project_paper_3_darwinism', 3),
('project_paper_4_fbt', 4),
('project_paper_5_turing', 5),
('project_paper_6_holographic', 6),
]
for d, vol_num in vols:
readme_path = os.path.join(base_dir, d, 'README.md')
s3_link = f'- **[Direct S3 PDF Download (Volume {vol_num} Master Key)](https://s3.thefoldwithin.earth/intellecton-pdfs/Volume_{vol_num}_Master_Key.pdf)**'
with open(readme_path, 'r') as f:
content = f.read()
if s3_link in content:
continue
if '## Resources' in content:
# insert after ## Resources
parts = content.split('## Resources')
content = parts[0] + '## Resources\n' + s3_link + parts[1]
else:
# append at the beginning after the title
lines = content.split('\n')
lines.insert(2, '## Resources')
lines.insert(3, s3_link)
lines.insert(4, '')
content = '\n'.join(lines)
# remove the old compiled PDF link if it exists
old_link = f'- [Compiled PDF (master_key/paper_{vol_num}'
new_lines = []
for line in content.split('\n'):
if old_link not in line:
new_lines.append(line)
with open(readme_path, 'w') as f:
f.write('\n'.join(new_lines))
print("Updated READMEs with S3 links.")