Prepare public release with MIT license and private user storage
This commit is contained in:
parent
41772b4d1a
commit
eb8932134a
12 changed files with 175 additions and 26 deletions
30
README.md
30
README.md
|
|
@ -12,7 +12,27 @@ python3 -m venv .venv
|
|||
.venv/bin/python -m playwright install chromium
|
||||
```
|
||||
|
||||
Copy `config.example.toml` to `config.toml` if you do not already have a config, then set the Grocy URL and API key. `GROCY_URL` and `GROCY_API_KEY` override the config.
|
||||
Create a private user configuration, then set your Grocy URL, API key and Open Food Facts contact:
|
||||
|
||||
```sh
|
||||
install -d -m 700 "${XDG_CONFIG_HOME:-$HOME/.config}/ocado-grocy"
|
||||
install -m 600 config.example.toml "${XDG_CONFIG_HOME:-$HOME/.config}/ocado-grocy/config.toml"
|
||||
```
|
||||
|
||||
Run the `install` command only for a new configuration: it replaces an existing file. `GROCY_URL` and `GROCY_API_KEY` override the config for the main importer. Ocado sign-in happens in the browser; no Ocado password is stored in the TOML file.
|
||||
|
||||
Default private locations (the corresponding `XDG_CONFIG_HOME`, `XDG_STATE_HOME` and `XDG_DATA_HOME` variables are supported):
|
||||
|
||||
| Contents | Location |
|
||||
| --- | --- |
|
||||
| Configuration and Grocy API key | `~/.config/ocado-grocy/config.toml` |
|
||||
| Import journal | `~/.local/state/ocado-grocy/imports.sqlite3` |
|
||||
| Browser profile and login cookies | `~/.local/state/ocado-grocy/browser/` |
|
||||
| Receipts, images, OFF responses and reports | `~/.local/share/ocado-grocy/history/` |
|
||||
|
||||
Below, `history/` means the configured archive directory. The journal prevents duplicate stock imports: keep it together with the receipts when moving installations.
|
||||
|
||||
Existing checkouts containing `./config.toml` keep the old local paths until migrated. To migrate, stop the importer and browser, move the configuration, journal, `.ocado-browser/` and `history/` to the locations above, and update `[import].state_file` to the journal's absolute path (or remove it to use the new default). Do not overwrite an existing destination. All three commands use the same journal resolver. Explicit custom configs retain a journal next to that config unless `state_file` overrides it; relative overrides are resolved against the config directory.
|
||||
|
||||
## Run
|
||||
|
||||
|
|
@ -58,9 +78,9 @@ When an order is explicitly selected with `--order-id`, enrichment also runs for
|
|||
|
||||
## Authentication and downloads
|
||||
|
||||
Playwright launches Chromium with `headless=False`. Complete sign-in and any CAPTCHA in that window. The private `.ocado-browser/` profile saves cookies and local storage for reuse. `.ocado-browser/auth.json` is an additional cookie/storage backup. The application does not store your password. Both the profile and the receipt archive are excluded from Git.
|
||||
Playwright launches Chromium with `headless=False`. Complete sign-in and any CAPTCHA in that window. The private browser profile saves cookies and local storage for reuse. Its `auth.json` is an additional cookie/storage backup. The application does not store your password. Both the profile and the receipt archive are excluded from Git.
|
||||
|
||||
`--profile`, `--archive`, `--config`, and `--login-timeout` customize locations and login waiting time. Profile/archive paths are relative to the working directory. Do not run two browser processes with the same profile.
|
||||
`--profile`, `--archive`, `--config`, and `--login-timeout` customize locations and login waiting time. Explicit relative profile/archive paths are relative to the working directory; the defaults are user-specific locations outside the checkout. Do not run two browser processes with the same profile.
|
||||
|
||||
The command checks the newest orders first and stops loading history once a batch contains a completed order. On the first run, it continues through Ocado's explicit end-of-list marker. Previously discovered incomplete orders remain eligible for retry, and completed orders are filtered out before loading receipts. Explicit `--order-id` selections continue searching until all requested orders are found or the list ends. `--limit` counts new orders after this filtering. `--order-id` explicitly selects an old order for retry, refreshing, or importing previously excluded items; `--refresh` alone does not reselect completed orders. It reads each order's authenticated `/api/order/v6/orders/ID/decorated` JSON response as the browser loads it. It does not parse prices or quantities from rendered HTML or use the live trolley. Accepted substitutions are included; unavailable originals and rejected replacements are excluded. Discontinued products work without a product-page link.
|
||||
|
||||
|
|
@ -176,3 +196,7 @@ Copy the saved Ocado image URLs into native Grocy product pictures:
|
|||
```
|
||||
|
||||
This covers all existing journal-linked imported products, including non-food products and products whose stock has been used up. It keeps existing pictures and skips deleted products. The main import command runs this step automatically; the standalone command can also be rerun at any time, optionally with `--order-id ORDER_ID`. Downloads use a separate session so Grocy credentials never go to Ocado. Each uploaded file is read back and verified before assigning it to the product, using the [Grocy files API](https://github.com/grocy/grocy/blob/master/grocy.openapi.json). Only the picture field is changed; titles, descriptions and stock remain untouched. Results are saved in `history/images/report.json`. Failed updates can be retried safely.
|
||||
|
||||
## License
|
||||
|
||||
The project code is available under the [MIT License](LICENSE). Dependencies, Ocado content and downloaded Open Food Facts data and images retain their respective licences; the MIT licence does not relicense that material.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue