diff options
author | Přemysl Eric Janouch <p@janouch.name> | 2023-03-15 03:31:30 +0100 |
---|---|---|
committer | Přemysl Eric Janouch <p@janouch.name> | 2023-03-15 05:52:32 +0100 |
commit | 796b05c9a5f04aba87e26c5a8384d84edee20b77 (patch) | |
tree | 74b1dbda5521bb39bcf9215c3e884499fca215d2 /fiv-reverse-search | |
parent | 9286858573ef5e430ac2fb24c274a6fcd41a1edd (diff) | |
download | fiv-796b05c9a5f04aba87e26c5a8384d84edee20b77.tar.gz fiv-796b05c9a5f04aba87e26c5a8384d84edee20b77.tar.xz fiv-796b05c9a5f04aba87e26c5a8384d84edee20b77.zip |
Integrate online reverse image search
This makes use of our image processing capabilities in order to
turn arbitrary image files into normalized thumbnails,
upload them to a temporary host, and pass the resulting URI
to a search provider.
In future, fiv should ideally run the upload itself,
so that its status and any errors are obvious to the user,
as well as to get rid of the script's dependency on jq.
Diffstat (limited to 'fiv-reverse-search')
-rwxr-xr-x | fiv-reverse-search | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/fiv-reverse-search b/fiv-reverse-search new file mode 100755 index 0000000..5210703 --- /dev/null +++ b/fiv-reverse-search @@ -0,0 +1,9 @@ +#!/bin/sh -e +if [ "$#" -ne 2 ]; then + echo "Usage: $0 SEARCH-ENGINE-URI-PREFIX {PATH | URI}" >&2 + exit 1 +fi + +xdg-open "$1$(fiv --thumbnail-for-search large "$2" \ + | curl --silent --show-error --upload-file - https://transfer.sh/image \ + | jq --slurp --raw-input --raw-output @uri)" |