summaryrefslogtreecommitdiffstats
path: root/makefu/2configs/bureautomation/comic-updater.nix
diff options
context:
space:
mode:
authorlassulus <lassulus@lassul.us>2020-08-19 21:16:14 +0200
committerlassulus <lassulus@lassul.us>2020-08-19 21:16:14 +0200
commit6538131f91ce9dbedc8efaa6c1d6196ad5b0f3d6 (patch)
tree3ec0ff96e88b2d212e8e3c9566b66b23154fc03d /makefu/2configs/bureautomation/comic-updater.nix
parent03939b14e1d5820bee8c43d63b34c6e3e0e5eac4 (diff)
parent1d78ac0d6a78048903cc159b82ec6b405b7e16ab (diff)
Merge remote-tracking branch 'gum/master'
Diffstat (limited to 'makefu/2configs/bureautomation/comic-updater.nix')
-rw-r--r--makefu/2configs/bureautomation/comic-updater.nix12
1 files changed, 10 insertions, 2 deletions
diff --git a/makefu/2configs/bureautomation/comic-updater.nix b/makefu/2configs/bureautomation/comic-updater.nix
index 5f26bc2c..1e244093 100644
--- a/makefu/2configs/bureautomation/comic-updater.nix
+++ b/makefu/2configs/bureautomation/comic-updater.nix
@@ -6,21 +6,29 @@ let
in {
systemd.services.comic-updater = {
startAt = "daily";
- description = "Send led change to message queue";
+ description = "update our comics";
after = [ "network-online.target" ] ++ (lib.optional config.services.mosquitto.enable "mosquitto.service");
path = with pkgs; [ wget xmlstarlet ];
wantedBy = [ "multi-user.target" ];
serviceConfig = {
User = "hass";
WorkingDirectory = config.services.home-assistant.configDir;
- ExecStart = pkgs.writeDash "update-poorly-drawn-lines" ''
+ ExecStart = pkgs.writeDash "update-comics" ''
set -euf
mkdir -p www/
cd www/
+ # poorly drawn lines
pic=$(wget -O- http://www.poorlydrawnlines.com/feed/ \
| xml sel -t -v '/rss/channel/item/content:encoded' \
| head -n 2 | sed -n 's/.*src="\([^"]\+\)".*/\1/p' )
wget "$pic" -nc && cp -v "$(basename "$pic")" lines.png
+
+ #pic=$(curl -L xkcd.com 2>/dev/null | grep imgs.xkcd.com | grep title | sed -n 's/.*src="\([^"]\+\)" .*/https:\1/p')
+ # xkcd
+ pic=$(wget -O- https://xkcd.com/rss.xml \
+ | xml sel -t -v '/rss/channel/item/description' \
+ | head -n 1 | sed -n 's/.*src="\([^"]\+\)".*/\1/p' )
+ wget "$pic" -nc && cp -v "$(basename "$pic")" xkcd.png
'';
PrivateTmp = true;
};