Skip to content

Commit

Permalink
Add time stamp
Browse files Browse the repository at this point in the history
  • Loading branch information
youyou-sudo committed Sep 10, 2024
1 parent abd5118 commit 053886e
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion script/vn_data_json.py
Original file line number Diff line number Diff line change
Expand Up @@ -155,9 +155,18 @@ def tsv_to_json(vn_tsv_file_path, vn_titles_tsv_file_path, releases_titles_tsv_f
# 删除没有 image 字段的条目
transformed_data_list = [entry for entry in transformed_data_list if entry.get("image")]

# 获取当前时间戳
timestamp = datetime.now().isoformat()

# 构建包含时间戳和数据的字典
output_data = {
"timestamp": timestamp,
"data": transformed_data_list
}

# 将数据转换为JSON格式并写入文件
with open(json_file_path, 'w', encoding='utf-8') as json_file:
json.dump(transformed_data_list, json_file, ensure_ascii=False, indent=4)
json.dump(output_data, json_file, ensure_ascii=False, indent=4)


# 使用示例
Expand Down

0 comments on commit 053886e

Please sign in to comment.