From e311576f5090c27e5ac35ced63da0d91f00fd812 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?O=CC=81scar=20M=2E=20Lage?= Date: Fri, 18 Nov 2022 19:59:28 +0100 Subject: [PATCH] Fix: minor fixes --- src/main.rs | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/main.rs b/src/main.rs index 1e717a7..aa39a7e 100644 --- a/src/main.rs +++ b/src/main.rs @@ -11,6 +11,8 @@ struct Config { url: String, author: String, path: String, + version: String, + description: String, } #[derive(Debug)] @@ -24,10 +26,9 @@ struct Toot { } fn download_media(url: String, path: String) { - print!("Downloading media images: {:?}", url); + println!(" - Downloading media images: {:?}", url); let mut file = reqwest::blocking::get(url.clone()).unwrap(); let filename = Path::new(&url).file_name().unwrap().to_str().unwrap(); - println!("file: {:?}", file); let mut out = File::create(format!("{}/{}", path, filename)).unwrap(); copy(&mut file, &mut out).expect("Error copying file"); } @@ -44,7 +45,10 @@ fn main() { url: "https://mastodon.bofhers.es/tags/micropost.rss".to_string(), author: "oscarmlage".to_string(), path: "temp/".to_string(), + version: "0.0.1".to_string(), + description: "Just another tool to convert RSS from Mastodon to Markdown".to_string(), }; + println!("\n✨ masto-rss v.{} - {}\n", config.version, config.description); let rss = reqwest::blocking::get(config.url).unwrap().bytes(); let rss2 = rss.unwrap(); let channel = Channel::read_from(&rss2[..]).unwrap(); @@ -54,7 +58,7 @@ fn main() { let dt = item.pub_date.as_ref().unwrap(); let datetime = chrono::DateTime::parse_from_rfc2822(dt.as_str()).unwrap(); let title = datetime.format("%Y%m%d-%H%M").to_string(); - println!("{:?}", title); + println!("➡️ {:?}", title); let mut toot = Toot{ title: title.to_string(), date: datetime.to_string(),