initial support

This commit is contained in:
Dylan Araps 2016-10-02 19:29:13 +11:00
parent 76ab8b0520
commit 56997e6bc3
1 changed files with 48 additions and 4 deletions

View File

@ -2218,10 +2218,6 @@ getimage() {
img="$thumbnail_dir/$imgname"
}
takescrot() {
$scrot_cmd "${scrot_dir}${scrot_name}"
}
# }}}
# Find w3m-img {{{
@ -2290,6 +2286,54 @@ getimagebackend() {
# }}}
# Screenshot {{{
takescrot() {
$scrot_cmd "${scrot_dir}${scrot_name}"
}
# }}}
# Screenshot Upload {{{
image_host="imgur"
scrot_upload() {
image_file="${scrot_dir}${scrot_name}"
case "$image_host" in
"teknik")
baseurl='https://u.teknik.io'
uploadurl='https://api.teknik.io/upload/post'
ret="$(curl -sf -F file="@${image_file}" ${uploadurl})"
desturl="${ret##*url\":\"}"
desturl="${desturl%%\"*}"
desturl="${desturl//\\}"
;;
"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
printf "%s\n" "your screenshot can be viewed at $desturl"
}
# }}}
# }}}
# Text Formatting {{{