From 81229ce757507e00566ad07bbcadf86386b729d9 Mon Sep 17 00:00:00 2001 From: chmanie Date: Sat, 20 May 2023 12:16:25 +0200 Subject: [PATCH] Add some more proto messages --- crabidy-core/proto/crabidy.proto | 27 +++++++++++++++++++++------ crabidy-core/src/lib.rs | 2 ++ 2 files changed, 23 insertions(+), 6 deletions(-) diff --git a/crabidy-core/proto/crabidy.proto b/crabidy-core/proto/crabidy.proto index 7b95149..bd944e4 100644 --- a/crabidy-core/proto/crabidy.proto +++ b/crabidy-core/proto/crabidy.proto @@ -5,25 +5,32 @@ service Library { rpc GetLibraryNode (LibraryNodeRequest) returns (LibraryNodeResponse); } -// To signal whether it's loading data (for frontend only probably) +// To signal whether it's loading data (for frontend only probably - +// could also be used for clients?) enum LibraryNodeState { LIBRARY_NODE_STATE_UNSPECIFIED = 0; LIBRARY_NODE_STATE_PENDING = 1; LIBRARY_NODE_STATE_DONE = 2; } +message Album { + string title = 1; + optional string release_date = 2; +} + +message Artist { + string name = 1; +} + message Track { // Including provider string uuid = 1; string artist = 2; string title = 3; + optional uint32 duration = 4; } -message LibraryNodeRequest { - string uuid = 1; -} - -message LibraryNodeResponse { +message LibraryNode { // Including provider string uuid = 1; string name = 2; @@ -33,3 +40,11 @@ message LibraryNodeResponse { repeated Track tracks = 6; bool is_queable = 7; } + +message LibraryNodeRequest { + string uuid = 1; +} + +message LibraryNodeResponse { + LibraryNode node = 1; +} diff --git a/crabidy-core/src/lib.rs b/crabidy-core/src/lib.rs index 175ab40..1634754 100644 --- a/crabidy-core/src/lib.rs +++ b/crabidy-core/src/lib.rs @@ -2,6 +2,8 @@ pub mod proto; use async_trait::async_trait; +use proto::crabidy::LibraryNode; + #[async_trait] pub trait ProviderClient: std::fmt::Debug + Send + Sync { async fn get_urls_for_track(&self, track_uuid: &str) -> Result, ProviderError>;