feat: Added stuff
This commit is contained in:
@@ -185,6 +185,39 @@ impl JellyfinClient {
|
||||
let out: jellyfin::BaseItemDtoQueryResult = serde_json::from_str(&text)?;
|
||||
Ok(out.items)
|
||||
}
|
||||
|
||||
pub async fn search(&self, query: impl AsRef<str>) -> Result<Vec<jellyfin::BaseItemDto>> {
|
||||
let text = &self
|
||||
.request_builder(Method::GET, "Items/Search")
|
||||
.query(&[("searchTerm", query.as_ref()), ("recursive", "true")])
|
||||
.send()
|
||||
.await?
|
||||
.error_for_status()?
|
||||
.text()
|
||||
.await?;
|
||||
let out: jellyfin::BaseItemDtoQueryResult = serde_json::from_str(&text)?;
|
||||
Ok(out.items)
|
||||
}
|
||||
|
||||
pub async fn thumbnail(
|
||||
&self,
|
||||
item: uuid::Uuid,
|
||||
image_type: jellyfin::ImageType,
|
||||
) -> Result<bytes::Bytes> {
|
||||
let uri = format!(
|
||||
"Items/{}/Images/{}",
|
||||
item,
|
||||
serde_json::to_string(&image_type).expect("Failed to serialize image type")
|
||||
);
|
||||
let bytes = self
|
||||
.request_builder(Method::GET, uri)
|
||||
.send()
|
||||
.await?
|
||||
.error_for_status()?
|
||||
.bytes()
|
||||
.await?;
|
||||
Ok(bytes)
|
||||
}
|
||||
}
|
||||
|
||||
// pub trait Item {
|
||||
|
||||
Reference in New Issue
Block a user