about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorBenedikt Peetz <benedikt.peetz@b-peetz.de>2025-07-15 07:14:49 +0200
committerBenedikt Peetz <benedikt.peetz@b-peetz.de>2025-07-15 07:14:49 +0200
commitf09ad6c85f8d4f3de73de895f370b5773b63177a (patch)
tree1a34ad4b243dc43511e7c4fc87727d48eb54ee15
parentfeat(crates/yt/watch): Make the time between watch progress saves configurable (diff)
downloadyt-f09ad6c85f8d4f3de73de895f370b5773b63177a.zip
fix(crates/yt): Add stuff that was missed
-rw-r--r--crates/yt/src/cli.rs16
-rw-r--r--crates/yt/src/main.rs19
2 files changed, 34 insertions, 1 deletions
diff --git a/crates/yt/src/cli.rs b/crates/yt/src/cli.rs
index 3e59c55..f12b58d 100644
--- a/crates/yt/src/cli.rs
+++ b/crates/yt/src/cli.rs
@@ -280,6 +280,22 @@ pub(crate) struct SharedSelectionCommandArgs {
 
     pub(crate) url: Option<Url>,
 }
+
+impl SelectCommand {
+    pub(crate) fn into_shared(self) -> Option<SharedSelectionCommandArgs> {
+        match self {
+            SelectCommand::File { .. }
+            | SelectCommand::Split { .. }
+            | SelectCommand::Add { .. } => None,
+            SelectCommand::Watch { shared }
+            | SelectCommand::Drop { shared }
+            | SelectCommand::Watched { shared }
+            | SelectCommand::Url { shared }
+            | SelectCommand::Pick { shared } => Some(shared),
+        }
+    }
+}
+
 #[derive(Clone, Debug, Copy)]
 pub(crate) struct OptionalNaiveDate {
     pub(crate) date: Option<NaiveDate>,
diff --git a/crates/yt/src/main.rs b/crates/yt/src/main.rs
index 0926ac7..2331dd7 100644
--- a/crates/yt/src/main.rs
+++ b/crates/yt/src/main.rs
@@ -131,7 +131,24 @@ async fn main() -> Result<()> {
                     sort_key,
                     sort_mode,
                 } => Box::pin(select::select_split(&app, done, sort_key, sort_mode)).await?,
-                _ => Box::pin(handle_select_cmd(&app, cmd, None)).await?,
+                SelectCommand::Add { urls, start, stop } => {
+                    Box::pin(select::cmds::add::add(&app, urls, start, stop)).await?;
+                }
+                other => {
+                    let shared = other
+                        .clone()
+                        .into_shared()
+                        .expect("The ones without shared should have been filtered out.");
+                    let hash = shared.hash.realize(&app).await?;
+                    let mut video = hash
+                        .get_with_app(&app)
+                        .await
+                        .expect("The hash was already realized, it should therefore exist");
+
+                    let mut ops = Operations::new("Main: handle select cmd");
+                    handle_select_cmd(&app, other, &mut video, None, &mut ops).await?;
+                    ops.commit(&app).await?;
+                }
             }
         }
         Command::Sedowa {} => {