From c95a2b7e9004b9249f6c33984225fbc8ba997675 Mon Sep 17 00:00:00 2001 From: Ian Kelling Date: Wed, 30 Nov 2022 22:05:34 -0500 Subject: [PATCH] remove unused var, add file for alt text --- pdt.sh | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/pdt.sh b/pdt.sh index acf6fe1..bc388cc 100644 --- a/pdt.sh +++ b/pdt.sh @@ -78,8 +78,10 @@ toot() { # # Alt text only goes to mastodon. # -# usage: pdt [-s mastodon|twitter|gnusocial] [--dbd] [-m MEDIA_FILE] [-a ALT_TEXT] [-v VIDEO_PATH] [POST] +# usage: pdt [-s mastodon|twitter|gnusocial] [--dbd] [-m IMAGE_FILE] [-a ALT_TEXT] [-v VIDEO_PATH] [POST] # -s = post to single social network supplied by argument. +# -m IMAGE_FILE = Uploads IMAGE_FILE. if MEDIA_FILE.txt exists, the last line of that file will be used as ALT_TEXT +# unless -a has been used. pdt() { local video media rbow_account gs_account mastodon_account dbd video rbow_arg gs_arg alt_text local -a toot_args @@ -92,7 +94,6 @@ pdt() { gs_account=fsf mastodon_account=fsf@hostux.social fi - dbd=false video=false do_mastodon=true do_twitter=true @@ -134,7 +135,6 @@ pdt() { gs_arg="-F media=@$media" ;; --dbd) - dbd=true rbow_account=dbd gs_account=dbd mastodon_account=endDRM@hostux.social @@ -156,6 +156,9 @@ pdt() { echo "error: file path contains a space. move it to non-space path" return 1 fi + if [[ ! $alt_text && -r $media.txt && -s $media.txt ]]; then + alt_text=$(tail -n1 $media.txt) + fi fi # if we have no argument if (( ! $# )); then -- 2.25.1