update description

This commit is contained in:
Max Hohlfeld 2023-01-03 20:39:03 +01:00
parent 1db0031f4c
commit 425ff11b5b
4 changed files with 40 additions and 4 deletions

22
Cargo.lock generated
View File

@ -631,6 +631,15 @@ dependencies = [
"libc", "libc",
] ]
[[package]]
name = "num_threads"
version = "0.1.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2819ce041d2ee131036f4fc9d6ae7ae125a3a40e97ba64d04fe799ad9dabbb44"
dependencies = [
"libc",
]
[[package]] [[package]]
name = "once_cell" name = "once_cell"
version = "1.16.0" version = "1.16.0"
@ -946,8 +955,12 @@ version = "0.3.17"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a561bf4617eebd33bca6434b988f39ed798e527f51a1e797d0ee4f61c0a38376" checksum = "a561bf4617eebd33bca6434b988f39ed798e527f51a1e797d0ee4f61c0a38376"
dependencies = [ dependencies = [
"itoa",
"libc",
"num_threads",
"serde", "serde",
"time-core", "time-core",
"time-macros",
] ]
[[package]] [[package]]
@ -956,6 +969,15 @@ version = "0.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2e153e1f1acaef8acc537e68b44906d2db6436e2b35ac2c6b42640fff91f00fd" checksum = "2e153e1f1acaef8acc537e68b44906d2db6436e2b35ac2c6b42640fff91f00fd"
[[package]]
name = "time-macros"
version = "0.2.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d967f99f534ca7e495c575c62638eebc2898a8c84c119b89e250477bc4ba16b2"
dependencies = [
"time-core",
]
[[package]] [[package]]
name = "tinyvec" name = "tinyvec"
version = "1.6.0" version = "1.6.0"

View File

@ -8,6 +8,6 @@ edition = "2021"
[dependencies] [dependencies]
reqwest = { version = "0.11.13", features = ["blocking"] } reqwest = { version = "0.11.13", features = ["blocking"] }
rss = "2" rss = "2"
time = "0.3" time = { version = "0.3", features = ["local-offset", "formatting", "macros"]}
clokwerk = "0.4" clokwerk = "0.4"
pico-args = "0.5" pico-args = "0.5"

14
lfs_scraper.service Normal file
View File

@ -0,0 +1,14 @@
[Unit]
Description=LFS Scraper
After=network.target
StartLimitIntervalSec=0
[Service]
Type=simple
Restart=always
RestartSec=1
User=git
ExecStart=/usr/local/bin/lfs_scraper --url https://www.lfs.sachsen.de/restplatzboerse-5152.html --rss-file /var/www/tfld/ffw.rss
[Install]
WantedBy=multi-user.target

View File

@ -43,7 +43,7 @@ fn main() {
let mut scheduler = Scheduler::new(); let mut scheduler = Scheduler::new();
scheduler scheduler
.every(1.minutes()) .every(30.minutes())
.run(move || match get_current_places(&args.url) { .run(move || match get_current_places(&args.url) {
Ok(places) => { Ok(places) => {
if should_feed_be_updated(&places, &last_places) { if should_feed_be_updated(&places, &last_places) {
@ -105,12 +105,12 @@ fn update_rss_file(places: Vec<RemainingPlace>, url: &str, rss_file: &str) {
.language(Some("de-DE".to_string())) .language(Some("de-DE".to_string()))
.build(); .build();
let title = format!("Restplatzbörse Update - {}", OffsetDateTime::now_utc()); let title = format!("Restplatzbörse Update - {}", OffsetDateTime::now_local().unwrap().format(time::macros::format_description!("[year]-[month]-[day] [hour]:[minute]")).unwrap());
let content = places let content = places
.iter() .iter()
.map(|place| { .map(|place| {
format!( format!(
"{} - {} - {} - {}", "{} - {} - {} - {} Plätze</br>",
place.id, place.description, place.date, place.free place.id, place.description, place.date, place.free
) )
}) })