summaryrefslogtreecommitdiffstats
path: root/krebs
diff options
context:
space:
mode:
authormakefu <github@syntax-fehler.de>2018-07-20 16:27:19 +0200
committermakefu <github@syntax-fehler.de>2018-07-20 16:27:19 +0200
commit6c15e8fe7b9870206d681b37e059650d96c7a26e (patch)
treee2df54b71d345f86e03ac61b8806403e8f18bf50 /krebs
parente00a76d30e4514cb5164fb658552fc1589e749e4 (diff)
parent4a74ef353ad5f66d4dfc3b3d51c3090bfbeac2e7 (diff)
Merge branch 'master' of prism:stockholm
Diffstat (limited to 'krebs')
-rw-r--r--krebs/2configs/reaktor-krebs.nix3
-rw-r--r--krebs/2configs/reaktor-retiolum.nix3
-rw-r--r--krebs/5pkgs/simple/Reaktor/plugins.nix50
-rw-r--r--krebs/5pkgs/simple/krops.nix4
-rw-r--r--krebs/krops.nix2
5 files changed, 49 insertions, 13 deletions
diff --git a/krebs/2configs/reaktor-krebs.nix b/krebs/2configs/reaktor-krebs.nix
index fa51b84f..2e63f138 100644
--- a/krebs/2configs/reaktor-krebs.nix
+++ b/krebs/2configs/reaktor-krebs.nix
@@ -13,6 +13,9 @@ with import <stockholm/lib>;
};
plugins = with pkgs.ReaktorPlugins; [
sed-plugin
+ task-add
+ task-delete
+ task-list
] ++
(attrValues (todo "agenda"))
;
diff --git a/krebs/2configs/reaktor-retiolum.nix b/krebs/2configs/reaktor-retiolum.nix
index b32d39b7..d5f1851e 100644
--- a/krebs/2configs/reaktor-retiolum.nix
+++ b/krebs/2configs/reaktor-retiolum.nix
@@ -10,6 +10,9 @@ with import <stockholm/lib>;
};
plugins = with pkgs.ReaktorPlugins; [
sed-plugin
+ task-add
+ task-delete
+ task-list
] ++
(attrValues (todo "agenda"))
;
diff --git a/krebs/5pkgs/simple/Reaktor/plugins.nix b/krebs/5pkgs/simple/Reaktor/plugins.nix
index 2df76fb2..db578c45 100644
--- a/krebs/5pkgs/simple/Reaktor/plugins.nix
+++ b/krebs/5pkgs/simple/Reaktor/plugins.nix
@@ -121,26 +121,56 @@ rec {
pattern = "^.*(?P<args>http[s]?://(?:[a-zA-Z]|[0-9]|[$-_@.&+]|[!*\(\),]|(?:%[0-9a-fA-F][0-9a-fA-F]))+).*$$";
path = with pkgs; [ curl perl ];
script = pkgs.writePython3 "url-title" [ "beautifulsoup4" "lxml" ] ''
+ import cgi
import sys
import urllib.request
from bs4 import BeautifulSoup
try:
- soup = BeautifulSoup(urllib.request.urlopen(sys.argv[1]), "lxml")
- title = soup.find('title').string
-
- if title:
- if len(title) > 512:
- print('message to long, skipped')
- elif len(title.split('\n')) > 5:
- print('to many lines, skipped')
- else:
- print(title)
+ req = urllib.request.Request(sys.argv[1])
+ req.add_header('user-agent', 'Reaktor-url-title')
+ resp = urllib.request.urlopen(req)
+ if resp.headers['content-type'].find('text/html') >= 0:
+ soup = BeautifulSoup(resp.read(16000), "lxml")
+ title = soup.find('title').string
+
+ if len(title.split('\n')) > 5:
+ title = '\n'.join(title.split('\n')[:5])
+
+ print(title[:450])
+ else:
+ cd_header = resp.headers['content-disposition']
+ print(cgi.parse_header(cd_header)[1]['filename'])
except: # noqa: E722
pass
'';
});
+ taskrcFile = builtins.toFile "taskrc" ''
+ confirmation=no
+ '';
+
+ task-add = buildSimpleReaktorPlugin "task-add" {
+ pattern = "^task-add: (?P<args>.*)$$";
+ script = pkgs.writeDash "task-add" ''
+ ${pkgs.taskwarrior}/bin/task rc:${taskrcFile} add "$*"
+ '';
+ };
+
+ task-list = buildSimpleReaktorPlugin "task-list" {
+ pattern = "^task-list";
+ script = pkgs.writeDash "task-list" ''
+ ${pkgs.taskwarrior}/bin/task rc:${taskrcFile} list
+ '';
+ };
+
+ task-delete = buildSimpleReaktorPlugin "task-delete" {
+ pattern = "^task-remove: (?P<args>.*)$$";
+ script = pkgs.writeDash "task-delete" ''
+ ${pkgs.taskwarrior}/bin/task rc:${taskrcFile} delete "$*"
+ '';
+ };
+
todo = name: {
add = buildSimpleReaktorPlugin "${name}-add" {
pattern = "^${name}-add: (?P<args>.*)$$";
diff --git a/krebs/5pkgs/simple/krops.nix b/krebs/5pkgs/simple/krops.nix
index 29bfb52f..e4e9928d 100644
--- a/krebs/5pkgs/simple/krops.nix
+++ b/krebs/5pkgs/simple/krops.nix
@@ -2,6 +2,6 @@
fetchgit {
url = https://cgit.krebsco.de/krops;
- rev = "refs/tags/v1.0.0";
- sha256 = "0ahp3fxb3l1vcjylxw0cd0f4hfp98bxskkf3z9d37hl3m7v4pcb4";
+ rev = "refs/tags/v1.1.0";
+ sha256 = "19z5385rdci2bj0l7ksjbgyj84vsb29kz87j9x6vj5vv16y7y4ll";
}
diff --git a/krebs/krops.nix b/krebs/krops.nix
index 6a8a0572..861f2d32 100644
--- a/krebs/krops.nix
+++ b/krebs/krops.nix
@@ -12,7 +12,7 @@
krebs-source = {
nixpkgs.git = {
- ref = "91b286c8935b8c5df4a99302715200d3bd561977";
+ ref = "56fad146a12a6f934d1d5ef875eb729be1b19129";
url = https://github.com/NixOS/nixpkgs;
};
stockholm.file = toString ../.;