Skip to content
waveydudePublic

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

spotilast

Turn your complete Last.fm listening history into Apple Music playlists — with a rule-based playlist engine (forgotten favorites, obsessions, rediscoveries, time capsules…), confidence-scored catalog matching, and a manual review step for anything uncertain.

Setup

npm install
cp .env.example .env.local   # then fill in the credentials below
npm run dev                  # http://localhost:3210

1. Last.fm (required for sync)

Create an API account at https://www.last.fm/api/account/create and put the API key in .env.local as LASTFM_API_KEY. Optionally set LASTFM_USERNAME (you can also enter it on the Sync page).

2. Apple Music / MusicKit (required for matching + playlist creation)

Requires an Apple Developer Program membership ($99/yr):

  1. developer.apple.com → Certificates, Identifiers & Profiles
  2. Identifiers → create a Media ID (e.g. media.com.you.spotilast)
  3. Keys → create a key with Media Services (MusicKit) enabled, associate it with the Media ID, download the .p8 file (one-time download!)
  4. In .env.local, set APPLE_TEAM_ID, APPLE_KEY_ID, and APPLE_PRIVATE_KEY_PATH (absolute path to the .p8).

Secrets stay server-side; the browser only ever receives a signed short-lived developer token. Your listening data, match memory, presets and playlist history live in a SQLite database at data/spotilast.db.

Public deployment

For a public Railway deploy on lastfm.pokefinder.io, set:

APP_URL=https://lastfm.pokefinder.io
SPOTILAST_SESSION_SCOPED=true
SPOTILAST_DATA_DIR=/data

Then configure Spotify with the production callback shown in Settings and mount a persistent volume at /data so each visitor keeps their own session state across refreshes.

Flow

Sync (resumable, incremental) → Playlist Builder (rules/presets) → Preview (edit, reorder, add) → Match (exact / high / needs-review / unmatched) → Match Review (accept / choose / search / skip) → Create in Apple Music.

Architecture notes

  • src/lib/lastfm.ts — throttled Last.fm client with retries/backoff
  • src/lib/sync.ts — resumable page-walking sync engine
  • src/lib/stats.ts + rules.ts — destination-agnostic analytics + rule engine
  • src/lib/normalize.ts + matching.ts — title/artist normalization and confidence-scored Apple Music matching (cached in SQLite)
  • src/lib/destinations/ — PlaylistDestination interface; implement it to add Spotify or another destination without touching the analysis layers

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages