# I am the Watcher. I am your guide through this vast new twtiverse.
# 
# Usage:
#     https://watcher.sour.is/api/plain/users              View list of users and latest twt date.
#     https://watcher.sour.is/api/plain/twt                View all twts.
#     https://watcher.sour.is/api/plain/mentions?uri=:uri  View all mentions for uri.
#     https://watcher.sour.is/api/plain/conv/:hash         View all twts for a conversation subject.
# 
# Options:
#     uri     Filter to show a specific users twts.
#     offset  Start index for quey.
#     limit   Count of items to return (going back in time).
# 
# twt range = 1 25
# self = https://watcher.sour.is/conv/golikrq
I managed to make a template for pp that produces an HTML list of twts for a given twtxt file, similar to the way I have it on my website. It even turns HTTP URLs into hyperlinks. It definitely needs some work, but I think I've reached the limit of POSIX sh. I don't know of any way to compare dates or change the format of a timestamp without GNU date. rev isn't a POSIX utility either so I can't have reverse chronological order without doing some awk sorcery or something.
@mckinley I realized I had more to say than I thought and, rather than make a chain of twts, I made a blog post instead. Here's a screenshot what the template makes when it's fed my twtxt feed. I'm going to bed, man.
@mckinley I realized I had more to say than I thought and, rather than make a chain of twts, I made a blog post instead. Here's a screenshot what the template makes when it's fed my twtxt feed. I'm going to bed, man.
@mckinley Very nice 👌
@mckinley Very nice 👌
@mckinley Are you aware of this https://github.com/hroptatyr/dateutils?
@adi Thank you, that looks to be almost exactly what I'm looking for. I'll take a closer look later.
@adi Thank you, that looks to be almost exactly what I'm looking for. I'll take a closer look later.
@mckinley Also, @eldersnake had an awk script I wrote that does kinda that. Maybe he could post it.
@mckinley_tt So I just learned that tac is Linux-specific. And ISO 8601 and RFC 3339 formatted timestamps should be easily sortable with sort (which hopefully is POSIX-compliant). Or where is the matter there?
@mckinley @lyse Right, tac is the one that reverses lines. Apologies, I always get the two mixed up. What I want to do is automate the HTMLized twtxt pages on my website. I'll need to remove comments, sort the feed chronologically which can definitely be done with sort, and then separate the feed into three month periods. Then I'll pass that three month chunk into pp which will use the template to generate HTML. I'll need dateutils or something similar to separate the feed into blocks as well as changing the date format to something more readable for the HTML.
@mckinley @lyse Right, tac is the one that reverses lines. Apologies, I always get the two mixed up. What I want to do is automate the HTMLized twtxt pages on my website. I'll need to remove comments, sort the feed chronologically which can definitely be done with sort, and then separate the feed into three month periods. Then I'll pass that three month chunk into pp which will use the template to generate HTML. I'll need dateutils or something similar to separate the feed into blocks as well as changing the date format to something more readable for the HTML.
@mckinley I didn't know about rev, pretty cool. :-) Ahhh, the quarterly grouping, alright! Some things are just much easier done in languages like Python. However, trying to stick to POSIX shells is always a good challenge. ;-) One addition to sort: That of course only works if the timezones are not all over the place. But for a personal twtxt feed that should be no problem.
@mckinley @lyse Recommended way to reverse would be tail -r, https://unix.stackexchange.com/a/340380
@lyse There is absolutely no question that this is not a job for a shell script. I've gone this far out of a want to use pp for something useful but now I don't think it's possible to properly escape backslashes in twts without the use of temporary files. I'm thinking this one might have to be put in the folder of purgatory with the rest.
@lyse There is absolutely no question that this is not a job for a shell script. I've gone this far out of a want to use pp for something useful but now I don't think it's possible to properly escape backslashes in twts without the use of temporary files. I'm thinking this one might have to be put in the folder of purgatory with the rest.
@mckinley @lyse So you're considering automating the generation of this page https://mckinley.cc/twtxt/ and the children (e.g. https://mckinley.cc/twtxt/2021-sep-dec.html), right?
@adi Nice! Didn't know tail had an -r option.
@adi Yes, that's correct.
@adi Yes, that's correct.
@mckinley From https://mckinley.cc/twtxt.txt, right?
@adi Uh, yeah. Why?
@adi Uh, yeah. Why?
@mckinley I'm checking it out now.
@mckinley @adi The awk script you wrote for me would be this one https://www.andrewjvpowell.com/pastebin/1633566329/