revert to Pre-Transcoding

revert Playlist downloading and offline hardlinks
This commit is contained in:
2026-02-17 05:32:55 +00:00
parent 6419126982
commit 2f0493faa9

View File

@@ -1119,17 +1119,19 @@ fn handle_key(app: &mut App, code: KeyCode) {
None => { app.status = "No user_id (login first)".into(); return; } None => { app.status = "No user_id (login first)".into(); return; }
}; };
let (selected_item, playlist_ctx, selected_index) = match app.current_view() { let (it, playlist_name, playlist_index) = match app.current_view() {
View::Library { items, selected, playlist_ctx, .. } if !items.is_empty() => { View::Library { items, selected, playlist_ctx, .. } if !items.is_empty() => {
(items[*selected].clone(), playlist_ctx.clone(), *selected) let it = items[*selected].clone();
let pname = playlist_ctx.as_ref().map(|p| p.name.clone());
(it, pname, *selected)
} }
_ => { app.status = "Nothing to download here".into(); return; } _ => { app.status = "Nothing to download here".into(); return; }
}; };
// ensure DM
let dm = match &app.downloads { let dm = match &app.downloads {
Some(dm) => dm, Some(dm) => dm,
None => { None => {
// try start downloads now if we have a token
if cfg.access_token.is_some() { if cfg.access_token.is_some() {
app.downloads = Some(downloads::DownloadManager::start(cfg.clone())); app.downloads = Some(downloads::DownloadManager::start(cfg.clone()));
app.downloads.as_ref().unwrap() app.downloads.as_ref().unwrap()
@@ -1140,17 +1142,14 @@ fn handle_key(app: &mut App, code: KeyCode) {
} }
}; };
let client = match core::jellyfin::JellyfinClient::from_config(&cfg) { let jf = match core::jellyfin::JellyfinClient::from_config(&cfg) {
Ok(c) => c, Ok(c) => c,
Err(e) => { app.status = format!("downloads: {e}"); return; } Err(e) => { app.status = format!("downloads: {e}"); return; }
}; };
let ty = selected_item.item_type.as_deref().unwrap_or(""); if let Some(pname) = playlist_name {
// only allow direct playables from playlists
// ------------------------- let ty = it.item_type.as_deref().unwrap_or("");
// CASE 1: We are INSIDE a playlist view (already works)
// -------------------------
if let Some(pctx) = playlist_ctx {
let playable = matches!(ty, "Movie" | "Episode" | "Audio"); let playable = matches!(ty, "Movie" | "Episode" | "Audio");
if !playable { if !playable {
app.status = "Playlist downloads only support Movie/Episode/Audio".into(); app.status = "Playlist downloads only support Movie/Episode/Audio".into();
@@ -1158,53 +1157,15 @@ fn handle_key(app: &mut App, code: KeyCode) {
} }
dm.send(downloads::DownloadCommand::EnqueuePlaylistItem { dm.send(downloads::DownloadCommand::EnqueuePlaylistItem {
item: selected_item, item: it,
playlist_name: pctx.name, playlist_name: pname,
playlist_index: selected_index, playlist_index,
}); });
app.status = "queued 1 (playlist)".into(); app.status = "queued 1 (playlist)".into();
return; return;
} }
// ------------------------- match downloads::expand_for_enqueue(&jf, user_id, &it) {
// CASE 2: We are on the PLAYLIST LIST and selected item IS a playlist
// -> enqueue via playlist-aware path so we get hardlinks/order
// -------------------------
if ty == "Playlist" {
app.status = format!("Fetching playlist… {}", selected_item.name);
match client.playlist_items(user_id, &selected_item.id, 0, 200) {
Ok(page) => {
let pname = selected_item.name.clone();
let mut n = 0usize;
for (i, it) in page.items.into_iter().enumerate() {
let it_ty = it.item_type.as_deref().unwrap_or("");
let playable = matches!(it_ty, "Movie" | "Episode" | "Audio");
if !playable { continue; }
dm.send(downloads::DownloadCommand::EnqueuePlaylistItem {
item: it,
playlist_name: pname.clone(),
playlist_index: i,
});
n += 1;
}
app.status = format!("queued {n} (playlist)");
}
Err(e) => {
app.status = format!("Playlist load failed: {e}");
}
}
return;
}
// -------------------------
// CASE 3: Normal (non-playlist-container) download behavior
// -------------------------
match downloads::expand_for_enqueue(&client, user_id, &selected_item) {
Ok(items) => { Ok(items) => {
let n = items.len(); let n = items.len();
dm.send(downloads::DownloadCommand::Enqueue(items)); dm.send(downloads::DownloadCommand::Enqueue(items));
@@ -1215,7 +1176,6 @@ fn handle_key(app: &mut App, code: KeyCode) {
return; return;
} }
KeyCode::Char('q') => app.should_exit = true, KeyCode::Char('q') => app.should_exit = true,
//Enter code Block //Enter code Block