Favorites

Save and manage user's favorite tracks, albums, and artists.

Favorites API for Plugins

The Favorites API lets Nuclear, as well as plugins, read and modify the user's library of saved tracks, albums, and artists.

circle-info

Access favorites via NuclearAPI.Favorites.* in your plugin's lifecycle hooks. All operations are asynchronous and return Promises.


Core concepts

What gets stored

Nuclear stores three types of favorites:

Type
What's saved

Tracks

Full track metadata

Albums

Album reference

Artists

Artist reference

Each favorite entry includes a timestamp (addedAtIso) recording when it was added.

Identity and deduplication

Favorites are identified by their source fiels. It's a combination of provider name and ID. Because each metadata provider stores music data differently, favorites from each provider are treated separately.

type ProviderRef = {
  provider: string;  // e.g., "musicbrainz", "lastfm"
  id: string;        // Provider-specific identifier
  url?: string;      // Optional link to the source
};

Adding the same track twice (same provider + ID) is a no-op. The original entry and timestamp are preserved.

Persistence

Favorites are saved to disk automatically after every add/remove operation. They persist across app restarts.


Quick start

Last updated