Skip to content

Automatically update your Bluesky profile with your latest scrobbles on Last.fm or ListenBrainz

Notifications You must be signed in to change notification settings

deviant-forks/scrobble-blue

 
 

Repository files navigation

Scrobble Blue

A Bluesky integration that:

  1. Updates your profile description with your currently playing track from Last.fm or ListenBrainz
  2. Posts your weekly top 5 artists every Friday at 15:00 UTC (Last.fm only)

This application requires a Bluesky account and at least one scrobble service API key. You can use the free tier of Cloudflare for this application.

Features

Profile Description Updates

Updates your Bluesky profile description with your currently playing track. This runs every minute and will update your profile if you're currently scrobbling a track.

  • Supports both Last.fm and ListenBrainz
  • When both services are configured, uses the most recently scrobbled track
  • Updates every minute
  • Only updates when there's a new track playing

Profile Description Example

Weekly Top 5 Artists

Every Friday at 15:00 UTC, posts an image to your Bluesky feed showing your top 5 most played artists from the past week.

  • Currently supports Last.fm only
  • Posts automatically every Friday at 15:00 UTC
  • Generates a custom image with your top 5 artists of the last week.
  • Includes play counts for each artist

Weekly Top 5 Artists Example

Prerequisites

Cloudflare Account

This is a Cloudflare worker, so you'll need an account.

  • Sign up at Cloudflare
  • Install Wrangler: npm install -g wrangler
  • Run wrangler login

Bluesky App Password

  • Log into Bluesky
  • Go to Settings → App Passwords
  • Create a new app password. You can use your real password, but it's recommended to create a new one for this app that can be revoked if necessary. This also allows you to login even if you have MFA enabled.

Scrobble Services

You need to set up at least one of these services:

Last.fm

ListenBrainz

Note: The weekly top 5 artists feature currently only works with Last.fm. If both services are configured for profile updates, Scrobble Blue will automatically use the most recently scrobbled track from either service.

Setup

  1. Clone the repository:

    git clone git@github.com:willmanduffy/scrobble-blue.git
    cd scrobble-blue
  2. Install dependencies:

    npm install
  3. Create a KV namespace:

    • Go to your Cloudflare Dashboard
    • Navigate to Workers & Pages → KV
    • Click "Create a namespace"
    • Name it BLUESKY_SESSION_STORAGE
    • Copy the ID of the newly created namespace
  4. Configure environment variables:

    cp .dev.vars.example .dev.vars
    cp wrangler.toml.example wrangler.toml

    Fill out .dev.vars with your credentials and replace the KV_ID in wrangler.toml with your copied KV namespace ID. It should look like this:

    kv_namespaces = [
      { binding = "BLUESKY_SESSION_STORAGE", id = "your-kv-namespace-id" }
    ]
  5. Deploy secrets to Cloudflare:

    wrangler secret put BSKY_USERNAME
    wrangler secret put BSKY_PASSWORD
    # For Last.fm
    wrangler secret put LASTFM_API_KEY
    wrangler secret put LASTFM_SECRET
    wrangler secret put LASTFM_USERNAME
    # For ListenBrainz
    wrangler secret put LISTENBRAINZ_TOKEN
    wrangler secret put LISTENBRAINZ_USERNAME
  6. Deploy the worker:

    wrangler deploy

Development

Run locally:

wrangler dev --test-scheduled

To test the different scheduled tasks locally:

# Test currently playing track sync
curl "http://localhost:8787/__scheduled?cron=*+*+*+*+*"

# Test weekly top artists post (Last.fm only)
curl "http://localhost:8787/__scheduled?cron=0+15+*+*+6"

To run tests:

npx vitest

About

Automatically update your Bluesky profile with your latest scrobbles on Last.fm or ListenBrainz

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • TypeScript 98.1%
  • JavaScript 1.9%