mirror of
https://github.com/navidrome/navidrome.git
synced 2025-07-16 16:41:16 +03:00
* feat: add TimeNow function to SchedulerService plugin Added new TimeNow RPC method to the SchedulerService host service that returns the current time in two formats: RFC3339Nano string and Unix milliseconds int64. This provides plugins with a standardized way to get current time information from the host system. The implementation includes: - TimeNowRequest/TimeNowResponse protobuf message definitions - Go host service implementation using time.Now() - Complete test coverage with format validation - Generated WASM interface code for plugin communication * feat: add LocalTimeZone field to TimeNow response Added LocalTimeZone field to TimeNowResponse message in the SchedulerService plugin host service. This field contains the server's local timezone name (e.g., 'America/New_York', 'UTC') providing plugins with timezone context alongside the existing RFC3339Nano and Unix milliseconds timestamps. The implementation includes: - New local_time_zone protobuf field definition - Go implementation using time.Now().Location().String() - Updated test coverage with timezone validation - Generated protobuf serialization/deserialization code * docs: update plugin README with TimeNow function documentation Updated the plugins README.md to document the new TimeNow function in the SchedulerService. The documentation includes detailed descriptions of the three return formats (RFC3339Nano, UnixMilli, LocalTimeZone), practical use cases, and a comprehensive Go code example showing how plugins can access current time information for logging, calculations, and timezone-aware operations. * docs: remove wrong comment from InitRequest Signed-off-by: Deluan <deluan@navidrome.org> * fix: add missing TimeNow method to namedSchedulerService Added TimeNow method implementation to namedSchedulerService struct to satisfy the scheduler.SchedulerService interface contract. This method was recently added to the interface but the namedSchedulerService wrapper was not updated, causing compilation failures in plugin tests. The implementation is a simple pass-through to the underlying scheduler service since TimeNow doesn't require any special handling for named callbacks. --------- Signed-off-by: Deluan <deluan@navidrome.org>
246 lines
5.1 KiB
Protocol Buffer
246 lines
5.1 KiB
Protocol Buffer
syntax = "proto3";
|
|
|
|
package api;
|
|
|
|
option go_package = "github.com/navidrome/navidrome/plugins/api;api";
|
|
|
|
// go:plugin type=plugin version=1
|
|
service MetadataAgent {
|
|
// Artist metadata methods
|
|
rpc GetArtistMBID(ArtistMBIDRequest) returns (ArtistMBIDResponse);
|
|
rpc GetArtistURL(ArtistURLRequest) returns (ArtistURLResponse);
|
|
rpc GetArtistBiography(ArtistBiographyRequest) returns (ArtistBiographyResponse);
|
|
rpc GetSimilarArtists(ArtistSimilarRequest) returns (ArtistSimilarResponse);
|
|
rpc GetArtistImages(ArtistImageRequest) returns (ArtistImageResponse);
|
|
rpc GetArtistTopSongs(ArtistTopSongsRequest) returns (ArtistTopSongsResponse);
|
|
|
|
// Album metadata methods
|
|
rpc GetAlbumInfo(AlbumInfoRequest) returns (AlbumInfoResponse);
|
|
rpc GetAlbumImages(AlbumImagesRequest) returns (AlbumImagesResponse);
|
|
}
|
|
|
|
message ArtistMBIDRequest {
|
|
string id = 1;
|
|
string name = 2;
|
|
}
|
|
|
|
message ArtistMBIDResponse {
|
|
string mbid = 1;
|
|
}
|
|
|
|
message ArtistURLRequest {
|
|
string id = 1;
|
|
string name = 2;
|
|
string mbid = 3;
|
|
}
|
|
|
|
message ArtistURLResponse {
|
|
string url = 1;
|
|
}
|
|
|
|
message ArtistBiographyRequest {
|
|
string id = 1;
|
|
string name = 2;
|
|
string mbid = 3;
|
|
}
|
|
|
|
message ArtistBiographyResponse {
|
|
string biography = 1;
|
|
}
|
|
|
|
message ArtistSimilarRequest {
|
|
string id = 1;
|
|
string name = 2;
|
|
string mbid = 3;
|
|
int32 limit = 4;
|
|
}
|
|
|
|
message Artist {
|
|
string name = 1;
|
|
string mbid = 2;
|
|
}
|
|
|
|
message ArtistSimilarResponse {
|
|
repeated Artist artists = 1;
|
|
}
|
|
|
|
message ArtistImageRequest {
|
|
string id = 1;
|
|
string name = 2;
|
|
string mbid = 3;
|
|
}
|
|
|
|
message ExternalImage {
|
|
string url = 1;
|
|
int32 size = 2;
|
|
}
|
|
|
|
message ArtistImageResponse {
|
|
repeated ExternalImage images = 1;
|
|
}
|
|
|
|
message ArtistTopSongsRequest {
|
|
string id = 1;
|
|
string artistName = 2;
|
|
string mbid = 3;
|
|
int32 count = 4;
|
|
}
|
|
|
|
message Song {
|
|
string name = 1;
|
|
string mbid = 2;
|
|
}
|
|
|
|
message ArtistTopSongsResponse {
|
|
repeated Song songs = 1;
|
|
}
|
|
|
|
message AlbumInfoRequest {
|
|
string name = 1;
|
|
string artist = 2;
|
|
string mbid = 3;
|
|
}
|
|
|
|
message AlbumInfo {
|
|
string name = 1;
|
|
string mbid = 2;
|
|
string description = 3;
|
|
string url = 4;
|
|
}
|
|
|
|
message AlbumInfoResponse {
|
|
AlbumInfo info = 1;
|
|
}
|
|
|
|
message AlbumImagesRequest {
|
|
string name = 1;
|
|
string artist = 2;
|
|
string mbid = 3;
|
|
}
|
|
|
|
message AlbumImagesResponse {
|
|
repeated ExternalImage images = 1;
|
|
}
|
|
|
|
// go:plugin type=plugin version=1
|
|
service Scrobbler {
|
|
rpc IsAuthorized(ScrobblerIsAuthorizedRequest) returns (ScrobblerIsAuthorizedResponse);
|
|
rpc NowPlaying(ScrobblerNowPlayingRequest) returns (ScrobblerNowPlayingResponse);
|
|
rpc Scrobble(ScrobblerScrobbleRequest) returns (ScrobblerScrobbleResponse);
|
|
}
|
|
|
|
message ScrobblerIsAuthorizedRequest {
|
|
string user_id = 1;
|
|
string username = 2;
|
|
}
|
|
|
|
message ScrobblerIsAuthorizedResponse {
|
|
bool authorized = 1;
|
|
string error = 2;
|
|
}
|
|
|
|
message TrackInfo {
|
|
string id = 1;
|
|
string mbid = 2;
|
|
string name = 3;
|
|
string album = 4;
|
|
string album_mbid = 5;
|
|
repeated Artist artists = 6;
|
|
repeated Artist album_artists = 7;
|
|
int32 length = 8; // seconds
|
|
int32 position = 9; // seconds
|
|
}
|
|
|
|
message ScrobblerNowPlayingRequest {
|
|
string user_id = 1;
|
|
string username = 2;
|
|
TrackInfo track = 3;
|
|
int64 timestamp = 4;
|
|
}
|
|
|
|
message ScrobblerNowPlayingResponse {
|
|
string error = 1;
|
|
}
|
|
|
|
message ScrobblerScrobbleRequest {
|
|
string user_id = 1;
|
|
string username = 2;
|
|
TrackInfo track = 3;
|
|
int64 timestamp = 4;
|
|
}
|
|
|
|
message ScrobblerScrobbleResponse {
|
|
string error = 1;
|
|
}
|
|
|
|
// go:plugin type=plugin version=1
|
|
service SchedulerCallback {
|
|
rpc OnSchedulerCallback(SchedulerCallbackRequest) returns (SchedulerCallbackResponse);
|
|
}
|
|
|
|
message SchedulerCallbackRequest {
|
|
string schedule_id = 1; // ID of the scheduled job that triggered this callback
|
|
bytes payload = 2; // The data passed when the job was scheduled
|
|
bool is_recurring = 3; // Whether this is from a recurring schedule (cron job)
|
|
}
|
|
|
|
message SchedulerCallbackResponse {
|
|
string error = 1; // Error message if the callback failed
|
|
}
|
|
|
|
// go:plugin type=plugin version=1
|
|
service LifecycleManagement {
|
|
rpc OnInit(InitRequest) returns (InitResponse);
|
|
}
|
|
|
|
message InitRequest {
|
|
map<string, string> config = 1; // Configuration specific to this plugin
|
|
}
|
|
|
|
message InitResponse {
|
|
string error = 1; // Error message if initialization failed
|
|
}
|
|
|
|
// go:plugin type=plugin version=1
|
|
service WebSocketCallback {
|
|
// Called when a text message is received
|
|
rpc OnTextMessage(OnTextMessageRequest) returns (OnTextMessageResponse);
|
|
|
|
// Called when a binary message is received
|
|
rpc OnBinaryMessage(OnBinaryMessageRequest) returns (OnBinaryMessageResponse);
|
|
|
|
// Called when an error occurs
|
|
rpc OnError(OnErrorRequest) returns (OnErrorResponse);
|
|
|
|
// Called when the connection is closed
|
|
rpc OnClose(OnCloseRequest) returns (OnCloseResponse);
|
|
}
|
|
|
|
message OnTextMessageRequest {
|
|
string connection_id = 1;
|
|
string message = 2;
|
|
}
|
|
|
|
message OnTextMessageResponse {}
|
|
|
|
message OnBinaryMessageRequest {
|
|
string connection_id = 1;
|
|
bytes data = 2;
|
|
}
|
|
|
|
message OnBinaryMessageResponse {}
|
|
|
|
message OnErrorRequest {
|
|
string connection_id = 1;
|
|
string error = 2;
|
|
}
|
|
|
|
message OnErrorResponse {}
|
|
|
|
message OnCloseRequest {
|
|
string connection_id = 1;
|
|
int32 code = 2;
|
|
string reason = 3;
|
|
}
|
|
|
|
message OnCloseResponse {} |