A CLI tool to copy Last.fm scrobble data from one user to another.
- Node.js 18.0.0 or higher
- pnpm (managed via corepack)
- Last.fm API key
-
Enable corepack (if not already enabled):
corepack enable -
Install dependencies:
pnpm install
-
Get a Last.fm API key:
- Visit https://www.last.fm/api/account/create
- Create an application to get your API key
-
Set up environment variables:
cp .env.example .env # Edit .env and add your Last.fm API key
pnpm buildpnpm dev [command] [options]pnpm start [command] [options]You can provide your Last.fm API key in three ways:
-
.env file (recommended):
cp .env.example .env # Edit .env and set your API credentials: # LASTFM_API_KEY=your-api-key-here # LASTFM_API_SECRET=your-api-secret-here (required for authentication)
-
Environment variable:
export LASTFM_API_KEY="your-api-key-here"
-
Command line option:
scrobble-duplicator copy --api-key "your-api-key-here" --api-secret "your-api-secret-here" [other options]
The app uses Last.fm's authentication system to securely copy scrobbles to your account. When you run a command that requires authentication (copy, browse, or watch), the app will:
- Get an authentication token from Last.fm
- Open your browser to authorize the application
- Exchange the token for a session key after you authorize
After successful authentication, the app will display your session credentials. You can add these to your .env file to skip the authentication flow in future runs:
LASTFM_SESSION_KEY=your-session-key-here
LASTFM_USERNAME=your-username-hereNote: You need both an API key AND API secret for authentication. The API secret is required to generate secure signatures for authenticated requests.
scrobble-duplicator copy --source SOURCE_USERNAMECopy a limited number of recent scrobbles from source user to your authenticated account.
Options:
-s, --source <username>: Source Last.fm username to copy from (required)-k, --api-key <key>: Last.fm API key (optional if set via environment)--api-secret <secret>: Last.fm API secret (required for authentication)-d, --dry-run: Show what would be copied without actually copying--limit <number>: Limit number of scrobbles to copy (default: 100)
scrobble-duplicator browse --source SOURCE_USERNAMEBrowse through recent scrobbles with pagination and select a starting point. Copies all scrobbles from the selected one to the most recent to your authenticated account.
Options:
-s, --source <username>: Source Last.fm username to copy from (required)-k, --api-key <key>: Last.fm API key (optional if set via environment)--api-secret <secret>: Last.fm API secret (required for authentication)-d, --dry-run: Show what would be copied without actually copying
scrobble-duplicator watch --source SOURCE_USERNAMEContinuously monitor the source user for new scrobbles and copy them to your authenticated account in real-time.
Options:
-s, --source <username>: Source Last.fm username to copy from (required)-k, --api-key <key>: Last.fm API key (optional if set via environment)--api-secret <secret>: Last.fm API secret (required for authentication)-d, --dry-run: Show what would be copied without actually copying-i, --interval <seconds>: Check interval in seconds (default: 30)
scrobble-duplicator validate --username USERNAMEOptions:
-u, --username <username>: Last.fm username to validate (required)-k, --api-key <key>: Last.fm API key (optional if set via environment)
# Validate a user exists
scrobble-duplicator validate --username alice
# Simple copy - copy recent 50 scrobbles (dry run)
scrobble-duplicator copy --source alice --limit 50 --dry-run
# Browse and select - interactive selection of starting point
scrobble-duplicator browse --source alice --dry-run
# Watch mode - monitor for new scrobbles every 60 seconds
scrobble-duplicator watch --source alice --interval 60
# Watch mode with dry run - see what would be copied without actually copying
scrobble-duplicator watch --source alice --dry-run --interval 30pnpm build- Build TypeScript to JavaScriptpnpm dev- Run in development mode with tsxpnpm test- Run tests with vitestpnpm test:watch- Run tests in watch modepnpm lint- Run ESLintpnpm lint:fix- Run ESLint with auto-fixpnpm format- Format code with Prettierpnpm clean- Remove build artifacts
src/
├── cli.ts # CLI entry point and command definitions
├── index.ts # Main ScrobbleDuplicator class
└── types/ # TypeScript type definitions (future)
MIT