forked from chinese-poetry/huajianji
-
Notifications
You must be signed in to change notification settings - Fork 0
/
gen_image_json.py
47 lines (33 loc) · 879 Bytes
/
gen_image_json.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
# -*- coding: utf-8 -*-
import sys
reload(sys)
sys.setdefaultencoding('utf-8')
import os, json
images = os.listdir(u'./images/')
datas = []
for i in images:
if 'renrenxiaozhan' in i:
link = "http://zhan.renren.com/chinastyle?checked=true"
author = "人人小站"
p = 1
elif 'pola' in i:
link = "http://www.polayoutu.com/collections"
author = "泼辣有图"
p = 1
elif 'jackeygao' in i:
link = "https://jackeygao.io"
author = "JackeyGao"
p = 1
else:
link = "#"
author = "互联网"
p = 1
for _ in range(p):
data = {
"src": i,
"link": link,
"author": author
}
datas.append(data)
with open('config/images.json', 'w') as f:
f.write(json.dumps(datas, indent=2, ensure_ascii=False))