From: frrobert2 Date: Sat, 29 May 2021 22:31:18 +0000 (-0400) Subject: updated lace and laced to pull adele style header if there X-Git-Url: https://software.frrobert.com/lace/commitdiff_plain/7c6c6abf41f724929802185a43362267a5c90529 updated lace and laced to pull adele style header if there --- diff --git a/lace b/lace index d97f0bb..3929cac 100755 --- a/lace +++ b/lace @@ -22,13 +22,14 @@ blue="[34m" nc="[m" esc=$(echo -e "\033") if [[ "$1" == "strict" ]] || [[ "$1" == "--strict" ]] || [[ "$1" == "-strict" ]] || [[ "$1" == "-s" ]];then - red="" - blue="" + red="### " + blue="### " nc="" esc="" fi tmpfile=$(mktemp /tmp/lace.XXXXXX) tmpfile2=$(mktemp /tmp/lace.XXXXXX) +tmpfile3=$(mktemp /tmp/lace.XXXXXX) function reldate() { # stolen from https://unix.stackexchange.com/a/451216 local SEC_PER_MINUTE=$((60)) @@ -95,7 +96,16 @@ function timeline() { if [ ! -z "$fav" ];then user="$fav $user" fi - timeout $connectto openssl s_client -crlf -quiet -connect "$domain:1965" <<<"$url" 2>/dev/null | sed -e '1d' | sed -n '/##/,$p' | sed -e "s/^\(## .*\)$/\1\n${esc}$red$user${esc}$nc ($domain)/g" >> $tmpfile + timeout $connectto openssl s_client -crlf -quiet -connect "$domain:1965" <<<"$url" 2>/dev/null > $tmpfile3 + local newuser=$(cat $tmpfile3 | sed -n '/# /{n;p;}' | grep -e author | awk '{print $2}' ) + local newavatar=$(cat $tmpfile3 | sed -n '/# /{n;n;p;}' | grep -e avatar | awk '{print $2}' ) + if [[ $newuser != "" ]] + then + + user="$newavatar $newuser" + fi + + cat $tmpfile3 | sed -e '1d' | sed -n '/##/,$p' | sed -e "s/^\(## .*\)$/\1\n${esc}$red$user${esc}$nc ($domain)/g" >> $tmpfile [[ ! -z $(sed -n '$p' $tmpfile) ]] && echo "" >> $tmpfile fi done <"$subsfile" @@ -118,9 +128,9 @@ function timeline() { if [[ "$1" == "nope" ]];then - cat $tmpfile && rm -f $tmpfile $tmpfile2 + cat $tmpfile && rm -f $tmpfile $tmpfile2 $tmpfile3 else - less -RisW $tmpfile && rm -f $tmpfile $tmpfile2 + less -RisW $tmpfile && rm -f $tmpfile $tmpfile2 $tmpfile3 fi } diff --git a/laced b/laced index ae8c825..3a855f5 100755 --- a/laced +++ b/laced @@ -29,6 +29,7 @@ esc=$(echo -e "\033") fi tmpfile=$(mktemp /tmp/lace.XXXXXX) tmpfile2=$(mktemp /tmp/lace.XXXXXX) +tmpfile3=$(mktemp /tmp/lace.XXXXXX) function reldate() { # stolen from https://unix.stackexchange.com/a/451216 local SEC_PER_MINUTE=$((60)) @@ -95,7 +96,17 @@ function timeline() { if [ ! -z "$fav" ];then user="$fav $user" fi - timeout $connectto openssl s_client -crlf -quiet -connect "$domain:1965" <<<"$url" 2>/dev/null | sed -e '1d' | sed -n '/##/,$p' | sed -e "s/^\(## .*\)$/\1\n${esc}$red$user${esc}$nc ($domain)/g" >> $tmpfile + timeout $connectto openssl s_client -crlf -quiet -connect "$domain:1965" <<<"$url" 2>/dev/null > $tmpfile3 + local newuser=$(cat $tmpfile3 | sed -n '/# /{n;p;}' | grep -e author | awk '{print $2}' ) + local newavatar=$(cat $tmpfile3 | sed -n '/# /{n;n;p;}' | grep -e avatar | awk '{print $2}' ) + if [[ $newuser != "" ]] + then + + user="$newavatar $newuser" + fi + + + cat $tmpfile3 | sed -e '1d' | sed -n '/##/,$p' | sed -e "s/^\(## .*\)$/\1\n${esc}$red$user${esc}$nc ($domain)/g" >> $tmpfile [[ ! -z $(sed -n '$p' $tmpfile) ]] && echo "" >> $tmpfile fi done <"$subsfile" @@ -125,7 +136,7 @@ sed -i '1i Laced could not connect to the Internet showing previous download' $c fi - rm -f $tmpfile $tmpfile2 + rm -f $tmpfile $tmpfile2 $tmpfile3 } if [[ "$1" == "help" ]] || [[ "$1" == "--help" ]] || [[ "$1" == "-help" ]] || [[ "$1" == "-h" ]];then