From 57bc69a7f9af497526695e5a0bfbc60939f667e9 Mon Sep 17 00:00:00 2001 From: A Farzat Date: Thu, 12 Feb 2026 14:23:43 +0300 Subject: Add the ability to fetch book info --- src/main.rs | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'src/main.rs') diff --git a/src/main.rs b/src/main.rs index f79f191..d393a55 100644 --- a/src/main.rs +++ b/src/main.rs @@ -10,8 +10,7 @@ use cli::Args; use cookies::CookieStore; use display::Display; use http_client::HttpClient; -use orly::check_login; -use reqwest::Client; +use orly::{check_login, fetch_book_info}; #[tokio::main] async fn main() { @@ -60,6 +59,14 @@ async fn main() { Err(e) => ui.error_and_exit(&format!("Login check failed: {e}")), }; + // Retrieve book info. + ui.info("Retrieving book info..."); + let bookinfo = match fetch_book_info(&client, &args.bookid).await { + Ok(info) => info, + Err(e) => ui.error_and_exit(&format!("Failed to fetch book info: {}", e)), + }; + ui.info(&format!("{:#?}", bookinfo)); + let output_dir = config::books_root().join(format!("(pending) ({})", args.bookid)); ui.set_output_dir(output_dir); -- cgit v1.2.3-70-g09d2