Skip to content

Commit 2b0f1b7

Browse files
authored
Merge pull request #22 from houssemko/dialog-ux
Lookup gating, audio-aware wording, Media naming
2 parents 1a5b811 + 4592650 commit 2b0f1b7

6 files changed

Lines changed: 149 additions & 87 deletions

File tree

‎po/grab.pot‎

Lines changed: 72 additions & 66 deletions
Original file line numberDiff line numberDiff line change
@@ -190,14 +190,6 @@ msgstr ""
190190
msgid "Incomplete piece"
191191
msgstr ""
192192

193-
#: src/download.rs:1942
194-
msgid "That link is not a supported video page"
195-
msgstr ""
196-
197-
#: src/download.rs:1961 src/download.rs:2015
198-
msgid "Waiting to resolve video…"
199-
msgstr ""
200-
201193
#: src/download.rs:2063 src/download.rs:2365
202194
msgid "Finished • {size}"
203195
msgstr ""
@@ -234,12 +226,6 @@ msgstr ""
234226
msgid "Starting torrent…"
235227
msgstr ""
236228

237-
#. Resolve (with retries): the extractor cache already drops expired
238-
#. format URLs, so a cached hit is safe to download from.
239-
#: src/download.rs:2678 src/video.rs:1214
240-
msgid "Resolving video…"
241-
msgstr ""
242-
243229
#: src/download.rs:2690
244230
msgid "Download finished"
245231
msgstr ""
@@ -468,10 +454,6 @@ msgstr ""
468454
msgid "Install"
469455
msgstr ""
470456

471-
#: src/preferences.rs:392
472-
msgid "Video"
473-
msgstr ""
474-
475457
#: src/preferences.rs:396
476458
msgid "Quality"
477459
msgstr ""
@@ -480,18 +462,10 @@ msgstr ""
480462
msgid "Preferred quality"
481463
msgstr ""
482464

483-
#: src/preferences.rs:402
484-
msgid "Used for new video downloads"
485-
msgstr ""
486-
487465
#: src/preferences.rs:429 src/window.rs:1378
488466
msgid "Audio only"
489467
msgstr ""
490468

491-
#: src/preferences.rs:430
492-
msgid "New video downloads skip the video track"
493-
msgstr ""
494-
495469
#: src/preferences.rs:447
496470
msgid "Authentication"
497471
msgstr ""
@@ -512,14 +486,6 @@ msgstr ""
512486
msgid "Support tools"
513487
msgstr ""
514488

515-
#: src/preferences.rs:584
516-
msgid "yt-dlp and ffmpeg resolve video pages"
517-
msgstr ""
518-
519-
#: src/preferences.rs:587
520-
msgid "Video support tools"
521-
msgstr ""
522-
523489
#: src/preferences.rs:605
524490
msgid "Checking…"
525491
msgstr ""
@@ -588,26 +554,14 @@ msgstr ""
588554
msgid "480p"
589555
msgstr ""
590556

591-
#: src/video.rs:293
592-
msgid "Video downloads need the yt-dlp support tools"
593-
msgstr ""
594-
595557
#: src/video.rs:297
596558
msgid "Couldn't read the video page: {detail}"
597559
msgstr ""
598560

599-
#: src/video.rs:302
600-
msgid "Couldn't install the video support tools: {detail}"
601-
msgstr ""
602-
603561
#: src/video.rs:308
604562
msgid "Couldn't prepare video staging: {detail}"
605563
msgstr ""
606564

607-
#: src/video.rs:315
608-
msgid "No suitable formats found for this video"
609-
msgstr ""
610-
611565
#: src/video.rs:319
612566
msgid "Media download failed: {detail}"
613567
msgstr ""
@@ -812,18 +766,10 @@ msgstr ""
812766
msgid "File name (optional)"
813767
msgstr ""
814768

815-
#: src/window.rs:1342
816-
msgid "Looking up video…"
817-
msgstr ""
818-
819769
#: src/window.rs:1356 src/window.rs:1360
820770
msgid "Revert to Title"
821771
msgstr ""
822772

823-
#: src/window.rs:1371
824-
msgid "Video format"
825-
msgstr ""
826-
827773
#: src/window.rs:1372
828774
msgid "Best match follows your preferred quality"
829775
msgstr ""
@@ -844,10 +790,6 @@ msgstr ""
844790
msgid "Download the yt-dlp support tools"
845791
msgstr ""
846792

847-
#: src/window.rs:1397
848-
msgid "Couldn't load the video preview"
849-
msgstr ""
850-
851793
#: src/window.rs:1434
852794
msgid "Choose a .torrent file"
853795
msgstr ""
@@ -876,14 +818,6 @@ msgstr ""
876818
msgid "_Add Download"
877819
msgstr ""
878820

