From f09ad6c85f8d4f3de73de895f370b5773b63177a Mon Sep 17 00:00:00 2001 From: Benedikt Peetz Date: Tue, 15 Jul 2025 07:14:49 +0200 Subject: fix(crates/yt): Add stuff that was missed --- crates/yt/src/cli.rs | 16 ++++++++++++++++ crates/yt/src/main.rs | 19 ++++++++++++++++++- 2 files changed, 34 insertions(+), 1 deletion(-) 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, } + +impl SelectCommand { + pub(crate) fn into_shared(self) -> Option { + 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, 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 {} => { -- cgit 1.4.1