not there yet but has potential

This commit is contained in:
2026-02-16 01:37:57 -06:00
parent aa4c4fc8e6
commit dfcf3fcf2a
7 changed files with 3425 additions and 78 deletions
+35 -1
View File
@@ -190,6 +190,9 @@ impl JellyfinClient {
if let Some(term) = query.search_term.as_deref() {
req = req.query(&[("SearchTerm", term)]);
}
if let Some(filters) = query.filters.as_deref() {
req = req.query(&[("Filters", filters)]);
}
let resp = req.send().map_err(|e| format!("request failed: {e}"))?;
@@ -209,7 +212,28 @@ impl JellyfinClient {
})
}
pub fn playlist_items(
/// Returns true if there exists at least one resumable Episode under the given parent (Series or Season).
/// This is used to mark Series/Season rows as "in progress" even when Jellyfin doesn't populate
/// PlayedPercentage on those container types.
pub fn has_resumable_under(
&self,
user_id: &str,
parent_id: &str,
) -> Result<bool, String> {
// Series -> Season -> Episode, so this MUST be recursive for Series.
// Recursive=true is also fine for Season.
let mut q = LibraryQuery::all()
.with_parent(parent_id.to_string())
.with_item_types("Episode")
.with_filters("IsResumable");
q.recursive = true;
let page = self.list_items(user_id, q, 0, 1)?;
Ok(page.total > 0)
}
pub fn playlist_items(
&self,
user_id: &str,
playlist_id: &str,
@@ -255,6 +279,7 @@ pub struct LibraryQuery {
pub parent_id: Option<String>, // e.g. Some(series_id)
pub search_term: Option<String>, // e.g. Some("matrix".into())
pub recursive: bool, // true for big lists, false for drilldown
pub filters: Option<String>, // e.g. Some("IsResumable".into())
}
impl LibraryQuery {
@@ -264,6 +289,7 @@ impl LibraryQuery {
parent_id: None,
search_term: None,
recursive: true,
filters: None,
}
}
pub fn shows() -> Self {
@@ -272,6 +298,7 @@ impl LibraryQuery {
parent_id: None,
search_term: None,
recursive: true,
filters: None,
}
}
pub fn music() -> Self {
@@ -280,6 +307,7 @@ impl LibraryQuery {
parent_id: None,
search_term: None,
recursive: true,
filters: None,
}
}
@@ -290,6 +318,7 @@ impl LibraryQuery {
parent_id: None,
search_term: None,
recursive: true,
filters: None,
}
}
@@ -308,6 +337,11 @@ impl LibraryQuery {
self.include_item_types = Some(types.into());
self
}
pub fn with_filters(mut self, filters: impl Into<String>) -> Self {
self.filters = Some(filters.into());
self
}
}