Playlist Integration!!!

This commit is contained in:
2026-02-14 17:34:23 -06:00
parent 56ba176615
commit 529ea7b49a
2 changed files with 80 additions and 2 deletions

View File

@@ -571,6 +571,7 @@ fn handle_key(app: &mut App, code: KeyCode) {
"Movies" => core::jellyfin::LibraryQuery::movies(),
"Shows" => core::jellyfin::LibraryQuery::shows(),
"Music" => core::jellyfin::LibraryQuery::music(),
"Playlists" => core::jellyfin::LibraryQuery::all().with_item_types("Playlist"),
_ => { app.status = format!("Not wired yet: {}", cat); return; }
};
@@ -606,7 +607,6 @@ fn handle_key(app: &mut App, code: KeyCode) {
open_children(app, format!("{} > {}", title, it.name), q);
return;
}
// Shows -> Seasons -> Episodes
if ty == "Series" {
let q = core::jellyfin::LibraryQuery::all()
@@ -622,7 +622,6 @@ fn handle_key(app: &mut App, code: KeyCode) {
open_children(app, format!("{} > {}", title, it.name), q);
return;
}
// MusicArtist -> MusicAlbum -> Audio
if ty == "MusicArtist" {
let q = core::jellyfin::LibraryQuery::all()
@@ -643,6 +642,39 @@ fn handle_key(app: &mut App, code: KeyCode) {
open_children(app, format!("{} > {}", title, it.name), q);
return;
}
if ty == "UserView" {
// Most UserViews are libraries like Shows/Movies/Music/Playlists.
// For Playlists view, drill into playlists.
let q = core::jellyfin::LibraryQuery::all()
.with_parent(it.id.clone())
.with_item_types("Playlist");
open_children(app, format!("{} > {}", title, it.name), q);
return;
}
if ty == "Playlist" {
let cfg = match &app.config { Some(c) => c.clone(), None => { app.status="No config".into(); return; } };
let user_id = match cfg.user_id.as_deref() { Some(u) => u, None => { app.status="Missing user_id".into(); return; } };
let client = match core::jellyfin::JellyfinClient::from_config(&cfg) { Ok(c)=>c, Err(e)=>{ app.status=e; return; } };
match client.playlist_items(user_id, &it.id, 0, PAGE_SIZE) {
Ok(page) => {
app.view_stack.push(View::Library {
title: format!("{} > {}", title, it.name),
// store a query placeholder; playlist paging could be done later if you want
query: core::jellyfin::LibraryQuery::all(),
items: page.items,
selected: 0,
start_index: 0,
total: page.total,
page_size: PAGE_SIZE,
loading: false,
});
app.status = "Loaded".into();
}
Err(e) => app.status = format!("Playlist load failed: {e}"),
}
return;
}
// Playables -> mpv
// Playables: do nothing on Enter (use 'p' to play)
if ty == "Episode" || ty == "Audio" || ty == "Movie" {