xw.ai

COPY STEALTH PNG INFO TO EAGLE NOTES FIELD

Requires exiftool

Notes: Eagle must be running with the library the files belong to open when you run this script, otherwise Eagle will overwrite your changes to the sidecar .json files upon next launch. This script will not work on files uploaded to websites/platforms that strip metadata out of images, since it relies on reading and copying Exif data.

1
2
3
4
5
6
7
8
9
10
11
#!/bin/bash

array= # YOUR PATHS LIST HERE #                      # Set variable "array" to your files' paths, delimited by quotes and spaces: "/path/to/file1.ext" "/path/to/file2.ext" ... "/path/to/file_n.ext"
eval "arr=($array)"                                  # Set array "arr" to contents of variable "array", this removes quotes and uses space as a delimiter
for s in "${arr[@]}"; do 
    comment=$(exiftool -s -s -s -Comment  "$s")      # Writes EXIF Comment field for selected file to variable
    comment="${comment//\"/\\\"}"                    # Uses bash parameter expansion to replace all instances of " with \" in variable comment so the Eagle .json does not get corrupted
    sed "s/\"annotation\":\"/\"annotation\":\"$(echo "$comment" | sed -e 's/[\/&]/\\&/g')/" "${s%\/*}"/metadata.json > "${s%\/*}"/metadatanew.json # Uses sed to replace information in the sidecar metadata.json file
    rm "${s%\/*}"/metadata.json                      # deletes original metadata.json
    mv "${s%\/*}"/metadatanew.json "${s%\/*}"/metadata.json # renames metadatanew.json to metadata.json
done
Edit
Pub: 02 Dec 2023 12:28 UTC
Update: 02 Dec 2023 12:53 UTC
views: 64

New· How· IP.IM· Ai Writer· Contact· Issue

Text.is - Markdown Pastebin.