Skip to content

Commit 4e11a60

Browse files
committed
Templatize metadata.json
1 parent 776a7ed commit 4e11a60

File tree

3 files changed

+19
-1
lines changed

3 files changed

+19
-1
lines changed

.github/workflows/main.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,10 @@ jobs:
3737
run: |
3838
python players.py players.xml players.db
3939
40+
- name: Generate metadata.json
41+
run: |
42+
python generate_metadata.py
43+
4044
- name: Deploy to Fly.io using Datasette
4145
env:
4246
FLY_API_TOKEN: ${{ secrets.FLY_API_TOKEN }}

generate_metadata.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
import json
2+
from datetime import datetime
3+
4+
# Read the template
5+
with open('metadata_template.json', 'r') as template_file:
6+
template = template_file.read()
7+
8+
# Fill in the template
9+
date = datetime.utcnow().strftime('%Y-%m-%d')
10+
metadata_content = template.replace('{{date}}', date)
11+
12+
# Write the filled template to metadata.json
13+
with open('metadata.json', 'w') as metadata_file:
14+
metadata_file.write(metadata_content)

metadata.json renamed to metadata_template.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"title": "FIDE Players",
3-
"description": "FIDE player names, ratings, and other information",
3+
"description": "FIDE player names, ratings, and other information. Retrieved on {{date}}",
44
"source": "FIDE Ratings list",
55
"source_url": "https://ratings.fide.com/download.phtml",
66
"databases": {

0 commit comments

Comments
 (0)