BODYPUMP Playlist Importer for Apple Music

Purpose

Idea for automatically converting a Les Mills BODYPUMP release track list into an Apple Music playlist through the Apple Music web interface. Selenium performs the browser actions; an AI API repairs locators when Apple changes the page.

Proposed workflow

1. Read a selected BODYPUMP release track list from the official Les Mills page or a comprehensive track-list source such as LM Tracks.

2. Extract the release number, track position, exercise role, title, artist and any remix/version information.

3. Open music.apple.com using Selenium with a dedicated persistent browser profile. John signs in manually when authentication or MFA is required.

4. Create an Apple Music playlist named for the BODYPUMP release.

5. Search Apple Music for each title and artist, prefer an exact remix/version match, and add confident matches in release order.

6. Present ambiguous or missing matches for review rather than silently choosing a different recording.

Self-healing Selenium design

Detect change from a failed locator, timeout, non-unique match, invisible element, or failed post-action assertion. Capture the failed semantic action, the existing locator, a pruned relevant DOM fragment, accessibility information where available, and a screenshot.

Send that evidence to an AI model through the OpenAI Responses API. Require structured output containing candidate CSS/XPath locators, expected role/text and confidence; do not accept or execute arbitrary Python for routine repairs.

Validate each candidate locally: it must resolve uniquely, be visible and enabled, have the expected semantics, and successfully complete a reversible or safely testable action. Save only a verified locator in a JSON or YAML locator registry, then retry the interrupted operation.

If the interaction has changed structurally rather than merely changing selectors, the model may propose a source-code patch. Apply that only through a separate review-and-test path; never rewrite and execute the running program automatically.

Safety and reliability

• Treat page content and model output as untrusted data. Restrict model output with a schema and allow only locator changes in the automatic path.

• Use post-action assertions, for example confirming the expected track appears in the intended playlist, so a selector that clicks the wrong control is rejected.

• Make playlist creation idempotent: detect an existing release playlist and avoid duplicating tracks on a retry.

• Keep an audit log containing the failed locator, supplied evidence, proposed candidates, validation result and persisted change.

• Rate-limit searches and additions, retain a manual stop, and pause on authentication challenges or unexpected account-level prompts.

Implementation shape

A small Python project could separate: track-list acquisition and normalisation; Apple Music page objects and semantic actions; selector registry; repair service; match scoring and review; audit logging. Selenium should express intentions such as search_track or add_to_playlist, leaving volatile selectors outside the orchestration logic.

Initial scope

Start with one numbered BODYPUMP release and the normal 10–12 tracks. Require manual confirmation for uncertain music matches. Test selector repair first on deliberately invalidated local locator definitions before relying on it against a genuine Apple Music layout change.

Status

Idea recorded; not yet implemented.

version 1  ·  created 2026-07-22  ·  updated 2026-07-22  ·  tags idea, music, bodypump, apple-music, selenium, ai