From 3693f8f2b860b0742c6afe3817a3185ebaf8873b Mon Sep 17 00:00:00 2001 From: tv Date: Thu, 2 Feb 2023 15:24:04 +0100 Subject: tv urlwatch exec: use dict-based filter list Because string-based filter definitions are deprecated since 2.19 Refs https://urlwatch.readthedocs.io/en/latest/deprecated.html --- tv/2configs/urlwatch.nix | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) (limited to 'tv/2configs/urlwatch.nix') diff --git a/tv/2configs/urlwatch.nix b/tv/2configs/urlwatch.nix index 7ba364f..e2cd199 100644 --- a/tv/2configs/urlwatch.nix +++ b/tv/2configs/urlwatch.nix @@ -2,9 +2,10 @@ 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"; @@ -73,17 +74,23 @@ in { 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, -- cgit v1.2.3 From e5d334ea76fc3d4c680ed900299e5c07247cd498 Mon Sep 17 00:00:00 2001 From: tv Date: Thu, 2 Feb 2023 14:28:13 +0100 Subject: tv urlwatch: add samsung consumer-storage tools --- tv/2configs/urlwatch.nix | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'tv/2configs/urlwatch.nix') diff --git a/tv/2configs/urlwatch.nix b/tv/2configs/urlwatch.nix index e2cd199..f5260ee 100644 --- a/tv/2configs/urlwatch.nix +++ b/tv/2configs/urlwatch.nix @@ -9,6 +9,9 @@ with import ./lib; }; 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 { @@ -69,6 +72,8 @@ 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 -- cgit v1.2.3