aboutsummaryrefslogtreecommitdiffstats
path: root/src/update
diff options
context:
space:
mode:
Diffstat (limited to 'src/update')
-rw-r--r--src/update/mod.rs19
1 files changed, 16 insertions, 3 deletions
diff --git a/src/update/mod.rs b/src/update/mod.rs
index ce3a7f9..6abb8c4 100644
--- a/src/update/mod.rs
+++ b/src/update/mod.rs
@@ -29,6 +29,7 @@ use crate::{
VideoStatus,
},
},
+ videos::display::format_video::FormatVideo,
};
pub async fn update(
@@ -103,7 +104,9 @@ pub async fn update(
for (url, value) in output_json {
let sub = back_subs.get(&url).expect("This was stored before");
- process_subscription(app, sub, value, &hashes).await?
+ process_subscription(app, sub, value, &hashes)
+ .await
+ .with_context(|| format!("Failed to process subscription: '{}'", sub.name))?
}
}
@@ -237,8 +240,18 @@ async fn process_subscription(
// We already stored the video information
unreachable!("The python update script should have never provided us a duplicated video");
} else {
- println!("{}", video.to_color_display(app).await?);
- add_video(app, video).await?;
+ add_video(app, video.clone())
+ .await
+ .with_context(|| format!("Failed to add video to database: '{}'", video.title))?;
+ println!(
+ "{}",
+ (&video
+ .to_formatted_video(app)
+ .await
+ .with_context(|| format!("Failed to format video: '{}'", video.title))?
+ .colorize())
+ .to_line_display()
+ );
Ok(())
}
}