diff options
Diffstat (limited to 'src/atom.sh')
-rw-r--r-- | src/atom.sh | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/src/atom.sh b/src/atom.sh new file mode 100644 index 0000000..cf694b3 --- /dev/null +++ b/src/atom.sh @@ -0,0 +1,41 @@ +#!/bin/sh +# adapted from https://git.segvallday.org/ass2atom/file/ass2atom.html +# 0BSD License - Full text at the bottom of this file + +echo "<?xml version=\"1.0\" encoding=\"utf-8\"?>" +echo "<feed xmlns=\"http://www.w3.org/2005/Atom\">" +echo "<title type=\"text\">dzwdz</title>" +echo "<updated>$(date -Iseconds)</updated>" +echo "<id>urn:uuid:677e5055-07e1-43d6-bd58-fda18d3c5277</id>" + +to_atom_entry() { + while read line; do + entry_date=$(echo "$line" | cut -f1) + entry_url=$(echo "$line" | cut -f2) + entry_title=$(echo "$line" | cut -f3) + echo "<entry>" + echo "<title>$entry_title</title>" + echo "<link href=\"$entry_url\"/>" + echo "<updated>${entry_date}T00:00Z</updated>" + echo "<id>${entry_url}?${entry_date}</id>" + echo "</entry>" + done +} + +grep -e "^[^#]" | sort -r | to_atom_entry +echo '</feed>' + +# BSD Zero Clause License +# +# Copyright (c) 2023 segvallday, adapted by dzwdz +# +# Permission to use, copy, modify, and/or distribute this software for any +# purpose with or without fee is hereby granted. +# +# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH +# REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY +# AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, +# INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM +# LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR +# OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR +# PERFORMANCE OF THIS SOFTWARE. |