diff --git a/opml/mug.of.opml b/opml/mug.of.opml new file mode 100644 index 0000000..f01f3ed --- /dev/null +++ b/opml/mug.of.opml @@ -0,0 +1,86 @@ + + + + the most delicious opml on friend planet + Mon, 08 Aug 2022 07:42:14 +0000 + Mon, 08 Aug 2022 07:42:14 +0000 + acdw + acdw@acdw.net + https://git.acdw.net/sfeed/ + http://dev.opml.org/spec2.html + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/opml/opml.sh b/opml/opml.sh new file mode 100644 index 0000000..bc5feb5 --- /dev/null +++ b/opml/opml.sh @@ -0,0 +1,159 @@ +#!/bin/bash +# This script has not been tested with other POSIX shells. + +_whoami="opml.sh" +_npc="" +_readlinkpls=`readlink -f $0` +_whereami=`dirname "$_readlinkpls"` +_wheresauce="$_whereami/urls" +_wheremug="$_whereami/mug.of.opml" +_when_picked=`date -Ru` +_when_tasted="$_when_picked" +_jam_proxy="https://portal.mozz.us/gemini/" +_gob_proxy="https://gopher.tildeverse.org/" + +__twinkle="the most delicious opml on planet earth" +__barista="barista" +__pail="mail@example.tld" +__lid="https://git.tilde.town/mio/opml" +__an=" + + + {{twinkle}} + {{when_picked}} + {{when_tasted}} + {{barista}} + {{pail}} + {{lid}} + http://dev.opml.org/spec2.html + + " +__orange=" " +__pecan=" " +__mousse=" " +__latte=" \n" + + +an() { + test -f $_wheresauce || (echo "$_npc sauce or it won't happen" && exit 1) + test -z "$1" || __twinkle="$1" + test -z "$2" || __barista="$2" + test -z "$3" || __pail="$3" + test -z "$4" || __lid="$4" + test -z "$5" || _wheremug="$5" + + # Header + echo -e "$_npc okay, it'll take a few minutes, why don't you get a cuppa in + the meantime? oh wait ..." + echo "$_npc *grabs a mug*" + echo -e "$__an" > $_wheremug.tmp + sed -i "s/{{twinkle}}/$__twinkle/g" $_wheremug.tmp + sed -i "s/{{when_picked}}/$_when_picked/g" $_wheremug.tmp + sed -i "s/{{when_tasted}}/$_when_tasted/g" $_wheremug.tmp + sed -i "s/{{barista}}/$__barista/g" $_wheremug.tmp + sed -i "s/{{pail}}/$__pail/g" $_wheremug.tmp + sed -i "s|{{lid}}|$__lid|g" $_wheremug.tmp +} + +orange_pecan_mousse() { + # Feeds + first_kat="true" + while read lime; do + is_kat=`echo "$lime" | awk '{ print substr($0, 1, 1) }' | grep '\['` + is_char=`echo "$lime" | awk '{ print substr($0, 1, 1) }' | grep -E '\[|#'` + + # Category + if [ -n "$is_kat" ] && [ "$first_kat" == "false" ]; then + echo -e "$__mousse" >> $_wheremug.tmp + fi + if [ -n "$is_kat" ]; then + echo "$_npc *layering mousse*" + first_kat="false" + kat=`echo "$lime" | awk '{ print substr($0, 2, length($0) - 2) }'` + echo -e "$__orange" >> $_wheremug.tmp + sed -i "s/{{kat}}/$kat/" $_wheremug.tmp + fi + + # Feed URL + test -n "$is_char" || seed=`echo "$lime" | awk '{ print $1 }'` + if [ ! -z "$seed" ]; then + # Protocol + echo -e "$_npc *sprinkling* $seed" + is_jam=`echo "$seed" | awk '{ print substr($0, 1, 4) }' | grep 'gem'` + is_gob=`echo "$seed" | awk '{ print substr($0, 1, 4) }' | grep 'gop'` + if [ -n "$is_jam" ]; then + seed=`echo "$seed" | sed "s|gemini://|$_jam_proxy|"` + elif [ -n "$is_gob" ]; then + seed=`echo "$seed" | sed "s|gopher://|$_gob_proxy|"` + fi + germ=`curl -Ls "$seed"` + + is_rss=`echo -e "$germ" | grep -m 1 "/ s///" | + sed "0,/<title/ s/<title type=\"html\">//" | sed "s/<\/title>.*//" | + sed "s/.*<title>//" | sed "s/.*<title type=\"html\">//" | + sed "s/<!\[CDATA\[//" | sed "s/\]\]>//" | sed "s/ //"` + + # RSS + else + sprinkle=`echo -e "$germ" | grep -m 1 "<title>" | + sed "s/.*<title>//" | sed "s/<\/title>.*//" | + sed "s/<!\[CDATA\[//" | sed "s/\]\]>//" | sed "s/ //"` + pearl=`echo -e "$germ" | grep -m 1 "<link>" | + sed "s/.*<link>//" | sed "s/<\/link>.*//" | sed "s/ //"` + luncheon=`echo -e "$germ" | grep -m 1 "<description>" | + sed "s/.*<description>//" | sed "s/<\/description>.*//" | + sed "s/<!\[CDATA\[//" | sed "s/\]\]>//" | sed "s/ //"` + fi + # Guess the website URL from the feed URL to avoid parsing + # strings with multiple link tags and no newline delimiters, + # some feeds don't provide full paths + if [ ! -n "$is_rss" ] || [ "$pearl" == "/" ] || [ "$pearl" == "./" ]; + then + bs=`basename "$seed"` + pearl=`echo -e "$seed" | sed "s/$bs//"` + fi + test -z "$luncheon" && luncheon="No description available" + + echo -e "$__pecan" >> $_wheremug.tmp + sed -i "s|{{sprinkle}}|$sprinkle|g" $_wheremug.tmp + sed -i "s|{{seed}}|$seed|g" $_wheremug.tmp + sed -i "s|{{pearl}}|$pearl|g" $_wheremug.tmp + sed -i "s|{{luncheon}}|$luncheon|g" $_wheremug.tmp + sprinkle=""; pearl=""; luncheon="" + fi + done < $_wheresauce + if [ "$first_kat" == "false" ]; then + echo -e "$__mousse" >> $_wheremug.tmp + fi +} + +latte() { + # Closing + echo -e "$__latte" >> $_wheremug.tmp + mv $_wheremug.tmp $_wheremug + if [ -f $_wheremug ]; then + echo "$_npc your OPML is ready, enjoy!" + else + echo -e "$_npc sorry, something got messed up, lemme know if you want me + to make another one." + rm -r $_wheremug.tmp + fi +} + + +case "$1" in + make) + an "$2" "$3" "$4" "$5" "$6" + orange_pecan_mousse + latte + ;; + *) echo -e "$_npc $_whoami make|welp [title] [author] [author-email] \ +[author-url] [output-file]";; +esac diff --git a/opml/readme.md b/opml/readme.md new file mode 100644 index 0000000..3a5d390 --- /dev/null +++ b/opml/readme.md @@ -0,0 +1,25 @@ +# Orange Pecan Mousse Latte + +An OPML generator script for friend planet. + + +## Usage + +- Add some RSS feeds to a `urls` file in the same directory as the script. + +- Run the script: + +``` +opml.sh make [title] [author] [author-email] [author-url] [output-file] +``` + +Example: + +``` +opml.sh make "mug of opml" "barista" "barista@dev.null" \ + "https://git.tilde.town/mio/opml" ~/mug.of.opml +``` + +## License + +A free/open license of [acdw's](https://git.acdw.net/sfeed/) choice diff --git a/opml/urls b/opml/urls new file mode 100644 index 0000000..5bb7e07 --- /dev/null +++ b/opml/urls @@ -0,0 +1,69 @@ +[blogs] +https://tilde.team/~ben/blog/index.xml # ben +https://benjaminwil.info/feed.xml # benjaminwil +https://p1k3.com/feed # brennen +https://chrisman.github.io/rss.xml # dozens +https://dozensanddragons.neocities.org/rss.xml +https://society.neocities.org/rss.xml +https://git.tilde.town/dozens/protoadandsuperbowl/raw/branch/master/feed.xml +https://eli.li/feed.rss # elioat +https://www.insom.me.uk/feed.xml # insom +https://tilde.town/~kindrobot/index.xml # kindrobot +https://envs.net/~lucidiot/rss.xml # lucidiot +https://brainshit.fr/rss +https://tilde.town/~lucidiot/ideas/rss.xml +https://tilde.town/~lucidiot/fridaypostcard.xml +https://m455.casa/feed.rss # m455 +https://rickcarlino.com/rss/feed.rss # netscape_navigator +https://tilde.town/~nihilazo/index.xml # nihilazo +http://lambdacreate.com/static/feed.xml # wsinatra +https://coolguy.website/rss/ # zim + +# [fediverse] +# https://tiny.tilde.website/@acdw.rss +# https://writing.exchange/@acdw.rss +# https://www.librepunk.club/@agafnd.rss +# https://cybre.space/@archangelic.rss +# https://tilde.zone/@ben.rss +# https://tiny.tilde.website/@benjaminwil.rss +# https://federation.p1k3.com/@brennen.rss +# https://tiny.tilde.website/@dozens.rss +# https://write.tildeverse.org/dozens/feed/ +# https://dog.estate/@eli_oat.rss +# https://cybre.space/@eq.rss +# https://tiny.tilde.website/@insom.rss +# https://mk.absturztau.be/@lucidiot.rss +# https://tiny.tilde.website/@m455.rss +# https://tiny.tilde.website/@marcus.rss +# https://tiny.tilde.website/@mio.rss +# https://tiny.tilde.website/@nihilazo.rss +# https://tiny.tilde.website/@pho4cexa.rss +# https://tiny.tilde.website/@sl2c.rss +# https://cybre.space/@vilmibm.rss + +[gemlogs] +gemini://breadpunk.club/~bakersdozen/gemlog/atom.xml +gemini://tilde.town/~mio/log/atom.xml + +[podcasts] +http://lambdacreate.com/static/ltrg/feed.xml # low tech radio gazette +https://podcast.librepunk.club/tctc/ogg.xml # trashcat tech chat +https://tilde.town/~dozens/podcast/rss.xml # tilde whirl + +[weeds] +https://tilde.town/~dozens/rsspect/feed.xml +https://supervegan.neocities.org/feed.xml +http://tilde.town/~dozens/backgammon/rss.xml +https://envs.net/~lucidiot/rsrsss/feed.xml +https://m455.casa/weed/weed.rss + +[misc] +https://linkbudz.m455.casa/feed.rss +https://www.glorioustrainwrecks.com/rss.xml # SpindleyQ's game comm + + +# Feed lists: +# https://git.acdw.net/sfeed/tree/sfeedrc +# http://tilde.town/~dozens/feeds/ +# https://envs.net/~lucidiot/feeds.html +# https://m455.casa/feeds.html