From 14295db5998bf04d8debc112322f33c66af458d5 Mon Sep 17 00:00:00 2001 From: Case Duckworth Date: Wed, 10 Aug 2022 23:03:37 -0500 Subject: Add sfeed_ass.awk --- sfeed_ass.awk | 47 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) create mode 100755 sfeed_ass.awk diff --git a/sfeed_ass.awk b/sfeed_ass.awk new file mode 100755 index 0000000..8db4e37 --- /dev/null +++ b/sfeed_ass.awk @@ -0,0 +1,47 @@ +#!/usr/bin/awk -f +## Converts sfeed(1) files into an Actually Simple Sindication +## (ASS) file. See https://tilde.town/~dzwdz/ass/ for details. + +## THE SPEC + +# An .ass file consists of a bunch of lines. Every line represents an item +# (e.g. article). + +# Every line consists of: + +# an ISO-8601 formatted date with dashes the URI of the item (optionally) the +# title of the item + +# Those elements are separated by tabs. Every tab after the URI is treated as +# part of the title. The order of the lines doesn't matter. Additional +# whitespace before the date is NOT permitted. + +# Lines can also be empty or start with the # character. Those lines are to be +# ignored by clients. I recommend adding a comment with a link to this page at +# the top, so people won't get confused about what to do with the file. + +# It's very highly recommended to name the file "feed.ass". This will make feed +# discovery much easier. If you want to get added to the list of known feeds, +# you MUST name your feed that (the 2 feeds in there are grandfathered in). +BEGIN { + FS = "\t" + OFS = "\t" +} + +{ + datecmd = "date -u -d '@" ($1 ? $1 : 0) "' +%F" + datecmd | getline timestamp + close(datecmd) + title = $2 + link = $3 + print timestamp, link, title + if (++line > 25) { + printf(".") > "/dev/stderr" + line = 0 + } +} + +END { + print("ok") > "/dev/stderr" +} + -- cgit 1.4.1-21-gabe81