🎧 Your Personal Streaming Service
Go airsonicmadsonicmedia-servermusicmusic-servernavidromeopensubsonicraspberry-piself-hostedstreamerstreaming-apistreaming-audiosubsonicsubsonic-server
docs(plugins): document how a metadata agent signals "not found" (#6001)
Deluan Quintão0a55cc8cafdd
diff --git a/plugins/README.md b/plugins/README.mdindex b04e12bd9..7042b8c45 100644--- a/plugins/README.md+++ b/plugins/README.md@@ -174,6 +174,14 @@ Capabilities define what your plugin can do. They're automatically detected baseProvides artist and album metadata. All methods are **optional** — implement only the ones your data source supports.+> **Returning "not found".** When you have no data for an item, return an empty response and no+> error. In the Go PDK that is `return nil, nil`. Navidrome reads it as a definitive "not found"+> and stops asking.+>+> Return an error only when the plugin itself failed, such as an unreachable API or a broken host+> call. Navidrome retries failed calls with backoff. A plugin that errors on "no data" makes+> Navidrome retry every item it has no data for.+| Function | Input | Output | Description ||-----------------------------------|----------------------------|----------------------------------|--------------------------|| `nd_get_artist_mbid` | `{id, name}` | `{mbid}` | Get MusicBrainz ID |diff --git a/plugins/capabilities/metadata_agent.go b/plugins/capabilities/metadata_agent.goindex f856562c6..72cb1622f 100644--- a/plugins/capabilities/metadata_agent.go+++ b/plugins/capabilities/metadata_agent.go@@ -9,6 +9,9 @@ import "github.com/navidrome/navidrome/plugins/types"// Plugins implementing this capability can choose which methods to implement.// Each method is optional - plugins only need to provide the functionality they support.//+// To say "no data for this item", return a nil response and a nil error. Return an error only when+// the plugin itself failed, because Navidrome retries failed calls with backoff.+////nd:capability name=metadatatype MetadataAgent interface {// GetArtistMBID retrieves the MusicBrainz ID for an artist.diff --git a/plugins/pdk/go/metadata/metadata.go b/plugins/pdk/go/metadata/metadata.goindex c561c2893..bb0ae9620 100644--- a/plugins/pdk/go/metadata/metadata.go+++ b/plugins/pdk/go/metadata/metadata.go@@ -186,6 +186,9 @@ type TopSongsResponse struct {//// Plugins implementing this capability can choose which methods to implement.// Each method is optional - plugins only need to provide the functionality they support.+//+// To say "no data for this item", return a nil response and a nil error. Return an error only when+// the plugin itself failed, because Navidrome retries failed calls with backoff.type Metadata interface{}// ArtistMBIDProvider provides the GetArtistMBID function.diff --git a/plugins/pdk/go/metadata/metadata_stub.go b/plugins/pdk/go/metadata/metadata_stub.goindex e72cca103..572eba4da 100644--- a/plugins/pdk/go/metadata/metadata_stub.go+++ b/plugins/pdk/go/metadata/metadata_stub.go@@ -184,6 +184,9 @@ type TopSongsResponse struct {//// Plugins implementing this capability can choose which methods to implement.// Each method is optional - plugins only need to provide the functionality they support.+//+// To say "no data for this item", return a nil response and a nil error. Return an error only when+// the plugin itself failed, because Navidrome retries failed calls with backoff.type Metadata interface{}// ArtistMBIDProvider provides the GetArtistMBID function.