Skip to content

Commit

Permalink
debug stage_list_generator.py
Browse files Browse the repository at this point in the history
  • Loading branch information
dzyxdd committed Feb 20, 2024
1 parent 05e4b69 commit f337e1e
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion python_generator/stage_list_generator.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,23 +6,28 @@

# 读取JSON数据
with open('../docs/music_lib/stage_list.json', 'r', encoding='utf-8') as f:
print("open stage_list.json")
data = json.load(f)

with open('../templates/template_song_list.html', 'r', encoding='utf-8') as f:
print("open template_song_list.html")
template_string = f.read()

print(template_string)
for item in data:
print(item['title'])
song_title_list = item['song_title_list']
song_data_list = []
for song_title in song_title_list:
song_hash = Utils.process_string(song_title)
path_exists = os.path.exists(f'../docs/music_lib/music_call/auto-generated_md/{song_hash}.md')
song_data_list.append({'title': song_title, 'hash': song_hash, 'exists': path_exists})
print(song_data_list)
item['song_data_list'] = song_data_list

template = Template(template_string)
rendered_html = template.render(song_list=data)

print(rendered_html)
if not os.path.exists('../docs/music_lib/auto-generated_html'):
os.makedirs('../docs/music_lib/auto-generated_html')
with open('../docs/music_lib/auto-generated_html/stage_list.html', 'w', encoding='utf-8') as f:
Expand Down

0 comments on commit f337e1e

Please sign in to comment.