From 82634ba06c40005bc5fbe68035f40561b9aaafc2 Mon Sep 17 00:00:00 2001 From: Ivan Kozik Date: Sat, 13 Apr 2024 17:01:48 +0000 Subject: [PATCH] sftp-into-eye: don't `es x info` three times --- sftp-into-eye | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/sftp-into-eye b/sftp-into-eye index db8de88..1d3ef06 100755 --- a/sftp-into-eye +++ b/sftp-into-eye @@ -26,8 +26,12 @@ 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) + info=$(es x info -- "$i") + file_id=$(echo "$info" | jq .id) + size=$(echo "$info" | jq .size) + + # If already in namedfiles i.e. the-eye, skip + echo "$info" | rg -q -F '"type": "namedfiles"' && continue || true is_video=0 echo -n "$i" | rg -q '\.(mp4|webm|flv|video)$' && is_video=1 || true @@ -39,9 +43,6 @@ while read i; do the_eye_video_files_saved=1 fi - # If already in namedfiles i.e. the-eye, skip - es x info -- "$i" | rg -q -F '"type": "namedfiles"' && continue || true - # This is mostly a demo which adds it to ceph over SFTP with `rclone`; # ideally we instead have the `es x get -s -- "$i"` step putting it directly into ceph. (