Plugin: rework login/status/logout + config #14
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Context
Plugin rework (see #18). The command surface stays (
beet apple login / status / logout / sync / isrc-backfill / isrc-submit) but auth now talksto the gateway.
Task
In
/opt/data/git/git.sams.wtf/coop/beets-appleplaylists:service_url: ""andservice_token: ""(envfallbacks
APPLE_MUSIC_SERVICE_URL/APPLE_MUSIC_SERVICE_TOKEN);remove
team_id,key_id,key_path,services_id,redirect_uri,credentials.beet apple login: print and open{service_url}/login, then pollGET /api/v1/statusevery ~2 s (up to ~120 s) untillogged_inis true;report success with the token's
updated_at.beet apple status:GET /api/v1/status; print "logged in (since ...)"or "not logged in — visit {service_url}/login".
beet apple logout:DELETE /api/v1/login; print the result._syncand_backfill: replace theAppleAuthManagercredentials dancewith the
AppleAPIClient(service_url, service_token)from #13; a missingconfig raises a
ui.UserErrornaming the missing setting._submit(MusicBrainz) is untouched.Acceptance criteria
logged in, status reflects the store, logout calls DELETE.
service_urlproduces a clear error, not a traceback.uv run pytestgreen.Implemented in
coop/beets-appleplaylistscommitb5a121c8c728bcf218e5e4561bed603e01e82b44. The plugin now usesservice_url/service_tokenwithAPPLE_MUSIC_SERVICE_URL/APPLE_MUSIC_SERVICE_TOKENfallbacks, polls gateway status during login, reports status timestamps, clears the remote login on logout, and uses the gateway client for sync/backfill. Missing settings raise clearui.UserErrormessages.Verification: mocked login/status/logout tests pass and
uv run pytest -qreports 21 passed.