Compare commits

..

No commits in common. '99b0c8570c1d0fe00d0ffd303e9190b916bde330' and '01d77b674ac600d21cb05b4a9c8f0c8aa464195b' have entirely different histories.

  1. 29
      patootie.sh

@ -15,25 +15,12 @@
# Patootie uses the environment variable TOOTACCT to specify the tooting account
# otherwise it uses whichever one is currently active in toot.
# If an argument is passed, it is assumed to be the image file to attach.
# TODO - test with spaces for this - do I need to mess with IFS here as well?
Need_Image=""
IMAGE_FILE=""
binary=$(which toot)
if [ ! -f "${binary}" ];then
echo "Exiting -- toot binary is not on \$PATH" 1>&2
exit 99
fi
if [ -f "${1}" ];then
IMAGE_FILE="${1}"
Need_Image="TRUE"
fi
ANSWER=$(yad --form --separator="±" --item-separator="," --columns=2 --title "patootie" \
--field="What to toot?:TXT" "" \
--field="ContentWarning:CBE" none,discrimination,bigot,uspol,medicine,violence,reproduction,healthcare,LGBTQIA,climate,SocialMedia \
@ -41,21 +28,17 @@ ANSWER=$(yad --form --separator="±" --item-separator="," --columns=2 --title "p
--item-separator="," --button=Cancel:99 --button=Post:0)
TootText=$(echo "${ANSWER}" | awk -F '±' '{print $1}' | sed -e 's/ "/ “/g' -e 's/" /” /g' -e 's/"\./”\./g' -e 's/"\,/”\,/g' -e 's/\."/\.”/g' -e 's/\,"/\,”/g' -e 's/"/“/g' -e "s/'/’/g" -e 's/ -- /—/g' -e 's/(/—/g' -e 's/)/—/g' -e 's/ — /—/g' -e 's/ - /—/g' -e 's/ – /—/g' -e 's/ – /—/g')
ContentWarning=$(echo "${ANSWER}" | awk -F '±' '{print $2}' | sed -e 's/ "/ “/g' -e 's/" /” /g' -e 's/"\./”\./g' -e 's/"\,/”\,/g' -e 's/\."/\.”/g' -e 's/\,"/\,”/g' -e 's/"/“/g' -e "s/'/’/g" -e 's/ -- /—/g' -e 's/(/—/g' -e 's/)/—/g' -e 's/ — /—/g' -e 's/ - /—/g' -e 's/ – /—/g' -e 's/ – /—/g')
TootText=$(echo "${ANSWER}" | awk -F '±' '{print $1}' | sed -e 's/"/“/g' -e "s/'/’/g" -e 's/ -- /—/g' -e 's/ — /—/g' -e 's/ - /—/g' -e 's/ – /—/g' -e 's/ – /—/g')
ContentWarning=$(echo "${ANSWER}" | awk -F '±' '{print $2}' | sed -e 's/"/“/g' -e "s/'/’/g" -e 's/ -- /—/g' -e 's/(/—/g' -e 's/)/—/g' -e 's/ — /—/g' -e 's/ - /—/g' -e 's/ – /—/g' -e 's/ – /—/g')
if [ "$ContentWarning" == "none" ];then
ContentWarning=""
fi
if [ "$IMAGE_FILE" == "" ];then # if there wasn't one by command line
# to see if need to select image
Need_Image=$(echo "$ANSWER" | awk -F '±' '{print $3}')
fi
# to see if need to select image
Need_Image=$(echo "$ANSWER" | awk -F '±' '{print $3}')
if [ "${Need_Image}" == "TRUE" ];then
if [ "${IMAGE_FILE}" == "" ]; then # if there wasn't one by command line
IMAGE_FILE=$(yad --title "Select image to add" --width=500 --height=400 --file --file-filter "Graphic files | *.jpg *.png *.webp *.jpeg")
fi
IMAGE_FILE=$(yad --title "Select image to add" --width=500 --height=400 --file --file-filter "Graphic files | *.jpg *.png *.webp *.jpeg")
if [ ! -f "${IMAGE_FILE}" ];then
SendImage=""
else
@ -72,7 +55,7 @@ if [ "${Need_Image}" == "TRUE" ];then
echo "$ALT_TEXT"
if [ ! -z "$ALT_TEXT" ];then
# parens changed here because otherwise eval chokes
AltText=$(echo "${ALT_TEXT}" | sed -e 's/ "/ “/g' -e 's/" /” /g' -e 's/"\./”\./g' -e 's/"\,/”\,/g' -e 's/\."/\.”/g' -e 's/\,"/\,”/g' -e 's/"/“/g' -e "s/'/’/g" -e 's/ -- /—/g' -e 's/(/—/g' -e 's/)/—/g' -e 's/ — /—/g' -e 's/ - /—/g' -e 's/ – /—/g' -e 's/ – /—/g')
AltText=$(echo "${ALT_TEXT}" | sed -e 's/"/“/g' -e "s/'/’/g" -e 's/ -- /—/g' -e 's/(/—/g' -e 's/)/—/g' -e 's/ — /—/g' -e 's/ - /—/g' -e 's/ – /—/g' -e 's/ – /—/g')
AltText=" --description \"${AltText}\""
else
AltText=""

Loading…
Cancel
Save