let's do it like this instead
This commit is contained in:
parent
068ef70e7e
commit
994863aed8
2 changed files with 12 additions and 10 deletions
|
@ -92,7 +92,7 @@ async fn main() -> anyhow::Result<()> {
|
||||||
&node_clone.url,
|
&node_clone.url,
|
||||||
&node_clone.origin,
|
&node_clone.origin,
|
||||||
&id_clone,
|
&id_clone,
|
||||||
date_path.clone().join(&id_clone),
|
date_path.clone(),
|
||||||
config.webp_quality,
|
config.webp_quality,
|
||||||
)
|
)
|
||||||
.instrument(span)
|
.instrument(span)
|
||||||
|
|
|
@ -84,6 +84,8 @@ pub async fn take_one_screenshot(
|
||||||
.in_current_span(),
|
.in_current_span(),
|
||||||
);
|
);
|
||||||
|
|
||||||
|
let node_name_clone = node_name.clone();
|
||||||
|
|
||||||
// main handler
|
// main handler
|
||||||
let write_guac_handler_clone = write_tx.clone();
|
let write_guac_handler_clone = write_tx.clone();
|
||||||
let guac_handler: JoinHandle<anyhow::Result<()>> = tokio::spawn(
|
let guac_handler: JoinHandle<anyhow::Result<()>> = tokio::spawn(
|
||||||
|
@ -114,14 +116,14 @@ pub async fn take_one_screenshot(
|
||||||
let zone = tzfile::Tz::named("GMT")?;
|
let zone = tzfile::Tz::named("GMT")?;
|
||||||
let now = { chrono::Utc::now().with_timezone(&&zone) };
|
let now = { chrono::Utc::now().with_timezone(&&zone) };
|
||||||
|
|
||||||
let file_path = root_path.join(format!(
|
let file_path =
|
||||||
|
root_path.join(&node_name_clone).join(format!(
|
||||||
"{:02}-{:02}-{:02}.webp",
|
"{:02}-{:02}-{:02}.webp",
|
||||||
now.hour(),
|
now.hour(),
|
||||||
now.minute(),
|
now.minute(),
|
||||||
now.second()
|
now.second()
|
||||||
));
|
));
|
||||||
|
|
||||||
|
|
||||||
let file_path_clone = file_path.clone();
|
let file_path_clone = file_path.clone();
|
||||||
|
|
||||||
let _: anyhow::Result<()> =
|
let _: anyhow::Result<()> =
|
||||||
|
@ -149,8 +151,8 @@ pub async fn take_one_screenshot(
|
||||||
let encoder = webp::Encoder::from_image(&image)
|
let encoder = webp::Encoder::from_image(&image)
|
||||||
.expect("fuck you");
|
.expect("fuck you");
|
||||||
|
|
||||||
if !file_path_clone.exists() {
|
if !root_path.exists() {
|
||||||
std::fs::create_dir_all(&file_path_clone)?;
|
std::fs::create_dir_all(&root_path)?;
|
||||||
}
|
}
|
||||||
|
|
||||||
let mut file =
|
let mut file =
|
||||||
|
|
Loading…
Reference in a new issue