Modified the script, removed types, will introduce tags
This commit is contained in:
parent
d6fdc535e7
commit
462aedd1fc
@ -13,6 +13,7 @@
|
|||||||
<div>
|
<div>
|
||||||
{{educationItem.description}}
|
{{educationItem.description}}
|
||||||
</div>
|
</div>
|
||||||
|
<div>Some random text here random text here random text here random text here random text here random text here random text here random text here random text here </div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@ -1 +1 @@
|
|||||||
[{"info": {"created_timestamp": 1515095948.838848, "title": "Test title"}, "post": [], "type": "project", "id": "test"}, {"info": {"created_timestamp": 1515094644.215065, "title": "cupboard"}, "post": [], "type": "project", "id": "cupboard1"}, {"info": {"created_timestamp": 1515094644.215333, "title": "some things about lxc in arch"}, "post": [], "type": "tech", "id": "lxdarch"}, {"info": {"created_timestamp": 1515094679.342938, "title": "Who said Web 1.0 was dead anyway?"}, "post": [], "type": "blog", "id": "first"}]
|
[{"info": {"created_timestamp": 1515094679.342938, "title": "Who said Web 1.0 was dead anyway?"}, "id": "first"}, {"info": {"created_timestamp": 1515094644.215065, "title": "cupboard"}, "id": "cupboard1"}, {"info": {"created_timestamp": 1515095948.838848, "title": "Test title"}, "id": "test"}, {"info": {"created_timestamp": 1515094644.215333, "title": "some things about lxc in arch"}, "id": "lxdarch"}]
|
||||||
@ -1,36 +1,27 @@
|
|||||||
|
#!/usr/bin/env python
|
||||||
import os;
|
import os;
|
||||||
import json;
|
import json;
|
||||||
import time;
|
import time;
|
||||||
|
|
||||||
# each folder in the post folder is a type of post
|
# each folder in the post folder is a type of post
|
||||||
base = '../assets/post'
|
base = '../assets/post'
|
||||||
types = os.listdir(base);
|
posts = os.listdir(base);
|
||||||
outputfile = '../assets/posts.json'
|
outputfile = '../assets/posts.json'
|
||||||
|
|
||||||
# go over the types
|
|
||||||
for type in types:
|
|
||||||
print type
|
|
||||||
|
|
||||||
# build ourselves a json object
|
# build ourselves a json object
|
||||||
jsonresult = [];
|
jsonresult = [];
|
||||||
for type in types:
|
|
||||||
# now read that folder
|
|
||||||
posts = os.listdir(base+"/"+type);
|
|
||||||
|
|
||||||
# each folder in the current one is a post! the name of the folder is the _id_
|
# each folder in the current one is a post! the name of the folder is the _id_
|
||||||
for post in posts:
|
for post in posts:
|
||||||
print('doing post '+post)
|
print('doing post '+post)
|
||||||
postdir = base+"/"+type+"/"+post;
|
postdir = base+"/"+post;
|
||||||
infofile = postdir+"/info.json";
|
infofile = postdir+"/info.json";
|
||||||
print(infofile)
|
print(infofile)
|
||||||
with open(infofile) as j:
|
with open(infofile) as j:
|
||||||
tt = j.read()
|
tt = j.read()
|
||||||
d = json.loads(tt)
|
d = json.loads(tt)
|
||||||
temp = {};
|
temp = {};
|
||||||
temp['type'] = type;
|
|
||||||
temp['id'] = post;
|
temp['id'] = post;
|
||||||
if 'post' not in temp:
|
|
||||||
temp['post'] = [];
|
|
||||||
temp['info'] = d;
|
temp['info'] = d;
|
||||||
|
|
||||||
# have to write the 'modified date' in the info.json of the post if it's not there yet
|
# have to write the 'modified date' in the info.json of the post if it's not there yet
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user