diff options
author | Benedikt Peetz <benedikt.peetz@b-peetz.de> | 2024-08-21 13:48:37 +0200 |
---|---|---|
committer | Benedikt Peetz <benedikt.peetz@b-peetz.de> | 2024-08-21 14:47:38 +0200 |
commit | 27a007ad021c4b8d62b857a6e312a608d33b6cb0 (patch) | |
tree | 518b3aec291c732d6c0b7d4b6fbfe750d97bc4c0 | |
parent | fix(update): Use the `raw_update.py` from the path (diff) | |
download | yt-27a007ad021c4b8d62b857a6e312a608d33b6cb0.tar.gz yt-27a007ad021c4b8d62b857a6e312a608d33b6cb0.zip |
fix(select/duration): Also parse `[No Duration]` as duration
Diffstat (limited to '')
-rw-r--r-- | src/select/selection_file/duration.rs | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/src/select/selection_file/duration.rs b/src/select/selection_file/duration.rs index 4224ead..f7a39cb 100644 --- a/src/select/selection_file/duration.rs +++ b/src/select/selection_file/duration.rs @@ -28,6 +28,10 @@ impl FromStr for Duration { .context("Failed to parse hours") } + if s == "[No Duration]" { + return Ok(Self { time: 0 }); + } + let buf: Vec<_> = s.split(' ').collect(); let hours; @@ -45,7 +49,10 @@ impl FromStr for Duration { minutes = parse_num(buf[0], 'm')?; seconds = parse_num(buf[1], 's')?; } else { - unreachable!("The first part always ends with 'h' or 'm'") + unreachable!( + "The first part always ends with 'h' or 'm', but was: {:#?}", + buf + ) } Ok(Self { |