-
Notifications
You must be signed in to change notification settings - Fork 13
/
Copy pathquokka_images.py
44 lines (31 loc) · 913 Bytes
/
quokka_images.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
import fire
import pyperclip
import json
from os import listdir, getcwd
from os.path import isfile, join
def gen_photos():
folder = join(getcwd(), 'site/public/img')
quokkaFolder = join(folder, 'quokkas')
notQuokkaFolder = join(folder, 'not_quokkas')
quokkas = [join(quokkaFolder, f) for f in listdir(quokkaFolder) if
isfile(join(quokkaFolder, f))]
notQuokkas = [join(notQuokkaFolder, f) for f in listdir(notQuokkaFolder) if
isfile(join(notQuokkaFolder, f))]
quokkaPhotos = []
notQuokkaPhotos = []
for photo in quokkas:
quokkaPhotos.append({
'slug': photo.split('/')[-1],
})
for photo in notQuokkas:
notQuokkaPhotos.append({
'slug': photo.split('/')[-1],
})
allPhotos = {
'quokkas': quokkaPhotos,
'notQuokkas': notQuokkaPhotos
}
pyperclip.copy(json.dumps(allPhotos))
print('Photos have been copied to clipboard')
if __name__ == "__main__":
fire.Fire(gen_photos)