]> Sergey Matveev's repositories - feeder.git/commitdiff
Add opml2feeds
authorMatthieu Rakotojaona <m@rako.space>
Fri, 17 Feb 2023 17:13:07 +0000 (18:13 +0100)
committerSergey Matveev <stargrave@stargrave.org>
Fri, 17 Feb 2023 18:30:04 +0000 (21:30 +0300)
A little script to transform opml description (the standard for feeds)
into a compatible list of maildirs

opml2feeds [new file with mode: 0755]

diff --git a/opml2feeds b/opml2feeds
new file mode 100755 (executable)
index 0000000..6cb6989
--- /dev/null
@@ -0,0 +1,13 @@
+#!/usr/bin/env sh
+
+# Takes an opml file as first argument and creates a feeder-enabled maildir for each feed
+# The folder name will be the title as defined in the @text attr
+
+set -e
+cat $1 | xq '.opml.body.outline[]' -rc | while read outline ; do
+       url=$(echo $outline | jq '."@xmlUrl"' -r)
+       dir=$(echo $outline | jq '."@text"' -r)
+       mkdir -p "$dir"/{cur,new,tmp} # make it maildir
+       echo "$url" > $dir/url
+       echo $dir
+done