.PHONY: test lint run scan docker smoke clean

test:
	python3 -m pytest tests/ -q

run:
	python3 -m mediashelf.cli serve --port 8080 --no-scheduler

scan:
	python3 -m mediashelf.cli scan --full

docker:
	docker build -t mediashelf:$(or $(VERSION),0.1.0) .

# The human sanity check no unit test replaces: a real scan, real top candidates.
smoke:
	python3 -m mediashelf.cli scan --full
	@echo "--- top 20 reclaim candidates ---"
	@python3 -c "import json,urllib.request; \
d=json.load(urllib.request.urlopen('http://127.0.0.1:8080/api/v1/items?page_size=20')); \
[print('%8.1f GB  score %-6s %s' % (i['size_bytes']/1e9, i['reclaim_score'], i['title'])) for i in d['items']]"

clean:
	rm -rf .pytest_cache **/__pycache__ *.egg-info
