feat: get songs from jellyfin
This commit is contained in:
parent
49cf01c668
commit
12ad788452
7 changed files with 131 additions and 18 deletions
|
|
@ -1,12 +1,22 @@
|
|||
use serde::{Deserialize, Serialize};
|
||||
|
||||
#[derive(Debug, Serialize, Deserialize)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
pub struct GetItemsQueryStringModel {
|
||||
pub parent_id: String,
|
||||
pub sort_by: String,
|
||||
pub fields: String,
|
||||
pub enable_images: bool,
|
||||
pub enum GetItemsQueryString {
|
||||
Folder,
|
||||
Album,
|
||||
Songs,
|
||||
}
|
||||
|
||||
impl GetItemsQueryString {
|
||||
pub fn build(&self, parent_id: impl Into<String> + std::fmt::Display) -> String {
|
||||
let common = format!("parentId={parent_id}&enable_images=false");
|
||||
match self {
|
||||
Self::Folder => format!("{common}&SortBy=SortName&fields=Path,RecursiveItemCount"),
|
||||
Self::Album => format!("{common}&SortBy=SortName&fields=Path,RecursiveItemCount"),
|
||||
Self::Songs => format!(
|
||||
"{common}&SortBy=ParentIndexNumber,IndexNumber,SortName&fields=ItemCounts,MediaSourceCount,Path"
|
||||
),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Default, Debug, Clone, PartialEq, Serialize, Deserialize)]
|
||||
|
|
@ -32,6 +42,7 @@ pub struct ItemModel {
|
|||
pub album_artist: Option<String>,
|
||||
pub album_artists: Option<Vec<AlbumArtistModel>>,
|
||||
pub media_type: String,
|
||||
#[serde(default)]
|
||||
pub recursive_item_count: u64,
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue