1
0
mirror of https://github.com/kmein/niveum synced 2026-03-16 10:11:08 +01:00
This commit is contained in:
2021-10-07 00:29:50 +02:00
parent 9678ba7b28
commit 2691608f8c
2 changed files with 28 additions and 0 deletions

View File

@@ -217,6 +217,7 @@ in {
./i3.nix
./keybase.nix
./keyboard.nix
./lb.nix
./mail/client.nix
./mpv.nix
./mime.nix

27
configs/lb.nix Normal file
View File

@@ -0,0 +1,27 @@
{ lib, pkgs, ... }:
let
nixpkgs-unstable = import <nixpkgs-unstable> {};
in
{
systemd.services.lb-subscription = {
enable = true;
wants = [ "network-online.target" ];
startAt = "weekly";
serviceConfig = {
user = "kfm";
WorkingDirectory = "/home/kfm/cloud/Seafile/Books/Germanistik/LB";
};
script = ''
first_year=2019
for year in $(${pkgs.coreutils}/bin/seq "$first_year" "$(date +%Y)"); do
${pkgs.curl}/bin/curl -sSL "https://www.literarische-blaetter.de/jahrgang-$year/" \
| ${nixpkgs-unstable.htmlq}/bin/htmlq --attribute href 'ul.slides a' \
| while read -r month; do
${pkgs.curl}/bin/curl -sSL "$month" \
| ${nixpkgs-unstable.htmlq}/bin/htmlq --attribute src iframe \
| ${pkgs.gnused}/bin/sed 's/.*?pdf=//;s/?wp-hosted.*//'
done
done | ${pkgs.findutils}/bin/xargs ${pkgs.wget}/bin/wget --no-clobber
'';
};
}