From 73bc440ac4d0413becb98c78955b97c68cf725b3 Mon Sep 17 00:00:00 2001 From: Case Duckworth Date: Mon, 18 Jul 2022 14:39:04 -0500 Subject: Add Youtube feed processing --- sfeed_html.sh | 13 ++++++++++--- style.css | 6 ++++++ 2 files changed, 16 insertions(+), 3 deletions(-) diff --git a/sfeed_html.sh b/sfeed_html.sh index 2dd830c..948bf93 100755 --- a/sfeed_html.sh +++ b/sfeed_html.sh @@ -81,9 +81,11 @@ html_feed() { # html_feed FEED(file) => HTML ## ENTRIES entries="$(awk -v NOW="$now" -v FRESH_SECS="$fresh_secs" \ - -v NAME="$filename" -v ASIDE="$aside" -v limit="$LIMIT" \ + -v NAME="$filename" -v FNAME="$filename" \ + -v ASIDE="$aside" -v limit="$LIMIT" \ 'BEGIN { FS="\t"; fresh_feed = 0; FRESH = (NOW - FRESH_SECS); } FNR == 1 { nitem = 0; } + NAME ~ /^\[yt\]/ { sub(/^\[yt\] /, "", NAME); yt = 1; } function unescape(t) { t = html_escape(t); gsub(/\\\t/,"\t",t); @@ -141,14 +143,19 @@ html_feed() { # html_feed FEED(file) => HTML END { if (show_in_sidebar) { printf "", (fresh_feed?" class=\"fresh\"":"") >> ASIDE - printf "%s\n", NAME, NAME >> ASIDE + printf "%s\n", (yt ? " class=\"yt\"" : ""), FNAME, NAME >> ASIDE } printf "%s", (stamp ? stamp : ".") > "/dev/stderr" }' "$1" | filter_invidious)" if [ -z "$entries" ]; then return 1; fi echo "
" # TODO: Include a link back to the website - printf '

# %s

\n' "$filename" "$filename" + case "$filename" in + \[yt\]*) yt=" class=\"yt\"" ;; + *) yt="" ;; + esac + fn="$(echo "$filename" | sed 's@^\[yt\]@@')" + printf '
# %s\n' "$yt" "$filename" "$fn" echo "" if [ -f "$SFEED_DATA/urls/$filename" ]; then feed_url="$(sed -n '1p;1q' "$SFEED_DATA/urls/$filename")" diff --git a/style.css b/style.css index 58a6e47..7bdb47d 100644 --- a/style.css +++ b/style.css @@ -195,3 +195,9 @@ footer a:link { display: inline; text-decoration: underline; } + +.yt::after { + content: " *"; + color: red; + size: 50%; +} -- cgit 1.4.1-21-gabe81