879-
#: src/window.rs:1952
880-
msgid "Video Details"
881-
msgstr ""
882-
883-
#: src/window.rs:2072
884-
msgid "Still looking up the video — wait for the preview, then add."
885-
msgstr ""
886-
887821
#: src/window.rs:2125
888822
msgid "_Continue"
889823
msgstr ""
@@ -955,3 +889,75 @@ msgstr ""
955889
#: src/install_help.rs:133
956890
msgid "Open"
957891
msgstr ""
892+
893+
#: src/window.rs:1343
894+
msgid "Looking up media…"
895+
msgstr ""
896+
897+
#: src/window.rs:1372
898+
msgid "Media format"
899+
msgstr ""
900+
901+
#: src/window.rs:1398
902+
msgid "Couldn't load the media preview"
903+
msgstr ""
904+
905+
#: src/window.rs:1917
906+
msgid "Media Details"
907+
msgstr ""
908+
909+
#: src/window.rs:2041
910+
msgid "Still looking up the media — wait for the preview, then add."
911+
msgstr ""
912+
913+
#: src/preferences.rs:392
914+
msgid "Media"
915+
msgstr ""
916+
917+
#: src/preferences.rs:402
918+
msgid "Used for new media downloads"
919+
msgstr ""
920+
921+
#: src/preferences.rs:430
922+
msgid "New media downloads skip the video track"
923+
msgstr ""
924+
925+
#: src/preferences.rs:482
926+
msgid "yt-dlp and ffmpeg resolve media pages"
927+
msgstr ""
928+
929+
#: src/preferences.rs:485
930+
msgid "Media support tools"
931+
msgstr ""
932+
933+
#: src/download.rs:1976
934+
msgid "That link is not a supported media page"
935+
msgstr ""
936+
937+
#: src/download.rs:1996 src/download.rs:2061
938+
msgid "Waiting to resolve audio…"
939+
msgstr ""
940+
941+
#: src/download.rs:1998 src/download.rs:2063
942+
msgid "Waiting to resolve media…"
943+
msgstr ""
944+
945+
#: src/download.rs:2715 src/video.rs:1423
946+
msgid "Resolving audio…"
947+
msgstr ""
948+
949+
#: src/download.rs:2717 src/video.rs:1425
950+
msgid "Resolving media…"
951+
msgstr ""
952+
953+
#: src/download_tests.rs:654 src/video.rs:271
954+
msgid "Media downloads need the yt-dlp support tools"
955+
msgstr ""
956+
957+
#: src/video.rs:280
958+
msgid "Couldn't install the media support tools: {detail}"
959+
msgstr ""
960+
961+
#: src/video.rs:293
962+
msgid "No suitable formats found for this media"
963+
msgstr ""

‎src/download.rs‎

