You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
53 lines
1.5 KiB
53 lines
1.5 KiB
#!/bin/bash
|
|
# Copyright (c) 2025 by Robert Strutts
|
|
# License: MIT
|
|
source myenv/bin/activate
|
|
|
|
# Check if the first argument is a directory
|
|
if [ ! -d "$1" ]; then
|
|
echo "Error: '$1' is not a directory."
|
|
exit 1
|
|
fi
|
|
|
|
# Get list of images
|
|
shopt -s nullglob
|
|
pushd "$1" || exit 1
|
|
images=(*.jpg *.png)
|
|
popd || exit 1
|
|
|
|
# Check if we found any images
|
|
if [ ${#images[@]} -eq 0 ]; then
|
|
echo "No images found."
|
|
exit 1
|
|
fi
|
|
|
|
# Outer loop
|
|
for ((i = 0; i < ${#images[@]}; i++)); do
|
|
outer_image="${images[$i]}"
|
|
|
|
# Inner loop (only later images to avoid double-checks)
|
|
for ((j = i + 1; j < ${#images[@]}; j++)); do
|
|
inner_image="${images[$j]}"
|
|
|
|
echo -e "Compairing files: $outer_image TO $inner_image \n"
|
|
python3 dedup.py "$1/$outer_image" "$1/$inner_image"
|
|
exit_code=$?
|
|
if [ $exit_code -eq 1 ]; then
|
|
echo "$1/$outer_image # $inner_image" >> dups.txt
|
|
break # No need to check more once found duplicate
|
|
fi
|
|
if [ $exit_code -eq 2 ]; then
|
|
echo "$1/$outer_image # $inner_image" >> alike.txt
|
|
break # No need to check more once found close match to duplicate
|
|
fi
|
|
if [ $exit_code -eq 5 ]; then
|
|
echo "$1/$outer_image # $inner_image" >> sameGPS.txt
|
|
break # No need to check more once found matching GPS image
|
|
fi
|
|
if [ $exit_code -eq 8 ]; then
|
|
echo "$1/$outer_image # $inner_image" >> invalid.txt
|
|
break # No need to check more once found bad image
|
|
fi
|
|
|
|
done
|
|
done
|
|
|