misterdownloadmanager: The ultimate open-source, clean-room download manager written from scratch in pure Rust for Windows, Mac, and Linux
Rust bittorrent-clientdebriddownload-acceleratordownload-managerdownloadmanagereguifile-downloadergallery-dlidmidm-alternativeinternet-download-managerm3u8-downloadermagnetplaylist-downloaderreal-debridrusttorrent-clientvideo-downloaderyoutube-downloaderyt-dlp
A video's connections table shows yt-dlp's one connection while it looks the page up or downloads itself (fixes #793) (#885)
Ahmed Nefzaoui3a1f5a7a39b6
diff --git a/CHANGELOG.md b/CHANGELOG.mdindex cbd88c16..8ebe975e 100644--- a/CHANGELOG.md+++ b/CHANGELOG.md@@ -32,6 +32,7 @@ Each release's notes on GitHub come from its section here (`## [X.Y.Z]`, see### Fixed+- The progress window's connections table is no longer empty while a video downloads. MDM's own downloader now brings videos down (0.5.2 left them to yt-dlp, whose connections MDM couldn't see), so the table lists its connections, as many as **Options → Connection** gives (8 by default; a stream in pieces as many pieces at once). While yt-dlp looks the page up first, and for a video it still downloads itself (a live stream, an RTMP stream), the table shows that one connection and what it is doing instead of nothing ([#793](https://github.com/anefzaoui/misterdownloadmanager/issues/793)).- After a download's last byte, the progress window and the list say what MDM is doing and how far it is: **Verifying… (45%)** while the file is checked against its checksum, and **Merging… (45%)** while a video's picture and sound are joined into one file (read from the size of the file ffmpeg writes); the list's narrow Status column puts the percentage first, **45% verified**. Meanwhile the progress window's bar starts again in the accent colour and fills as the check or the merge goes. While the last of a file is written out, the progress window says **Finishing…**, not **Connecting…** as before. The map of the connections' parts also fills each finished part up to the next one: a finished download showed small gaps at the end of each part ([#736](https://github.com/anefzaoui/misterdownloadmanager/issues/736)).- Windows: the file you drag out of **Download complete** (its small box at the bottom right) is moved or copied as when you drag a file in Explorer: moved to a folder on the same drive (or with **Shift** held), copied to another drive (or with **Ctrl** held), a shortcut with **Alt**. MDM offered only a copy, so the file was always copied and the original stayed in the download folder. A moved file is followed: its download points to the new place, so the list, **Download complete** and **File Properties** show it there, and **Open** and **Open folder** open it there. Where MDM can't learn where a moved file went (a program that took it, the Recycle Bin), **Open** and **Open folder** say it was moved elsewhere, and where to look, instead of failing. MDM never deletes the file itself: a program that only copies it leaves it where it was ([#869](https://github.com/anefzaoui/misterdownloadmanager/issues/869)).- Windows: MDM's windows are no longer drawn as garbage on a graphics card whose OpenGL is older than 3.0 and that has no Direct3D 12 driver (Intel's first HD Graphics, whose OpenGL is 2.1). MDM fell back from Direct3D 12 to OpenGL there, which can't draw it. It now reads OpenGL's version as it starts: one older than 3.0 is passed over, and MDM starts again with Direct3D 12 on Windows' own software renderer (WARP), which draws it right. That is remembered, so the next starts go straight to WARP, with OpenGL as the last way should WARP fail. **View → Draw with** says that WARP draws and why; choosing **OpenGL** there tries it again. Other graphics cards draw as before ([#835](https://github.com/anefzaoui/misterdownloadmanager/issues/835)).diff --git a/ROADMAP.md b/ROADMAP.mdindex bb7d8a1c..436efdfa 100644--- a/ROADMAP.md+++ b/ROADMAP.md@@ -557,6 +557,10 @@ Bug fixes from the first days of 0.5.0, a Safari extension, and more file types.These ship in the next version.+- ✅ The progress window's connections table while a video downloads: MDM's own connections (as+ many as Options → Connection gives), and yt-dlp's one connection while it looks the page up or+ downloads a live stream itself, instead of an empty table+ ([#793](https://github.com/anefzaoui/misterdownloadmanager/issues/793))- ✅ After the last byte, the progress window says **Verifying… (45%)** or **Merging… (45%)**and the list **45% verified**, the bar showing it in the accent colour, and **Finishing…** rather than**Connecting…**; a finished download's map of parts has no gapsdiff --git a/crates/app/src/model.rs b/crates/app/src/model.rsindex 7fcb4eaa..0b929deb 100644--- a/crates/app/src/model.rs+++ b/crates/app/src/model.rs@@ -545,10 +545,11 @@ pub struct GallerySpec {}/// A helper's progress (yt-dlp's, gallery-dl's) as the engine's view: one segment when its size-/// is known, no connections, its notes as events. A video whose streams MDM's engine downloads-/// (#769) shows the engine's own: the streams' segments one after another, the connections of-/// the one under way, its server.+/// is known, one connection (theirs: neither opens more), its notes as events. A video whose+/// streams MDM's engine downloads (#769) shows the engine's own: the streams' segments one after+/// another, the connections of the one under way, its server.fn tool_snapshot(p: mdm_tools::video::Progress, url: &Url) -> mdm_engine::Snapshot {+ use mdm_engine::download::{ConnStatus, ConnView};use mdm_tools::video::State as V;let (state, file, error) = match p.state {// Every stream in, their file being joined (#736).@@ -559,6 +560,18 @@ fn tool_snapshot(p: mdm_tools::video::Progress, url: &Url) -> mdm_engine::SnapshV::Stopped => (State::Cancelled, None, None),};let size = p.total;+ // Downloaded by the helper itself (a live stream, RTMP; looking the page up): its one+ // connection, not an empty list (#793).+ let own = (p.engine.is_none() && state == State::Downloading).then(|| ConnView {+ id: 0,+ downloaded: p.downloaded,+ status: if p.speed > 0.0 {+ ConnStatus::Receiving+ } else {+ ConnStatus::Connecting+ },+ speed: p.speed as u64,+ });let engine = p.engine.unwrap_or_default();let segments = if engine.segments.is_empty() {size.map(|t| {@@ -580,7 +593,7 @@ fn tool_snapshot(p: mdm_tools::video::Progress, url: &Url) -> mdm_engine::Snapshdownloaded: p.downloaded,resumable: Some(true),segments,- connections: engine.connections,+ connections: own.into_iter().chain(engine.connections).collect(),error,failure: None,events: p@@ -1560,3 +1573,66 @@ mod finished_file_gone_tests {std::fs::remove_dir_all(&dir).unwrap();}}++#[cfg(test)]+mod helper_connection_tests {+ use super::*;+ use mdm_engine::download::{ConnStatus, ConnView};++ fn progress() -> mdm_tools::video::Progress {+ mdm_tools::video::Progress {+ state: mdm_tools::video::State::Running,+ downloaded: 0,+ total: None,+ speed: 0.0,+ events: Vec::new(),+ side_files: Vec::new(),+ sub_problems: Vec::new(),+ engine: None,+ helper: None,+ merging: None,+ }+ }++ /// #793: a video yt-dlp downloads itself shows its one connection, not an empty list; one+ /// MDM's engine downloads shows the engine's connections, every one of them.+ #[test]+ fn the_connections_list_is_never_empty_while_a_video_downloads() {+ let page: Url = "https://www.example.com/watch?v=abc".parse().unwrap();+ let mut p = progress();+ let s = tool_snapshot(p.clone(), &page);+ assert_eq!(s.connections.len(), 1);+ assert!(matches!(s.connections[0].status, ConnStatus::Connecting));+ p.downloaded = 5_000;+ p.speed = 1_000.0;+ p.helper = Some(mdm_tools::streams::Helper::Live);+ let s = tool_snapshot(p.clone(), &page);+ assert_eq!(+ (s.connections[0].id, s.connections[0].downloaded),+ (0, 5_000)+ );+ assert!(matches!(s.connections[0].status, ConnStatus::Receiving));++ let conn = |id| ConnView {+ id,+ downloaded: 100,+ status: ConnStatus::Receiving,+ speed: 10,+ };+ p.helper = None;+ p.engine = Some(mdm_tools::streams::View {+ connections: (0..8).map(conn).collect(),+ ..Default::default()+ });+ let s = tool_snapshot(p.clone(), &page);+ assert_eq!(+ s.connections.iter().map(|c| c.id).collect::<Vec<_>>(),+ (0..8).collect::<Vec<_>>()+ );++ // Done: no connection left.+ p.engine = None;+ p.state = mdm_tools::video::State::Done("Clip.mp4".into());+ assert!(tool_snapshot(p, &page).connections.is_empty());+ }+}