Lines changed: 23 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1973,7 +1973,7 @@ impl DownloadManager {
19731973
) -> Result<DownloadItem, String> {
19741974
let url = normalize_url(page_url)?;
19751975
if !crate::video::is_video_page(&url) {
1976-
return Err(gettext("That link is not a supported video page"));
1976+
return Err(gettext("That link is not a supported media page"));
19771977
}
19781978
let dir = self.resolve_dir(dest_dir);
19791979
let name = filename
@@ -1992,7 +1992,11 @@ impl DownloadManager {
19921992
})
19931993
});
19941994
let item = DownloadItem::new(self.alloc_id(), &url, &name, &dir);
1995-
item.set_detail(gettext("Waiting to resolve video…"));
1995+
item.set_detail(if audio_only {
1996+
gettext("Waiting to resolve audio…")
1997+
} else {
1998+
gettext("Waiting to resolve media…")
1999+
});
19962000
self.video_sources.borrow_mut().insert(
19972001
item.id(),
19982002
crate::video::VideoSource::Page {
@@ -2046,7 +2050,18 @@ impl DownloadManager {
20462050
if let Some(src) = video_source {
20472051
let matches = matches!(&src, crate::video::VideoSource::Page { page_url, .. } if *page_url == url);
20482052
if matches {
2049-
item.set_detail(gettext("Waiting to resolve video…"));
2053+
let audio_only = matches!(
2054+
&src,
2055+
crate::video::VideoSource::Page {
2056+
audio_only: true,
2057+
..
2058+
}
2059+
);
2060+
item.set_detail(if audio_only {
2061+
gettext("Waiting to resolve audio…")
2062+
} else {
2063+
gettext("Waiting to resolve media…")
2064+
});
20502065
self.video_sources.borrow_mut().insert(item.id(), src);
20512066
} else {
20522067
tracing::warn!("dropping video source with mismatched page URL");
@@ -2696,7 +2711,11 @@ impl DownloadManager {
26962711
});
26972712
self.running.borrow_mut().insert(id, handle);
26982713
item.set_status(DownloadStatus::Downloading);
2699-
item.set_detail(gettext("Resolving video…"));
2714+
item.set_detail(if audio_only {
2715+
gettext("Resolving audio…")
2716+
} else {
2717+
gettext("Resolving media…")
2718+
});
27002719
self.changed();
27012720
self.pump(item, id, generation, rx);
27022721
}

‎src/download_tests.rs‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -651,7 +651,7 @@ fn enqueue_video_spawns_and_fails_without_tools() {
651651
assert_eq!(item.status(), DownloadStatus::Failed);
652652
assert_eq!(
653653
item.detail(),
654-
"Video downloads need the yt-dlp support tools"
654+
"Media downloads need the yt-dlp support tools"
655655
);
656656
// The Page marker survives the failure, so Retry replays the pipeline.
657657
assert!(matches!(

‎src/preferences.rs‎

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -389,7 +389,7 @@ pub fn show(
389389
}
390390
}
391391
let video_page = adw::PreferencesPage::builder()
392-
.title(gettext("Video"))
392+
.title(gettext("Media"))
393393
.icon_name("video-x-generic-symbolic")
394394
.build();
395395
let video_quality_group = adw::PreferencesGroup::builder()
@@ -399,7 +399,7 @@ pub fn show(
399399
let video_refs: Vec<&str> = video_labels.iter().map(String::as_str).collect();
400400
let video_quality = adw::ComboRow::builder()
401401
.title(gettext("Preferred quality"))
402-
.subtitle(gettext("Used for new video downloads"))
402+
.subtitle(gettext("Used for new media downloads"))
403403
.model(&gtk4::StringList::new(&video_refs))
404404
.build();
405405
video_quality.set_selected(crate::video::quality_index(&settings.video_quality()) as u32);
@@ -427,7 +427,7 @@ pub fn show(
427427
});
428428
let video_audio = adw::SwitchRow::builder()
429429
.title(gettext("Audio only"))
430-
.subtitle(gettext("New video downloads skip the video track"))
430+
.subtitle(gettext("New media downloads skip the video track"))
431431
.build();
432432
settings
433433
.bind(
@@ -479,10 +479,10 @@ pub fn show(
479479
});
480480
let video_tools_group = adw::PreferencesGroup::builder()
481481
.title(gettext("Support tools"))
482-
.description(gettext("yt-dlp and ffmpeg resolve video pages"))
482+
.description(gettext("yt-dlp and ffmpeg resolve media pages"))
483483
.build();
484484
let video_tools_row = adw::ActionRow::builder()
485-
.title(gettext("Video support tools"))
485+
.title(gettext("Media support tools"))
486486
.build();
487487
let video_tools_btn = gtk4::Button::builder().valign(gtk4::Align::Center).build();
488488
video_tools_row.set_activatable_widget(Some(&video_tools_btn));

‎src/video.rs‎

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -268,7 +268,7 @@ pub enum VideoError {
268268

269269
impl VideoError {
270270
fn missing_tools() -> Self {
271-
Self::MissingLibraries(gettext("Video downloads need the yt-dlp support tools"))
271+
Self::MissingLibraries(gettext("Media downloads need the yt-dlp support tools"))
272272
}
273273
fn fetch(e: impl std::fmt::Display) -> Self {
274274
Self::Fetch(
@@ -277,7 +277,7 @@ impl VideoError {
277277
}
278278
fn install(e: impl std::fmt::Display) -> Self {
279279
Self::Message(
280-
gettext("Couldn't install the video support tools: {detail}")
280+
gettext("Couldn't install the media support tools: {detail}")
281281
.replace("{detail}", &e.to_string()),
282282
)
283283
}
@@ -290,7 +290,7 @@ impl VideoError {
290290
Self::Runtime(e.to_string())
291291
}
292292
fn unavailable() -> Self {
293-
Self::Message(gettext("No suitable formats found for this video"))
293+
Self::Message(gettext("No suitable formats found for this media"))
294294
}
295295
fn part_failed(e: impl std::fmt::Display) -> Self {
296296
Self::Message(
@@ -1419,7 +1419,11 @@ pub async fn run_video_download(
14191419

14201420
// Resolve (with retries, always fresh: without a cache backend every
14211421
// attempt re-extracts, so expired format URLs never survive a retry).
1422-
phase(gettext("Resolving video…"));
1422+
phase(if job.audio_only {
1423+
gettext("Resolving audio…")
1424+
} else {
1425+
gettext("Resolving media…")
1426+
});
14231427
let mut video: Option<Video> = None;
14241428
for attempt in 0..job.tries.max(1) {
14251429
match fetch_video_page(
@@ -1677,7 +1681,11 @@ pub async fn run_video_download(
16771681
)
16781682
.await?;
16791683
}
1680-
phase(gettext("Merging…"));
1684+
// Only merged video shows a merge phase: audio-only rows adopt
1685+
// the part directly, so announcing a merge would be wrong.
1686+
if vpart.is_some() {
1687+
phase(gettext("Merging…"));
1688+
}
16811689
finish_merge(
16821690
&downloader,
16831691
&staging,

0 commit comments

Comments
 (0)