about summary refs log tree commit diff stats
path: root/src/main.rs
diff options
context:
space:
mode:
authorBenedikt Peetz <benedikt.peetz@b-peetz.de>2024-08-23 18:20:26 +0200
committerBenedikt Peetz <benedikt.peetz@b-peetz.de>2024-08-23 18:20:26 +0200
commitd5c2fcc184f764f9d4bb5846a1182c6014316bdc (patch)
treef4c3241b4a8b64aa30de39a7c057bf1ec9b99dbe /src/main.rs
parentfix(config/from_filesystem): Only create the parent of config paths (diff)
downloadyt-d5c2fcc184f764f9d4bb5846a1182c6014316bdc.tar.gz
yt-d5c2fcc184f764f9d4bb5846a1182c6014316bdc.zip
feat(videos): Init
Diffstat (limited to '')
-rw-r--r--src/main.rs16
1 files changed, 15 insertions, 1 deletions
diff --git a/src/main.rs b/src/main.rs
index 94c0f71..28a0b38 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -14,10 +14,11 @@ use anyhow::{bail, Context, Result};
 use app::App;
 use cache::invalidate;
 use clap::Parser;
-use cli::{CacheCommand, CheckCommand, SelectCommand, SubscriptionCommand};
+use cli::{CacheCommand, CheckCommand, SelectCommand, SubscriptionCommand, VideosCommand};
 use config::Config;
 use log::info;
 use select::cmds::handle_select_cmd;
+use storage::video_database::getters::get_video_by_hash;
 use tokio::{
     fs::File,
     io::{stdin, BufReader},
@@ -40,6 +41,7 @@ pub mod status;
 pub mod storage;
 pub mod subscribe;
 pub mod update;
+pub mod videos;
 pub mod watch;
 
 #[tokio::main]
@@ -99,6 +101,18 @@ async fn main() -> Result<()> {
                 _ => handle_select_cmd(&app, cmd, None).await?,
             }
         }
+        Command::Videos { cmd } => match cmd {
+            VideosCommand::List { search_query } => {
+                videos::query(&app, search_query)
+                    .await
+                    .context("Failed to query videos")?;
+            }
+            VideosCommand::Info { hash } => {
+                let video = get_video_by_hash(&app, &hash.realize(&app).await?).await?;
+                dbg!(video);
+            }
+        },
+
         Command::Update {
             max_backlog,
             subscriptions,