aboutsummaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorEuAndreh <eu@euandre.org>2019-01-21 01:25:07 -0200
committerEuAndreh <eu@euandre.org>2019-01-21 01:25:07 -0200
commit8d490839b7ef11549bee6c92fdd86ef60afd55e0 (patch)
tree4f8ed347858a49b91e1403cadec864082c6baa02 /scripts
parentInitial setup for buku. (diff)
downloaddotfiles-8d490839b7ef11549bee6c92fdd86ef60afd55e0.tar.gz
dotfiles-8d490839b7ef11549bee6c92fdd86ef60afd55e0.tar.xz
Generate local RSS feed from buku tags.
Diffstat (limited to 'scripts')
-rw-r--r--scripts/atom.js22
-rwxr-xr-xscripts/atom.sh19
2 files changed, 41 insertions, 0 deletions
diff --git a/scripts/atom.js b/scripts/atom.js
new file mode 100644
index 0000000..878df05
--- /dev/null
+++ b/scripts/atom.js
@@ -0,0 +1,22 @@
+const RSS = require('rss');
+
+const feedName = process.argv[2];
+const feedSrc = process.argv[3];
+
+const feed = new RSS({
+ title: `Buku feed tag for '${feedName}'.`,
+ description: `Buku feed tag for ${feedName}`,
+});
+
+const items = require(feedSrc);
+items.forEach(({ title, description, uri }) => {
+ feed.item({
+ title,
+ description,
+ url: uri
+ });
+});
+
+const xml = feed.xml({indent: true});
+
+console.log(xml);
diff --git a/scripts/atom.sh b/scripts/atom.sh
new file mode 100755
index 0000000..73c35ec
--- /dev/null
+++ b/scripts/atom.sh
@@ -0,0 +1,19 @@
+#!/usr/bin/env bash
+set -euo pipefail
+cd "$(dirname "${BASH_SOURCE[0]}")"
+
+if [[ ! -d "node_modules" ]]; then
+ npm i rss
+fi
+
+feed() {
+ local tag="$1"
+ local tmp="/tmp/$tag.json"
+ buku -t "$tag" --json > "$tmp"
+ node atom.js "$tag" "$tmp"
+}
+
+mkdir -p ~/.newsboat
+feed ril > ~/.newsboat/ril.xml
+feed simple-archive > ~/.newsboat/simple-archive.xml
+feed inbox > ~/.newsboat/inbox.xml