* feat: add Path to TrackInfo struct * refactor: improve naming to follow the rest of the code * test: add tests * fix: actually check for filesystem permission * refactor: remove library logic from specific plugins * refactor: move hasFilesystemPermission to a Manifest method * test(plugins): add unit tests for hasLibraryFilesystemAccess method Signed-off-by: Deluan <deluan@navidrome.org> * refactor(plugins): remove hasFilesystemPerm field and use manifest for filesystem permission checks Signed-off-by: Deluan <deluan@navidrome.org> * refactor(plugins): streamline library filesystem access checks in lyrics and scrobbler adapters Signed-off-by: Deluan <deluan@navidrome.org> --------- Signed-off-by: Deluan <deluan@navidrome.org> Co-authored-by: Deluan <deluan@navidrome.org>
85 lines
3 KiB
Go
85 lines
3 KiB
Go
// Code generated by ndpgen. DO NOT EDIT.
|
|
//
|
|
// This file provides stub implementations for non-WASM platforms.
|
|
// It allows Go plugins to compile and run tests outside of WASM,
|
|
// but the actual functionality is only available in WASM builds.
|
|
//
|
|
//go:build !wasip1
|
|
|
|
package lyrics
|
|
|
|
// ArtistRef is a reference to an artist with name and optional MBID.
|
|
type ArtistRef struct {
|
|
// ID is the internal Navidrome artist ID (if known).
|
|
ID string `json:"id,omitempty"`
|
|
// Name is the artist name.
|
|
Name string `json:"name"`
|
|
// MBID is the MusicBrainz ID for the artist.
|
|
MBID string `json:"mbid,omitempty"`
|
|
}
|
|
|
|
// GetLyricsRequest contains the track information for lyrics lookup.
|
|
type GetLyricsRequest struct {
|
|
Track TrackInfo `json:"track"`
|
|
}
|
|
|
|
// GetLyricsResponse contains the lyrics returned by the plugin.
|
|
type GetLyricsResponse struct {
|
|
Lyrics []LyricsText `json:"lyrics"`
|
|
}
|
|
|
|
// LyricsText represents a single set of lyrics in raw text format.
|
|
// Text can be plain text or LRC format — Navidrome will parse it.
|
|
type LyricsText struct {
|
|
Lang string `json:"lang,omitempty"`
|
|
Text string `json:"text"`
|
|
}
|
|
|
|
// TrackInfo contains track metadata.
|
|
type TrackInfo struct {
|
|
// ID is the internal Navidrome track ID.
|
|
ID string `json:"id"`
|
|
// Title is the track title.
|
|
Title string `json:"title"`
|
|
// Album is the album name.
|
|
Album string `json:"album"`
|
|
// Artist is the formatted artist name for display (e.g., "Artist1 • Artist2").
|
|
Artist string `json:"artist"`
|
|
// AlbumArtist is the formatted album artist name for display.
|
|
AlbumArtist string `json:"albumArtist"`
|
|
// Artists is the list of track artists.
|
|
Artists []ArtistRef `json:"artists"`
|
|
// AlbumArtists is the list of album artists.
|
|
AlbumArtists []ArtistRef `json:"albumArtists"`
|
|
// Duration is the track duration in seconds.
|
|
Duration float32 `json:"duration"`
|
|
// TrackNumber is the track number on the album.
|
|
TrackNumber int32 `json:"trackNumber"`
|
|
// DiscNumber is the disc number.
|
|
DiscNumber int32 `json:"discNumber"`
|
|
// MBZRecordingID is the MusicBrainz recording ID.
|
|
MBZRecordingID string `json:"mbzRecordingId,omitempty"`
|
|
// MBZAlbumID is the MusicBrainz album/release ID.
|
|
MBZAlbumID string `json:"mbzAlbumId,omitempty"`
|
|
// MBZReleaseGroupID is the MusicBrainz release group ID.
|
|
MBZReleaseGroupID string `json:"mbzReleaseGroupId,omitempty"`
|
|
// MBZReleaseTrackID is the MusicBrainz release track ID.
|
|
MBZReleaseTrackID string `json:"mbzReleaseTrackId,omitempty"`
|
|
// Path is the full path to the track file, relative to the library root.
|
|
// Only included if the plugin has library permission with filesystem access for the track's library.
|
|
Path string `json:"path,omitempty"`
|
|
}
|
|
|
|
// Lyrics requires all methods to be implemented.
|
|
// Lyrics provides lyrics for a given track from external sources.
|
|
type Lyrics interface {
|
|
// GetLyrics
|
|
GetLyrics(GetLyricsRequest) (GetLyricsResponse, error)
|
|
}
|
|
|
|
// NotImplementedCode is the standard return code for unimplemented functions.
|
|
const NotImplementedCode int32 = -2
|
|
|
|
// Register is a no-op on non-WASM platforms.
|
|
// This stub allows code to compile outside of WASM.
|
|
func Register(_ Lyrics) {}
|