initial commit
This commit is contained in:
commit
16137dce12
80 changed files with 1757 additions and 0 deletions
42
import_mess/create_markdown.py
Normal file
42
import_mess/create_markdown.py
Normal file
|
|
@ -0,0 +1,42 @@
|
|||
#!/bin/python3
|
||||
|
||||
"""
|
||||
Will create markdown files for all the images
|
||||
"""
|
||||
|
||||
import json
|
||||
import pathlib
|
||||
import os
|
||||
import shutil
|
||||
|
||||
inp_file = open('./images_list.json')
|
||||
images = json.loads(inp_file.read())
|
||||
|
||||
CONTENT_BASE = '../content/images/'
|
||||
FILES_BASE = '../static/files/images/'
|
||||
|
||||
dirs = os.listdir(FILES_BASE)
|
||||
print(sorted(dirs))
|
||||
|
||||
for dir in dirs:
|
||||
if os.path.exists(CONTENT_BASE + dir):
|
||||
continue
|
||||
os.mkdir(CONTENT_BASE + dir)
|
||||
|
||||
id = int(dir)
|
||||
print(id - 1)
|
||||
img = images[int(dir)-1]
|
||||
print(img)
|
||||
|
||||
shutil.copy(FILES_BASE + dir + '/original.jpg', CONTENT_BASE + dir + '/original.jpg')
|
||||
image_md = open(CONTENT_BASE + dir + "/index.md", "a")
|
||||
image_md.write("---\n")
|
||||
image_md.write("title: Image\n")
|
||||
image_md.write(f"original_name: {img['original_name']}\n")
|
||||
image_md.write(f"mime_type: {img['mime_type']}\n")
|
||||
image_md.write(f"tags: {img['tags']}\n")
|
||||
image_md.write("---\n")
|
||||
image_md.write("\n")
|
||||
# description about the image goes after (like the legend)
|
||||
image_md.close()
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue