From cdff5c0e483290f7b9da835b248a07d0db914d1e Mon Sep 17 00:00:00 2001 From: Erica Z Date: Sun, 10 Nov 2024 15:36:11 +0100 Subject: [PATCH] tbd search results --- Cargo.lock | 1 + Cargo.toml | 2 +- src/subsonic/schema.rs | 25 +++++++++++++++++++++++++ 3 files changed, 27 insertions(+), 1 deletion(-) diff --git a/Cargo.lock b/Cargo.lock index 629e798..54fcb26 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2651,6 +2651,7 @@ dependencies = [ "form_urlencoded", "idna", "percent-encoding", + "serde", ] [[package]] diff --git a/Cargo.toml b/Cargo.toml index 485b56e..ccdb9ec 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -24,7 +24,7 @@ serde = { version = "1.0.214", features = ["derive"] } tokio = { version = "1", features = ["rt-multi-thread"] } tracing = { version = "0.1.40", default-features = false, features = ["attributes", "std"] } tracing-subscriber = "0.3.18" -url = "2.5.2" +url = { version = "2.5.2", features = ["serde"] } zbus = { version = "5.0.1", features = ["chrono"] } [build-dependencies] diff --git a/src/subsonic/schema.rs b/src/subsonic/schema.rs index ef27b1f..fff37bf 100644 --- a/src/subsonic/schema.rs +++ b/src/subsonic/schema.rs @@ -1,5 +1,6 @@ use chrono::{offset::Utc, DateTime}; use serde::Deserialize; +use url::Url; #[derive(Debug, Deserialize)] #[serde(rename_all = "kebab-case")] @@ -82,3 +83,27 @@ pub struct AlbumID3 { pub played: Option>, // TODO: opensubsonic extensions? } + +#[derive(Debug, Deserialize)] +#[serde(rename_all = "camelCase")] +pub struct SearchResults3Outer { + pub search_results3: SearchResults3, +} + +#[derive(Debug, Deserialize)] +pub struct SearchResults3 { + pub artist: Option>, + pub album: Option>, + pub song: Option>, +} + +#[derive(Debug, Deserialize)] +#[serde(rename_all = "camelCase")] +pub struct ArtistID3 { + pub id: String, + pub name: String, + pub cover_art: Option, + pub artist_image_url: Option, + pub album_count: Option, + pub starred: Option>, +}