diff options
author | makefu <github@syntax-fehler.de> | 2023-03-08 19:27:59 +0100 |
---|---|---|
committer | makefu <github@syntax-fehler.de> | 2023-03-08 19:27:59 +0100 |
commit | caa8f83e79f7373bf234874b8614117c3f7a0710 (patch) | |
tree | 9167f06d093d44a662536aa4b5e3d32c271ccca0 /tv/2configs/urlwatch.nix | |
parent | 8b4c488bff6b61e2e3ed7c75d96b161a66f5a8c4 (diff) | |
parent | 2168f3961298b661fd010add7972a86af77f81de (diff) |
Merge remote-tracking branch 'lass/master'
Diffstat (limited to 'tv/2configs/urlwatch.nix')
-rw-r--r-- | tv/2configs/urlwatch.nix | 26 |
1 files changed, 19 insertions, 7 deletions
diff --git a/tv/2configs/urlwatch.nix b/tv/2configs/urlwatch.nix index 7ba364ff3..f5260ee05 100644 --- a/tv/2configs/urlwatch.nix +++ b/tv/2configs/urlwatch.nix @@ -2,12 +2,16 @@ with import ./lib; { config, pkgs, ... }: let exec = filename: args: url: { inherit url; - filter = "system:${ - concatMapStringsSep " " shell.escape ([filename] ++ toList args) - }"; + filter = singleton { + system = + concatMapStringsSep " " shell.escape ([filename] ++ toList args); + }; }; json = json' ["."]; json' = exec "${pkgs.jq}/bin/jq"; + urigrep' = exec (pkgs.writeDash "urigrep" '' + ${pkgs.urix}/bin/urix | ${pkgs.gnugrep}/bin/grep -E "$1" + ''); xml = xml' ["--format" "-"]; xml' = exec "${pkgs.libxml2}/bin/xmllint"; in { @@ -68,22 +72,30 @@ in { https://raw.githubusercontent.com/NixOS/nixpkgs/master/nixos/modules/services/x11/xserver.nix https://www.rabbitmq.com/changelog.html + + (urigrep' ["software-resources"] https://semiconductor.samsung.com/consumer-storage/support/tools/) ]; hooksFile = toFile "hooks.py" '' import subprocess import urlwatch - class CaseFilter(urlwatch.filters.FilterBase): + class SystemFilter(urlwatch.filters.FilterBase): """Filter for piping data through an external process""" __kind__ = 'system' + __supported_subfilters__ = { + 'command': 'shell command line to tranform data', + } + + __default_subfilter__ = 'command' + def filter(self, data, subfilter=None): - if subfilter is None: - raise ValueError('The system filter needs a command') + if 'command' not in subfilter: + raise ValueError('{} filter needs a command'.format(self.__kind__)) proc = subprocess.Popen( - subfilter, + subfilter['command'], shell=True, stdin=subprocess.PIPE, stdout=subprocess.PIPE, |