MusicPlayerDaemon / MPD

Music Player Daemon
https://www.musicpd.org/
GNU General Public License v2.0
2.17k stars 352 forks source link

More data with sticker db responses #1104

Open gilphilbert opened 3 years ago

gilphilbert commented 3 years ago

Feature request

Today, the sticker API is a proxy to the underlying SQLite database; the API queries the database, but sticker APIs are distinct from MPD database responses, even though the two are linked by song URIs. This provides a centralized solution for custom metadata handling while keeping the internal database clean. However, queries from the sticker database aren't connected to the main database, so a sticker query that returns 50 results then results in 50 API calls to get the song information from the database (title, artist, etc.)

A useful feature would be the joining of sticker responses with database responses, so a single API request could query the sticker db and get back an array of database songs with sticker attributes attached:

sticker find "playCount > 10"
[
  {
    file: "abc.flac",
    title: "def",
    artist: "ghi",
    album: "jkl",
    ...
    stickers: {
      playCount: 14,
      dateAdded: 1352234
    }
  },
  ...
]

Clients could then query the sticker database for song results without needing to then make additional queries against the API per result to get the song detail.

jcorporation commented 3 years ago

This would be great for a client who stores additional data for songs in the sticker database. In my own myMPD client, I use a sticker cache to workaround this limitation.