Added working teknik support and new flags
This commit is contained in:
parent
269e903e64
commit
94cbd6bb02
|
@ -402,7 +402,12 @@ scrot_dir="$HOME/Pictures/"
|
||||||
# Scrot filename
|
# Scrot filename
|
||||||
# What to name the screenshots
|
# What to name the screenshots
|
||||||
# --scrot_name str
|
# --scrot_name str
|
||||||
scrot_name="neofetch-$(date +%F-%T).png"
|
scrot_name="neofetch-$(date +%F-%I-%M).png"
|
||||||
|
|
||||||
|
# Image upload host
|
||||||
|
# Where to upload the image.
|
||||||
|
# Possible values: teknik,
|
||||||
|
image_host="teknik"
|
||||||
|
|
||||||
|
|
||||||
# }}}
|
# }}}
|
||||||
|
|
33
neofetch
33
neofetch
|
@ -2290,44 +2290,25 @@ getimagebackend() {
|
||||||
|
|
||||||
takescrot() {
|
takescrot() {
|
||||||
$scrot_cmd "${scrot_dir}${scrot_name}"
|
$scrot_cmd "${scrot_dir}${scrot_name}"
|
||||||
|
[ "$scrot_upload" == "on" ] && scrot_upload
|
||||||
}
|
}
|
||||||
|
|
||||||
# }}}
|
# }}}
|
||||||
|
|
||||||
# Screenshot Upload {{{
|
# Screenshot Upload {{{
|
||||||
|
|
||||||
image_host="imgur"
|
|
||||||
|
|
||||||
scrot_upload() {
|
scrot_upload() {
|
||||||
image_file="${scrot_dir}${scrot_name}"
|
image_file="${scrot_dir}${scrot_name}"
|
||||||
|
printf "%s\n" "Uploading image..."
|
||||||
|
|
||||||
case "$image_host" in
|
case "$image_host" in
|
||||||
"teknik")
|
"teknik")
|
||||||
baseurl='https://u.teknik.io'
|
image_url="$(curl -sf -F file="@${image_file}" 'https://api.teknik.io/v1/Upload')"
|
||||||
uploadurl='https://api.teknik.io/v1/Upload'
|
image_url="$(awk -F 'url:|,' '{printf $2}' <<< "${image_url//\"}")"
|
||||||
ret="$(curl -sf -F file="@${image_file}" ${uploadurl})"
|
|
||||||
url="$(awk -F 'url:\"|\"' '{printf $2}' <<< "$ret")"
|
|
||||||
;;
|
|
||||||
|
|
||||||
"mediacrush")
|
|
||||||
baseurl='https://mediacru.sh'
|
|
||||||
uploadurl='https://mediacru.sh/api/upload/file'
|
|
||||||
ret="$(curl -sf -F file="@${image_file};type=image/png" ${uploadurl})"
|
|
||||||
filehash=$(echo "${ret}" | grep "hash" | cut -d '"' -f4)
|
|
||||||
desturl="${baseurl}/${filehash}"
|
|
||||||
;;
|
|
||||||
|
|
||||||
"imgur")
|
|
||||||
baseurl='http://imgur.com'
|
|
||||||
uploadurl='http://imgur.com/upload'
|
|
||||||
ret="$(curl -sf -F file="@${image_file}" ${uploadurl})"
|
|
||||||
filehash="${ret##*hash\":\"}"
|
|
||||||
filehash="${filehash%%\"*}"
|
|
||||||
desturl="${baseurl}/${filehash}"
|
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
printf "%s\n" "your screenshot can be viewed at $desturl"
|
[ "$image_url" ] && printf "%s\n" "$image_url"
|
||||||
}
|
}
|
||||||
|
|
||||||
# }}}
|
# }}}
|
||||||
|
@ -3126,6 +3107,10 @@ getargs() {
|
||||||
scrot_dir="${2/$scrot_name}"
|
scrot_dir="${2/$scrot_name}"
|
||||||
fi
|
fi
|
||||||
;;
|
;;
|
||||||
|
--upload | -su)
|
||||||
|
scrot="on"
|
||||||
|
scrot_upload="on"
|
||||||
|
;;
|
||||||
--scrot_cmd) scrot_cmd="$2" ;;
|
--scrot_cmd) scrot_cmd="$2" ;;
|
||||||
|
|
||||||
# Other
|
# Other
|
||||||
|
|
Reference in New Issue