about summary refs log tree commit diff stats
path: root/src/main.rs
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/main.rs21
1 files changed, 21 insertions, 0 deletions
diff --git a/src/main.rs b/src/main.rs
index 7febefc..304b99f 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -23,6 +23,7 @@ use storage::video_database::getters::get_video_by_hash;
 use tokio::{
     fs::File,
     io::{stdin, BufReader},
+    task::JoinHandle,
 };
 use url::Url;
 use yt_dlp::wrapper::info_json::InfoJson;
@@ -106,6 +107,26 @@ async fn main() -> Result<()> {
                 _ => handle_select_cmd(&app, cmd, None).await?,
             }
         }
+        Command::SeDoWa {} => {
+            select::select(&app, false, false).await?;
+
+            let max_cache_size = app.config.download.max_cache_size;
+            info!("Max cache size: '{}'", max_cache_size);
+
+            let arc_app = Arc::new(app);
+
+            let arc_app_clone = Arc::clone(&arc_app);
+            let download: JoinHandle<Result<()>> = tokio::spawn(async move {
+                download::Downloader::new()
+                    .consume(arc_app_clone, max_cache_size.as_u64())
+                    .await?;
+
+                Ok(())
+            });
+
+            watch::watch(&arc_app).await?;
+            download.await??;
+        }
         Command::Videos { cmd } => match cmd {
             VideosCommand::List {
                 search_query,