Prepare public release with MIT license and private user storage

This commit is contained in:
Edward Betts 2026-10-07 11:32:59 +01:00
parent 41772b4d1a
commit eb8932134a
12 changed files with 175 additions and 26 deletions

View file

@ -6,6 +6,7 @@ from pathlib import Path
import click
from .grocy import Grocy, imported_products
from .paths import journal_file
from .history import private_json
from .images import run_images
from .openfoodfacts import run_openfoodfacts
@ -18,9 +19,7 @@ def enrich_orders(config, config_path, archive, order_ids, *, images=True, openf
connection = config.get('grocy', {})
client = Grocy(os.environ.get('GROCY_URL', connection.get('url', '')),
os.environ.get('GROCY_API_KEY', connection.get('api_key', '')))
state = Path(config.get('import', {}).get('state_file', 'imports.sqlite3'))
if not state.is_absolute():
state = config_path.resolve().parent / state
state = journal_file(config, config_path)
products = imported_products(client, state, order_ids)
key = order_ids[0] if len(order_ids) == 1 and order_ids[0].isdigit() else hashlib.sha256(','.join(sorted(order_ids)).encode()).hexdigest()[:16]
output = archive / 'enrichment' / key
@ -65,7 +64,7 @@ def retry_enrichment(config, config_path, archive, *, images=True, openfoodfacts
connection = config.get('grocy', {})
client = Grocy(os.environ.get('GROCY_URL', connection.get('url','')),
os.environ.get('GROCY_API_KEY', connection.get('api_key','')))
state = config_path.resolve().parent / config.get('import',{}).get('state_file','imports.sqlite3')
state = journal_file(config, config_path)
if not state.exists():
return {'errors':[]}
queue = RetryQueue(state, client.url)