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