|
|
@@ -0,0 +1,25 @@ |
|
|
|
#!/usr/bin/env bash |
|
|
|
|
|
|
|
set -eu -o pipefail |
|
|
|
|
|
|
|
# e.g. ~/stash/YouTube/whitehouse |
|
|
|
root=$1 |
|
|
|
|
|
|
|
es x find -t f -- "$root" | take-wanted-ids ~/dead-video-ids | rg '\.(mp4|webm|flv|video)$' | while read i; do |
|
|
|
echo $i |
|
|
|
eye_path=$(path-to-eye-path "$i" | sed -r "s,$HOME/stash/,,g") |
|
|
|
file_id=$(es x info -- "$i" | jq .id) |
|
|
|
size=$(es x info -- "$i" | jq .size) |
|
|
|
|
|
|
|
# If already in namedfiles i.e. the-eye, skip |
|
|
|
es x info -- "$i" | rg -q -F '"type": "namedfiles"' && continue || true |
|
|
|
|
|
|
|
( |
|
|
|
es x get "$i" && \ |
|
|
|
rclone --inplace --size-only --progress copyto "$i" "jeff:$eye_path" && \ |
|
|
|
curl --fail-with-body -u "ya: ." -X POST -d "{\"file_id\": $file_id, \"location\": \"the-eye\", \"pathname\": \"$eye_path\"}" https://ya.borg.xyz/cgi-bin/new-namedfiles && \ |
|
|
|
curl -X POST -d "{\"the_eye_any_bytes_saved\": $size, \"the_eye_video_bytes_saved\": $size, \"the_eye_any_files_saved\": 1, \"the_eye_video_files_saved\": 1}" "http://127.0.0.1:31416/metrics" && \ |
|
|
|
) || true & |
|
|
|
|
|
|
|
wait-until-jobs-below 9 |
|
|
|
done |