Files
music_library/backlog/tasks/ml-185.2 - Use-API-sized-covers-in-Presto.md
T
2026-05-15 22:41:17 +01:00

61 lines
3.0 KiB
Markdown

---
id: ML-185.2
title: Use API-sized covers in Presto
status: To Do
assignee: []
created_date: "2026-05-15 21:22"
updated_date: "2026-05-15 21:40"
labels:
- presto
- artwork
dependencies:
- ML-185.1
documentation:
- docs/project-conventions.md
- presto/AGENTS.md
- presto/README.md
modified_files:
- presto/main.py
- presto/README.md
- presto/AGENTS.md
- presto/tests/conftest.py
- presto/tests/test_screens.py
parent_task_id: ML-185
priority: medium
ordinal: 21000
---
## Description
<!-- SECTION:DESCRIPTION:BEGIN -->
Update the Presto application so it trusts the collection API to provide display-ready cover sizes.
Context for implementer: `presto/main.py` currently renders record-list covers at 80 px and record-detail covers at 480 px. It currently chooses among `mini_cover_url`, `micro_cover_url`, and `thumb_url`, then `draw_jpeg/5` selects JPEG scale flags to fit images into a bounding box. After the API task is complete, records should expose named covers where `small` is the 80 px row cover and `medium` is the 460 px detail cover. Update the detail cover layout to draw the 460 px image centered in the 480 px display so it does not fill the full view width. Preserve existing cover byte caching, placeholder rendering, and the rule that drag redraws must not fetch images over the network.
<!-- SECTION:DESCRIPTION:END -->
## Acceptance Criteria
<!-- AC:BEGIN -->
- [ ] #1 Record-list rows fetch and draw the API-provided 80 px small cover variant.
- [ ] #2 Record-detail pages fetch and draw the API-provided 460 px medium cover variant centered within the 480 px display.
- [ ] #3 Presto image drawing no longer selects JPEG scale flags or resizes covers to fit a bounding box.
- [ ] #4 Missing or failed cover downloads still render placeholders, and drag redraws still avoid network fetches.
- [ ] #5 Presto README, Presto guidance, and smoke-test fixtures match the new named cover contract.
- [ ] #6 The Presto syntax check and smoke tests pass, with physical device verification only claimed if run on the device.
<!-- AC:END -->
## Implementation Plan
<!-- SECTION:PLAN:BEGIN -->
1. Add small helper(s) for reading the named cover object from API records, returning `small` for list rows and `medium` for detail pages.
2. Replace legacy `mini_cover_url` / `micro_cover_url` / `thumb_url` selection and preload checks with the new named cover helpers.
3. Simplify JPEG drawing so it decodes the already-sized image at the requested top-left coordinate and falls back to a placeholder on failures; remove `_jpeg_scale_options` and max-width/max-height fitting behavior.
4. Keep row and detail image cache keys separate and preserve the existing drag behavior that shows placeholders when data is not already cached.
5. Update `presto/README.md`, `presto/AGENTS.md`, and test mock records to describe and exercise the new contract.
6. Run `python3 -c "import py_compile; py_compile.compile('main.py', cfile='/tmp/main.pyc', doraise=True)"` from `presto/` and `mise run test` for the Presto smoke suite.
<!-- SECTION:PLAN:END -->