bin: image uploading utils
This commit is contained in:
parent
7dd8e25b00
commit
828b17b9c0
|
@ -29,10 +29,10 @@ audio/mpeg=mpc.desktop;
|
|||
audio/x-wav=mpc.desktop;
|
||||
image/jpeg=org.kde.showfoto.desktop;
|
||||
image/png=org.kde.showfoto.desktop;
|
||||
inode/directory=org.kde.dolphin.desktop;
|
||||
inode/directory=pcmanfm.desktop;
|
||||
text/html=firefox.desktop;
|
||||
x-scheme-handler/discord-757737740241731714=discord-757737740241731714.desktop;
|
||||
x-scheme-handler/etcher=balena-etcher-electron.desktop;
|
||||
x-scheme-handler/etcher=balena-etcher.desktop
|
||||
x-scheme-handler/ferdi=ferdi.desktop
|
||||
x-scheme-handler/http=firefox.desktop;
|
||||
x-scheme-handler/https=firefox.desktop;
|
||||
|
@ -43,3 +43,4 @@ x-scheme-handler/signalcaptcha=signal.desktop;
|
|||
x-scheme-handler/tg=telegram.desktop;
|
||||
video/mp4=vlc.desktop;
|
||||
text/calendar=emacsclient.desktop;
|
||||
video/x-m4v=vlc.desktop
|
||||
|
|
|
@ -10,6 +10,7 @@ XDG_TEMPLATES_DIR="$HOME/.local/templates"
|
|||
XDG_DOWNLOAD_DIR="$HOME/data/5-incubator"
|
||||
XDG_MUSIC_DIR="$HOME/data/4-media/music"
|
||||
XDG_PICTURES_DIR="$HOME/data/4-media/images"
|
||||
XDG_SCREENSHOTS_DIR="$HOME/data/4-media/images/screenshots"
|
||||
XDG_VIDEOS_DIR="$HOME/data/4-media/video"
|
||||
XDG_DOCUMENTS_DIR="$HOME/data/4-media/multimedia"
|
||||
XDG_NOTES_DIR="$HOME/data/2-box"
|
||||
|
|
|
@ -1,2 +1,2 @@
|
|||
#!/bin/sh
|
||||
find -type d -exec touch {}/.nomedia \;
|
||||
find -type d -printf 'Marking %p\n' -a -exec touch {}/.nomedia \;
|
||||
|
|
|
@ -4,16 +4,29 @@
|
|||
while true
|
||||
do case $1 in
|
||||
(-h|--help|"") echo "Usage: $0 [-q quality (default 85)] [-o outfile] [xRES] <images...>" && exit 2;;
|
||||
(-o) out="$2"; shift 2;;
|
||||
(-q) quality="$2"; shift 2;;
|
||||
(x*) resolution="$1"; resize="-resize $resolution"; shift;;
|
||||
(-o) out="$2"; shift;;
|
||||
(-q) quality="$2"; shift;;
|
||||
(x*) resolution="$1"; resize="-resize $resolution";;
|
||||
(-v) set -x;;
|
||||
(*) break;;
|
||||
esac
|
||||
shift
|
||||
done
|
||||
out="${out:-$1${resolution:--shrinked}.jpg}"
|
||||
magick "$@" -auto-orient -strip \
|
||||
|
||||
process() {
|
||||
out=$1
|
||||
shift
|
||||
magick "$@" -auto-orient -strip \
|
||||
-interlace Plane -define jpeg:dct-method=float -sampling-factor 4:2:0 -gaussian-blur 0.05 \
|
||||
-quality "${quality:-85}" $resize "$out"
|
||||
}
|
||||
if test -n "$out"
|
||||
then process "$out" "$@"
|
||||
else
|
||||
for arg
|
||||
do process "${arg}${resolution:--shrinked}.jpeg" "$arg"
|
||||
done
|
||||
fi
|
||||
printf "Shrinked $1(%s) to $out(%s) - reduced to %s%%\n" \
|
||||
$(stat --format %s "$1" "$out" | numfmt --to=iec-i --suffix=B) \
|
||||
$(stat --format %s "$out" "$1" | sed 'N;s|\n|*100/|' | bc)
|
||||
|
|
|
@ -0,0 +1,14 @@
|
|||
#!/bin/sh
|
||||
temp=$(mktemp)
|
||||
target=$(pass app/voidcat)
|
||||
for arg; do
|
||||
echo "Uploading $arg"
|
||||
{ curl --progress-bar -X POST \
|
||||
-H "V-Content-Type: $(file --mime-type -b $1)" \
|
||||
-H "V-Full-Digest: $(sha256sum -bz $1 | cut -d' ' -f1)" \
|
||||
-H "V-Filename: $arg" \
|
||||
-H "Authorization: Bearer $(echo "$target" | head -1)" \
|
||||
--data-binary @$arg \
|
||||
$(echo "$target" | tail -1); echo; } | tee -a $temp
|
||||
done
|
||||
test $# -gt 1 && echo && cat $temp | sed 's|http:|https:|'
|
Loading…
Reference in New Issue