Add Doris Schoolhouse and clean pending homelab changes
This commit is contained in:
27
home/doris-schoolhouse/app/scripts/bootstrap_state.py
Normal file
27
home/doris-schoolhouse/app/scripts/bootstrap_state.py
Normal file
@@ -0,0 +1,27 @@
|
||||
from pathlib import Path
|
||||
|
||||
from app.config import settings
|
||||
from app.services.d2l import D2LService
|
||||
from app.services.store import JsonStore
|
||||
|
||||
|
||||
def main() -> None:
|
||||
Path(settings.upload_tmp_dir).mkdir(parents=True, exist_ok=True)
|
||||
Path(settings.state_dir).mkdir(parents=True, exist_ok=True)
|
||||
store = JsonStore()
|
||||
for name, default in {
|
||||
'courses': [],
|
||||
'assignments': [],
|
||||
'submissions': [],
|
||||
'recordings': [],
|
||||
'sync_runs': [],
|
||||
}.items():
|
||||
path = Path(settings.state_dir) / f'{name}.json'
|
||||
if not path.exists():
|
||||
store.save(name, default)
|
||||
result = D2LService().sync_to_store()
|
||||
print(result)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
Reference in New Issue
Block a user