Compare commits

...

4 Commits

Author SHA1 Message Date
yosh fb8998656c vodarchive: better 2024-01-25 00:44:48 -05:00
yosh 93092ab241 resonite-photoexif: fix 2024-01-25 00:44:20 -05:00
yosh e414df3deb albumsetup: better 2024-01-25 00:44:09 -05:00
yosh 8563ac7049 screenshot: the glaggle fixes 2024-01-25 00:43:51 -05:00
4 changed files with 62 additions and 18 deletions

View File

@ -52,7 +52,6 @@ convert_vid() {
-r 4 \
-b:v 500k \
-c:v libvpx \
-cpu-used -5 \
-deadline realtime \
"$3"
errecho "Successfully converted $2"
@ -73,12 +72,12 @@ extract_cover() {
set -e
# resize within the bounds of 1280x720
# if it's square then make it 722x720 so youtube doesn't make it a short
[ -f "$2" ] && magick mogrify -resize 1280x720 -background black -gravity center -extent 722x720 "$2" || true
[ -f "$2" ] && vipsthumbnail -o "$2" -s '722x720' -c "$2" || true
}
# sets COVER_PIC for use in convert_vid
set_cover() {
COVER_PICTURE="$(mktemp -u)"
COVER_PICTURE="$(mktemp -u -t XXXXXX.png)"
extract_cover "$1" "$COVER_PICTURE"
if [ -f "$COVER_PICTURE" ]; then
:
@ -114,8 +113,8 @@ shift "$((OPTIND - 1))"
mkdir -p "$OUTDIR"
# default cover image, fallback if tracks don't have embedded art
DEFAULT_PICTURE="$(mktemp -u)"
magick convert "$tmpcover" -resize 1280x720 -background black -gravity center -extent 722x720 "$DEFAULT_PICTURE"
DEFAULT_PICTURE="$(mktemp -u -t XXXXXX.png)"
vipsthumbnail -o "$DEFAULT_PICTURE" -s '722x720' -c "$tmpcover"
# copy audio codec if opus since output codec is opus
[ "$EXT" = "opus" ] && acopy="-c:a copy"

View File

@ -26,7 +26,9 @@ for resrec; do
# asset uri stuff
asseturi="$(jq -r '.assetUri | sub("resdb:///(?<x>[^.]+).*";"https://assets.resonite.com/\(.x)")' < "$tmp_recuri")"
tmp_json="$(mktemp)"
curl -s "$asseturi" | tail -c +10 | brotli -d | bson2 print > "$tmp_json"
# TODO: suck it up and make my own fucking bson->json thing so I can make this actually good
# for now this works. ew.
curl -s "$asseturi" | tail -c +10 | brotli -d | bson2 print | tr -d '\n' > "$tmp_json"
# save the image itself
imguri="$(jq -r '.Object.Children[0].Components.Data.[] |
@ -90,5 +92,5 @@ Present Users: $meta_presentusers" "$tmpfile" \
done
# note: when converting to png then jxl, sometimes tags get fucked up. do this
# alternatively: use vips pngsave instead of imagemagick
# for i in *.jxl; do exiftool -tagsfromfile "${i%.jxl}.webp" -usercomment -datetimeoriginal -m "$i"; done

View File

@ -12,20 +12,35 @@ clean() {
}
save() {
case "${1##*(}" in
png) oxipng -o max "$tmpfp" && mv "$tmpfp" "$OUTFILE.png" ;;
jxl) cjxl "$tmpfp" -d 0.0 "$OUTFILE.jxl" ;;
case "$1" in
*png*) oxipng -o max "$tmpfp" && mv "$tmpfp" "$OUTFILE.png" ;;
*jxl*) cjxl "$tmpfp" -d 0.0 "$OUTFILE.jxl" ;;
*) exit 0 ;;
esac
notify-send -u low "$OUTFILE"
exit 0
}
upload() {
case "$1" in
litterbox*)
time="${1##* }"
url=$(curl -F "reqtype=fileupload" -F "time=$time" -F "fileToUpload=@$tmpfp" 'https://litterbox.catbox.moe/resources/internals/api.php')
;;
owo) url=$(owo -u "$tmpfp") ;;
*) return ;;
esac
[ -n "$url" ] && notify-send -u low "$url" && $clip_cmd <<-EOF
$url
EOF
[ $? -ne 0 ] && notify-send -u low "ERROR! Not uploaded or something ! uh oh"
}
choose() {
while true; do
c="$(printf "save (jxl)\nsave (png)\nedit\nupload\nscan" | $MENU)"
c="$(printf 'save (jxl)\nsave (png)\npreview\nedit\nupload\nscan' | $MENU)"
case "$c" in
save*) save "${c%)}" ;;
save*) save "$c" ;;
edit) eval "$editor"' "$tmpfp"' ;;
scan)
zdata="$(zbarimg -1 "$tmpfp")" || zdata="error: scan failed with exit code $?"
@ -33,7 +48,15 @@ choose() {
$TERMINAL -e sh -c 'printf "%s\n" "${zdata#*:}" | less' &
printf '%s\n' "${zdata#*:}"
;;
*) break ;;
upload)
set +e
upload "$(printf 'owo\nlitterbox 1h\nlitterbox 12h\nlitterbox 24h\nlitterbox 72h\n' | $MENU)"
set -e
;;
preview)
"$image_viewer" "$tmpfp" &
;;
*) break ;;
esac
done
}
@ -52,7 +75,9 @@ case "${XDG_SESSION_TYPE:-}" in
wayland)
editor='swappy -o "$tmpfp" -f'
freeze_img="swayimg -g 0,0,1920,1080"
image_viewer="nsxiv"
freeze_cmd="grim -l 0"
clip_cmd="wl-copy"
ss() {
if [ -n "$REGION" ]; then
reg="$(slurp -f '%x,%y %wx%h')" || return 1
@ -64,7 +89,9 @@ case "${XDG_SESSION_TYPE:-}" in
*)
editor='gimp -n'
freeze_img="nsxiv -b -N SCREENSHOT_FREEZE"
image_viewer="nsxiv"
freeze_cmd="shotgun"
clip_cmd="xclip -sel clipboard"
ss() {
if [ -n "$REGION" ]; then
reg="$(hacksaw -f '-i %i -g %g')" || return 1

View File

@ -1,9 +1,25 @@
#!/bin/sh
set -euf
filename="$(yt-dlp -O '%(upload_date>%Y-%m-%d)s %(title)s.%(ext)s' "$1")"
yt-dlp -o "$filename" "$1"
for ext in json html txt; do
twitchdownloader chatdownload -o "${filename%.*}.$ext" -u "$1"
while getopts :vcq: OPT; do
case "$OPT" in
v) novod=1 ;;
c) nochat=1 ;;
q) quality=$OPTARG ;;
*) exit 1 ;;
esac
done
shift $((OPTIND - 1))
for url; do
filename="$(yt-dlp -O '%(upload_date>%Y-%m-%d)s %(title)s.%(ext)s' "$url")"
if [ -z "${novod:-}" ]; then
yt-dlp ${quality:+-f "$quality"} -o "$filename" "$url"
fi
if [ -z "${nochat:-}" ]; then
for ext in json html txt; do
twitchdownloader chatdownload -o "${filename%.*}.$ext" -u "$url"
done
fi
done