diff --git a/Dockerfile b/Dockerfile index 24041b6..4b27a04 100644 --- a/Dockerfile +++ b/Dockerfile @@ -32,6 +32,7 @@ RUN mkdir -p /app/data COPY --from=builder /app/main_server . COPY --from=builder /app/static ./static COPY --from=builder /app/migrations ./migrations +COPY --from=builder /app/data ./data # Expose the application port EXPOSE 3000 diff --git a/README.md b/README.md new file mode 100644 index 0000000..3913d57 --- /dev/null +++ b/README.md @@ -0,0 +1,35 @@ +# mal + +## watch-order dataset + +relations are loaded from a local dataset file instead of live scraping chiaki at request time. + +### runtime + +- env var: `WATCH_ORDER_FILE` +- default path: `./data/watch_order.json` + +### regenerate dataset + +1. refresh seed ids from local db + +```sh +python3 - <<'PY' +import sqlite3, json, pathlib +conn = sqlite3.connect('mal.db') +cur = conn.cursor() +cur.execute('select id from anime order by id') +ids=[r[0] for r in cur.fetchall()] +path=pathlib.Path('tmp/watch_order_seed_ids.json') +path.write_text(json.dumps({'ids': ids}, indent=2), encoding='utf-8') +print(f'wrote {len(ids)} ids to {path}') +PY +``` + +2. generate dataset json + +```sh +go run ./cmd/watchorder -seed "tmp/watch_order_seed_ids.json" -out "data/watch_order.json" +``` + +3. restart the server/container to load the updated file