mirror of
https://github.com/FliegendeWurst/raspi-oled.git
synced 2024-11-25 19:54:57 +00:00
Compare commits
2 Commits
1a5272b7ba
...
5cac88580d
Author | SHA1 | Date | |
---|---|---|---|
|
5cac88580d | ||
|
1a36ba5c1d |
@ -1,6 +1,6 @@
|
||||
with (import <nixpkgs> {});
|
||||
mkShell {
|
||||
nativeBuildInputs = [
|
||||
buildInputs = [
|
||||
pkgsCross.muslpi.stdenv.cc
|
||||
pkgsCross.muslpi.sqlite
|
||||
];
|
||||
|
@ -1,8 +1,9 @@
|
||||
use std::{error::Error, fs};
|
||||
use std::{env, error::Error, fs};
|
||||
|
||||
static WEEKLY: &'static str = include_str!("../../events_weekly.json");
|
||||
|
||||
fn main() {
|
||||
let args = env::args().skip(1).collect::<Vec<_>>();
|
||||
let url = "http://nixos.fritz.box:12783/custom/event_alerts";
|
||||
|
||||
if let Ok(json) = get_json(url) {
|
||||
@ -11,7 +12,11 @@ fn main() {
|
||||
buf += "\"events\": ";
|
||||
buf += &json;
|
||||
buf += ",";
|
||||
buf += WEEKLY;
|
||||
if args.len() >= 1 && args[0] == "--no-weekly" {
|
||||
buf += r#""weekly": []"#;
|
||||
} else {
|
||||
buf += WEEKLY;
|
||||
}
|
||||
buf += "}";
|
||||
fs::write("events.json", buf.as_bytes()).unwrap();
|
||||
}
|
||||
@ -19,4 +24,4 @@ fn main() {
|
||||
|
||||
fn get_json(url: &str) -> Result<String, Box<dyn Error>> {
|
||||
Ok(ureq::get(url).call()?.into_string()?)
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user