Appendix L: Cryo Playlist Manager (Shop Manual)
Status: In submission for Mac App Store; ship dependency for the book's official release. GPL v3. Public repo at github.com/fluhartyml/Cryo-Playlist-Manager. Locked as an appendix reference per project memory. Cryo Playlist Manager is the Mac-side companion to the Cryo music apps (CryoTunes Player in Appendix M, Tally Matrix Clock in Appendix W). It manages Apple Music playlists, imports from Spotify, and provides a Playlist Locker that prevents accidental dynamic changes to the user's curated lists. Built on MusicKit on the Apple side and the Spotify Web API on the Spotify side.
What it is
A macOS app for users who keep their music library serious. Three jobs:
- Browse and curate Apple Music. The user's library shown in a Mac-native table, organized by station / decade / year groupings shared with the CryoTunes family.
- Import from Spotify. Authenticate against the user's Spotify account, list their Spotify playlists, and replicate tracks into Apple Music where possible (matching by title + artist + duration).
- Lock playlists. Apple Music can re-order or substitute tracks in dynamic playlists in ways that surprise the user. The Playlist Locker takes a snapshot of a playlist's contents and lets the user restore it if Apple Music drifts.
Architecture overview
SwiftUI Mac app with two service stacks (Apple Music via MusicKit, Spotify via Web API + OAuth). The project is organized into Views/ and Services/ folders for separation.
- App entry:
Cryo_Playlist_ManagerApp.swift—@mainscene. ImportsSwiftUIandMusicKit. OneWindowGroupwithSpotifyServiceinjected via.environmentso any view that needs Spotify can pull it from the environment. - Root:
ContentView.swift— top-level sidebar / detail layout connecting the four views below. - Views (
Views/):MyMusicView.swift— user's Apple Music library browse, table-style listing tuned for Mac.StationBrowserView.swift— the shared station catalog (Category → Decade → Year), same shape used by CryoTunes Player and Tally Matrix Clock.PlaylistLockerView.swift— the locked-playlist management surface (snapshot, restore, compare).SpotifyPlaylistView.swift— Spotify playlist list and per-playlist track view with the Apple Music match status.SettingsView.swift— Mac Settings scene for preferences (default station behavior, Spotify connection status, etc.).
- Services (
Services/):PlaylistManager.swift— the Apple Music side. Reads the user's library via MusicKit, executes add / remove / re-order operations against playlists.PlaylistLockerService.swift— the snapshot-and-restore engine. Writes locked playlist snapshots to local storage; compares against current Apple Music state on demand.SpotifyAuthManager.swift— OAuth flow with Spotify's authorization server. Stores tokens in the system keychain.SpotifyService.swift— the@Observablefacade for the Spotify Web API. List playlists, list tracks, search the catalog. Injected into views via SwiftUI environment.DislikeManager.swift— per-track dislike list, mirrored from the CryoTunes pattern so the same dislikes propagate.
Mac-native design choices
This is a Mac-first app, not a Designed-for-iPad-on-Mac port:
- Three-pane sidebar / list / detail layout. Sidebar with the four primary views (My Music, Stations, Locker, Spotify), middle pane with the list for the selected view, right pane with the per-item detail.
- Table-style listings. Where the iOS apps use SwiftUI
Listwith rich rows, this app uses MacTablewith column-style data (title, artist, duration, status). The Mac convention — sortable columns, multiple-row selection, keyboard navigation — is what users expect at this scale. - Mac Settings scene.
SettingsViewis wired as a separateSettingsscene in the App body, not as a sheet from a toolbar button. This is the canonical Mac pattern. - Drag-and-drop. Tracks drag between playlists; playlists drag for re-ordering. The Mac AppKit drag-and-drop model is bridged through SwiftUI's
Transferableprotocol.
The Spotify side
Spotify integration uses the Spotify Web API with OAuth 2.0 (PKCE flow):
- User clicks Connect Spotify.
SpotifyAuthManageropens the system browser to Spotify's authorization endpoint with the PKCE challenge.- User approves; Spotify redirects to the app's registered redirect URI.
- The app receives the authorization code, exchanges it for an access + refresh token, stores both in the system keychain.
SpotifyServiceuses the access token for subsequent API calls. When the token expires, the refresh token mints a new one without user interaction.
The keychain storage means Spotify credentials survive restarts and reboots. The refresh-token flow means the user authenticates once.
The Playlist Locker
Apple Music has long-standing behavior where playlists can shift — tracks can be replaced with matched cloud versions, durations can change slightly, occasionally a track can drop out entirely. For a curator, that's an unwelcome surprise. The Locker takes a snapshot of a playlist's track list at lock time and stores it locally. Later, the user can compare the current Apple Music state against the snapshot and choose to restore (re-add missing tracks, re-order to match) or accept the drift (update the snapshot).
The snapshot is per-playlist, with version history. The user can roll back to any previous snapshot, not just the most recent.
Build + deployment
- App name: Cryo Playlist Manager.
- Platforms: macOS native (not Catalyst, not Designed-for-iPad).
- Frameworks: SwiftUI (UI), MusicKit (Apple Music access), Foundation URLSession (Spotify Web API), Security framework (keychain via wrappers in
SpotifyAuthManager). - External services: Spotify Web API (requires the user's Spotify account); Apple Music (requires the user's Apple Music subscription for full track access).
- Distribution: Mac App Store after submission. Locked as appendix reference per project memory — the book's official release waits on this app reaching the store.
Subscription disclosure
This app needs two third-party subscriptions to operate at full capacity:
- Apple Music subscription — for playback and full catalog access.
- Spotify account — can be a free Spotify account for playlist read-only; a Premium account isn't required for the import use case.
Per feedback_disclose_subscription_requirements.md, both requirements are stated upfront in the App Store description. The app's UI also surfaces the subscription state inline when a feature needs it (e.g., the Spotify view shows a Connect Spotify call-to-action when no account is linked).
Known gotchas
- Spotify-to-Apple-Music track matching isn't perfect. The matching algorithm (title + artist + duration tolerance) gets ~85–95% accuracy on mainstream catalogs; obscure tracks, regional releases, and live recordings often miss. The UI surfaces unmatched tracks explicitly so the user can hand-resolve them.
- MusicKit's playlist write API is limited. Apple Music permits adding and removing tracks but not arbitrary metadata edits. The Locker has to work within those limits — "restore" means re-add the right tracks in the right order, not rewrite the playlist's name or description.
- Spotify rate limits. Spotify's Web API enforces per-app rate limits that the bulk-import use case can easily hit.
SpotifyServicepaces requests with a token-bucket style throttler; aggressive imports show a "slow down" inline state rather than failing outright. - Mac App Store sandbox + keychain. The app is sandboxed for Mac App Store distribution; keychain access for the OAuth tokens uses the app's own keychain group, not the user's login keychain. This means migrating to a new Mac requires re-authenticating Spotify; intentional, but worth knowing.
Sources
- Project source: github.com/fluhartyml/Cryo-Playlist-Manager (verified 2026-05-10).
- Companion music apps: Appendix M (CryoTunes Player), Appendix W (Tally Matrix Clock).
- Shared data layer: Appendix B (CryoKit) — same station catalog and dislike-management patterns.
- Apple Developer Documentation: MusicKit reference.
- Spotify Developer Documentation: Web API reference, Authorization Code with PKCE flow.