From 3920ad71b8a39895fa663bf568f3669ec7e41150 Mon Sep 17 00:00:00 2001 From: EuAndreh Date: Fri, 11 Apr 2025 14:58:35 -0300 Subject: Add support for feed per category --- src/categories | 20 ++++++++++++++++++++ src/categorydata | 20 ++++++++++++++++++++ 2 files changed, 40 insertions(+) create mode 100755 src/categories create mode 100755 src/categorydata (limited to 'src') diff --git a/src/categories b/src/categories new file mode 100755 index 0000000..a054069 --- /dev/null +++ b/src/categories @@ -0,0 +1,20 @@ +#!/bin/sh +set -euo pipefail + + +usage() { + echo 'Usage: categories DIRECTORY' +} + +DIRECTORY="${1:-}" +eval "$(assert-arg -- "$DIRECTORY" 'DIRECTORY')" + +listall() { + find "$DIRECTORY"/category.*.*.sortdata | cut -d. -f2 | sort | uniq +} + +for category in `listall`; do + out="$DIRECTORY"/categories."$category".sortdata + cat "$DIRECTORY"/category."$category".*.sortdata > "$out" + printf '%s\n' "$out" +done diff --git a/src/categorydata b/src/categorydata new file mode 100755 index 0000000..faee5bf --- /dev/null +++ b/src/categorydata @@ -0,0 +1,20 @@ +#!/bin/sh +set -euo pipefail + + +usage() { + echo 'Usage: categorydata FILENAME.conf' +} + +FILENAME="${1:-}" +eval "$(assert-arg -- "$FILENAME" 'FILENAME.conf')" +. ./"$FILENAME" + + +DIR="$(dirname "$FILENAME")"/../../.. +for category in ${categories:-}; do + from="$DIR"/category."$category"."$date_iso"-"$sort".sortdata + to="$date_iso"-"$sort".sortdata + ln -fs "$to" "$from" + printf '%s\n' "$from" +done -- cgit v1.2.3