custom
This commit is contained in:
@@ -0,0 +1,26 @@
|
||||
from structure import Structure, Lecture
|
||||
import json
|
||||
|
||||
if __name__ == "__main__":
|
||||
struct = Structure()
|
||||
week = struct.get_week_number()
|
||||
|
||||
with open("custom.txt", "r", encoding="utf-8") as f:
|
||||
lines = f.readlines()
|
||||
|
||||
lines = list(map(lambda s: s.strip(), lines))
|
||||
lectures = []
|
||||
|
||||
for i in range(0, len(lines), 5):
|
||||
q = ["Custom"]
|
||||
q.extend(lines[i:(i+4)])
|
||||
q.append(False)
|
||||
q[2] = int(q[2])
|
||||
print(q)
|
||||
|
||||
lectures.append(Lecture(*q))
|
||||
|
||||
lectures = list(filter(lambda l: l.complete, lectures))
|
||||
|
||||
with open("lecture.json", "w", encoding="utf-8") as f:
|
||||
json.dump(list(map(lambda l: l.json(), lectures)), f, ensure_ascii=False, indent=4)
|
||||
Reference in New Issue
Block a user