|
|
|
@ -15,12 +15,25 @@ |
|
|
|
|
# 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 \ |
|
|
|
@ -28,17 +41,21 @@ 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') |
|
|
|
|
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') |
|
|
|
|
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') |
|
|
|
|
if [ "$ContentWarning" == "none" ];then |
|
|
|
|
ContentWarning="" |
|
|
|
|
fi |
|
|
|
|
|
|
|
|
|
# to see if need to select image |
|
|
|
|
Need_Image=$(echo "$ANSWER" | awk -F '±' '{print $3}') |
|
|
|
|
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 |
|
|
|
|
|
|
|
|
|
if [ "${Need_Image}" == "TRUE" ];then |
|
|
|
|
IMAGE_FILE=$(yad --title "Select image to add" --width=500 --height=400 --file --file-filter "Graphic files | *.jpg *.png *.webp *.jpeg") |
|
|
|
|
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 |
|
|
|
|
if [ ! -f "${IMAGE_FILE}" ];then |
|
|
|
|
SendImage="" |
|
|
|
|
else |
|
|
|
@ -55,7 +72,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') |
|
|
|
|
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=" --description \"${AltText}\"" |
|
|
|
|
else |
|
|
|
|
AltText="" |
|
|
|
|