Compare commits

...

5 Commits

Author SHA1 Message Date
yosh 997efef64a twitch-vodarchive: add 2023-11-07 19:04:14 -05:00
yosh 873ef1fe32 resonite-photoexif: add 2023-11-07 19:04:04 -05:00
yosh 0ee7312993 stranslate: new default instance 2023-10-24 00:22:16 -04:00
yosh dc521cfe66 discogarchive: fix new data from bandcamp 2023-10-24 00:22:05 -04:00
yosh 5d9fc46e4d ff wrapper scripts: vmaf and rename moov 2023-10-24 00:21:48 -04:00
6 changed files with 126 additions and 3 deletions

View File

@ -73,11 +73,11 @@ for type in album track; do
curl -L -s -o - "$url" | pup 'script[type="application/ld+json"]' 'text{}' > "$json" || continue
artist="$(jq -r '.byArtist.name' < "$json")"
name="$(jq -r '.name' < "$json")"
if [ "$(jq '.numTracks' < "$json")" = "0" ]; then
if [ "$(jq '.numTracks' < "$json")" = "0.0" ]; then
look_closer="<a href=\"$url\" rel=\"nofollow\">$artist - $name</a><br>$NL$look_closer"
errecho "LOOK CLOSER: $url"
tmplog="$tmplog$url LOOK_CLOSER$NL"
elif [ "$(jq 'if (.inAlbum) then .inAlbum.albumRelease[0].offers.price else .albumRelease[0].offers.price end' < "$json")" = "0" ]; then
elif [ "$(jq 'if (.inAlbum) then .inAlbum.albumRelease[0].offers.price else .albumRelease[0].offers.price end' < "$json")" = "0.0" ]; then
eval 'contained_'"$type"'s="<a href=\"$url\" rel=\"nofollow\">$artist - $name</a><br>${NL}${contained_'"$type"'s}"'
errecho "CONTAINED $type: $artist - $name"
tmplog="$tmplog$url CONTAINED$NL"

19
ffvmaf Executable file
View File

@ -0,0 +1,19 @@
#!/bin/sh
set -ef
while getopts :s:t:T: OPT; do
case "$OPT" in
s) start="$OPTARG" ;;
t) time="$OPTARG" ;;
T) to="$OPTARG" ;;
*) : ;
esac
done
shift $((OPTIND - 1))
exec ffmpeg ${start:+-ss "$start"} ${to:+-to "$to"} \
-i "$1" -i "$2" ${time:+-t "$time"} \
-lavfi "[0:v] setpts=PTS-STARTPTS [ref]; \
[1:v] setpts=PTS-STARTPTS [dis]; \
[dis][ref] libvmaf=log_fmt=xml:log_path=/dev/stdout:n_threads=$(nproc)" \
-f null - \

95
resonite-photoexif Executable file
View File

@ -0,0 +1,95 @@
#!/bin/sh
set -euf
# $@ are resrec urls to things
cleanup() {
[ -f "${tmp_recuri:-}" ] && rm "$tmp_recuri"
[ -f "${tmp_json:-}" ] && rm "$tmp_json"
[ -f "${tmp_json2:-}" ] && rm "$tmp_json2"
[ -f "${tmpfile:-}" ] && rm "$tmpfile"
true
}
trap 'cleanup' INT HUP QUIT EXIT
outdir="$HOME/pics/screenshots/Resonite"
for resrec; do
cleanup
resrec="${resrec#resrec:///}"
recuri="https://api.resonite.com/users/${resrec%%/*}/records/${resrec##*/}"
tmp_recuri="$(mktemp)"
curl -s -o "$tmp_recuri" "$recuri"
# 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"
# save the image itself
imguri="$(jq -r '.Object.Children[0].Components.Data.[] |
select(.Type=="FrooxEngine.StaticTexture2D").Data.URL.Data |
sub("@resdb:///(?<x>[^.]+).*";"https://assets.resonite.com/\(.x)")' \
< "$tmp_json"
)"
timestamp="$(jq -r '.tags[] | select(contains("timestamp:")) |
sub("timestamp:(?<d>[^T]+)T(?<h>[^:]+):(?<m>[^:]+):(?<s>[^.]+).*";"\(.d)_\(.h)-\(.m)-\(.s)")' \
< "$tmp_recuri"
)"
[ -z "$timestamp" ] && timestamp="$(jq -r '.creationTime | sub("$(?<d>[^T]+)T(?<h>[^:]+):(?>,>[^:]+):(?<s>[^.]+).*";"\(.d)_\(.h)-\(.m)-\(.s)")' < "$tmp_recuri")"
echo "downloading image $timestamp.webp"
tmpfile="$(mktemp)"
curl -s -o "$tmpfile" "$imguri"
outfile="$outdir/$timestamp.webp"
if [ -f "$outfile" ]; then
if cmp -s "$tmpfile" "$outfile"; then
echo "Duplicate file, not saving"
continue
else
echo "WARNING: filename exists in 1st pass, making unique name as safeguard"
outfile="${outfile%.webp}_$(uuidgen).webp"
fi
fi
# check if photometadata even exists
if [ "$(jq '.TypeVersions."FrooxEngine.PhotoMetadata"' < "$tmp_json")" = "null" ]; then
echo "no photometadata"
else
# if it does, we're in business
tmp_json2="$(mktemp)"
jq '.Object.Children[0].Components.Data.[] | select(.Type=="FrooxEngine.PhotoMetadata")' "$tmp_json" > "$tmp_json2"
meta_time="$(date -u -d "@$(jq -r '.Data.TimeTaken.Data | sub("{\\$date: (?<x>[0-9]+)[0-9][0-9][0-9]}"; "\(.x)")' < "$tmp_json2")" +'%Y:%m:%d %H:%M:%S')"
meta_host="$(jq -r '.Data.LocationHost._userId.Data' < "$tmp_json2")"
meta_place="$(jq -r '.Data.LocationName.Data | gsub("<[^<]+>";"")' < "$tmp_json2")"
meta_photographer="$(jq -r '.Data.TakenBy._userId.Data' < "$tmp_json2")"
meta_presentusers="$(jq -r '[.Data.UserInfos.Data[].User._userId.Data] | @tsv | gsub("\t";", ")' < "$tmp_json2")"
exiftool -overwrite_original -UserComment="World: $meta_place
Host: $meta_host
Photographer: $meta_photographer
Present Users: $meta_presentusers" "$tmpfile" \
-datetimeoriginal="$meta_time"
# outfile will be in yyyy-mm-dd_hh-mm-ss, UTC TIME!!!
outfile="$outdir/$(printf '%s' "$meta_time" | sed -e 's/:/-/g' -e 's/ /_/g').webp"
if [ -f "$outfile" ]; then
if cmp -s "$tmpfile" "$outfile"; then
echo "WARNING: Duplicate file after 2nd pass, not saving"
continue
else
outfile="${outfile%.webp}_$(uuidgen).webp"
fi
fi
fi
mv "$tmpfile" "$outfile"
done
# note: when converting to png then jxl, sometimes tags get fucked up. do this
# for i in *.jxl; do exiftool -tagsfromfile "${i%.jxl}.webp" -usercomment -datetimeoriginal -m "$i"; done

View File

@ -1,7 +1,7 @@
#!/bin/sh
# DEFAULT OPTIONS
INSTANCE="https://translate.tiekoetter.com/"
INSTANCE="https://translate.slipfox.xyz"
ENGINE="google"
FLANG="auto"
TLANG="en"

9
twitch-vodarchive Executable file
View File

@ -0,0 +1,9 @@
#!/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"
done