You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
35 lines
821 B
35 lines
821 B
import json
|
|
from build import build, build_ext_list
|
|
import time
|
|
def full(ext,*starts):
|
|
stime = time.time()
|
|
paths = build(0,*starts)
|
|
names = build_ext_list(ext,paths)
|
|
return {
|
|
"meta" : {
|
|
"ext" : ext,
|
|
"time": stime,
|
|
},
|
|
"data": names
|
|
}
|
|
|
|
def save(ext_map):
|
|
ext = ext_map["meta"]["ext"]
|
|
with open(f"{ext}-cache.json","w") as file:
|
|
json.dump(ext_map,file)
|
|
|
|
def load(ext):
|
|
with open(f"{ext}-cache.json") as file:
|
|
return json.load(file)
|
|
|
|
def update(ext,*starts):
|
|
ext_map = load(ext)
|
|
prev_time = ext_map["meta"]["time"]
|
|
stime = time.time()
|
|
paths = build(prev_time,*starts)
|
|
names = build_ext_list(ext,paths)
|
|
ext_map.update(names)
|
|
ext_map["meta"]["time"] = stime
|
|
save(ext_map)
|
|
return ext_map
|
|
|