Skip to main content

OpenSubsonic compatibility adapter

Imported component documentation. Source: melodee-project/melodee-api at commit 0267c458207082337d9baf1130deeb65f43c9d4a. Version 1.0.1. License MIT. Status: implemented-and-automatically-verified candidate; not published, deployed or production-qualified. This is the component's committed documentation, not proof of a distribution release or production qualification.

melodee-api exposes a headless OpenSubsonic 1.16.1 surface at /rest/{operation} (.view suffix accepted) over the shared canonical services. It does not keep a second catalog, listener store or playlist model: favorites, ratings, playbacks and playlists are the same facts the native API uses, and streaming is the same ranged asset response.

Authentication and credentials​

Create a per-device credential with an interactive session:

POST /api/v1/auth/compatibility-credentials
{ "protocol": "subsonic", "label": "Android phone" }

The response contains a one-time 64-hex secret and the username (the account public id). PostgreSQL stores only a SHA-256 digest. Present either:

  • apiKey=<secret> (OpenSubsonic extension apiKeyAuthentication v1), or
  • u=<username>&p=<secret> / p=enc:<hex(secret)>.

t/s token authentication is not supported: the server stores a digest and cannot verify md5(secret+salt) without the cleartext secret. This is recorded in the capability matrix rather than emulated insecurely. Wrong, revoked or disabled- account credentials return protocol error 40; revocation is immediate (DELETE /api/v1/auth/compatibility-credentials/{id}); at most 20 active credentials per account/protocol. The secret is never returned again.

Supported operations​

AreaOperations
Systemping, getLicense, getUser, getOpenSubsonicExtensions, getScanStatus, getNowPlaying (empty; live state is not tracked)
LibrarygetMusicFolders, getArtists, getArtist, getAlbum, getAlbumList2 (newest, recent, frequent, alphabeticalByName, alphabeticalByArtist, random), getRandomSongs
Searchsearch3 (artists, albums, songs)
GenresgetGenres, getSongsByGenre
Playbackstream (HTTP Range, 206, strong SHA-256 ETag), getCoverArt (302 to the public artwork variant; clients must follow redirects)
Listener statestar/unstar (songs), setRating (0 clears), scrobble, getStarred2 (songs)
PlaylistsgetPlaylists, getPlaylist, createPlaylist, updatePlaylist (rename, comment, add, remove by index), deletePlaylist

Responses honour f=json or default XML (subsonic-response envelope with status, version, type, serverVersion, openSubsonic). Protocol errors use HTTP 200 (except authentication, which is 401) with status="failed" and a numeric error.code. Pages are bounded to 500 items; playlist responses to 500 entries.

Deliberately unsupported​

Album/artist stars, getStarred/search2/getAlbumList (v1), getIndexes, getMusicDirectory, getSong, download, artist/album info (getArtistInfo2, getAlbumInfo2), similar/top songs, lyrics, bookmarks, play queue, shares, internet radio, podcasts, jukebox, avatars and on-the-fly transcoding (maxBitRate, format, size are not applied). Requesting one returns a protocol 0 error with an explicit message; no unsupported endpoint is advertised as working.

Named third-party clients (DSub, Symfonium, Feishin, Sonixd, …) have not been tested. The adapter is verified by deterministic in-process HTTP fixtures only.

cross-protocol guarantees​

  • A star is the native favorite; setRating updates the native rating and is visible at GET /api/v1/tracks/{id}/listener-state.
  • scrobble stores a listening event under canonical identity with source opensubsonic and central qualification; it cannot count as a play merely by fetching a stream.
  • Playlist entries preserve occurrence identity; the same Track may appear twice.
  • Playlist visibility and ownership are enforced by the shared store; another account receives protocol error 70, never the private playlist.
  • Streaming serves the same immutable preferred asset with the same SHA-256 ETag.

Verification​

tests/api_v1.rs::opensubsonic_adapter_uses_canonical_services_and_revocable_credentials covers credential creation/inventory/revocation, JSON and XML envelopes, username/password and apiKey auth, missing/token auth failures, artists/album/ search/album-list, ranged streaming with ETag, star/starred, rating cross-protocol visibility, scrobble storage, playlist create/get/update-with-repeat/delete, cross-account playlist isolation and immediate revocation.