]> Sergey Matveev's repositories - feeder.git/commitdiff
Simplify with xmlstarlet
authorSergey Matveev <stargrave@stargrave.org>
Fri, 17 Feb 2023 19:24:05 +0000 (22:24 +0300)
committerSergey Matveev <stargrave@stargrave.org>
Fri, 17 Feb 2023 19:24:08 +0000 (22:24 +0300)
xmlstarlet ("xml" command) in general most likely to be installed on the
system and there is just single invocation of it.

opml2feeds

index f033040d5a7f3ea6b32da4f6a96227d5cbe13756..d0ba28e641c1ecb1a44d40381befeec6a99cbced 100755 (executable)
@@ -4,9 +4,9 @@
 # The folder name will be the title as defined in the @text attr
 
 set -e
-xq '.opml.body.outline[]' -rc | while read outline ; do
-       url=$(echo $outline | jq '."@xmlUrl"' -r)
-       dir=$(echo $outline | jq '."@text"' -r)
+${XML:-xml} sel -T -t -m opml/body/outline -v @xmlUrl -n -v @text -n |
+while read url ; do
+       read dir
        mkdir -p "$dir"/cur "$dir"/new "$dir"/tmp # make it maildir
        echo "$url" > $dir/url
        echo $dir