Project

General

Profile

Feature #74 » gorilla.py.diff

koszko, 08/18/2021 12:03 PM

View differences:

gorilla.py 2021-08-18 10:31:10.000000000 +0200 → gorilla.py 2021-08-18 10:38:03.571005177 +0200
16 16
	if path[-1] != os.sep:
17 17
		path += os.sep
18 18
	
19 19
	DB['path'] = path
20 20
	for file in os.listdir(path):
21
		with open(path + file + os.sep + 'index.json') as f:
21
		subdir = path + file
22
		
23
		if (os.st.S_IFMT(os.stat(subdir).st_mode) & os.st.S_IFDIR) == 0:
24
			continue
25
		
26
		with open(subdir + os.sep + 'index.json') as f:
22 27
			data = json.load(f)
23 28
		
24 29
		type_, data['file'] = data['type'], file
25 30
		name_key = 'pattern' if type_ == 'page' else 'name'
26 31
		
......
32 37
	
33 38
	return DB
34 39

  
35 40

  
36 41
def mkhachette(patterns):
42
	patterns = set(patterns)
43
	if '*' in patterns:
44
		patterns.remove('*')
45
		patterns.update(DB['page'].keys())
46
	
37 47
	scripts, bags, pages, new_bags = {}, {}, {}, []
38 48
	for pattern in patterns:
39 49
		pages[pattern] = data = DB['page'][pattern]
40 50
		type_, name = data['payload']
41 51
		if type_ == 'script':
(1-1/2)