Skip to main content

Module duplicates

Module duplicates 

Source
Expand description

Finding duplicate items: exact copies by content hash, and near copies by a perceptual hash of their thumbnails. See the Import chapter of the docs; Eagle stores no hash in item JSON, so nothing here writes to items.

Structs§

CacheEntry
Cached hashes of one item’s original, valid while its size and mtime stay the same.
HashCache
Hashes keyed by item id, which the caller can keep between runs (it is plain JSON; falcon doesn’t store it in the library).

Functions§

content_hash
BLAKE3 hash of a file’s bytes, as 64 lowercase hex digits.
find_exact_duplicates
Groups of items (not in the trash) whose originals are byte-identical.
find_exact_duplicates_cached
find_exact_duplicates with a cache. Only files that share their size with another file are hashed.
find_exact_duplicates_in
find_exact_duplicates_cached among the items in only (all live items when None), as Eagle scans the selection or the current list.
find_near_duplicates
Groups of items whose pictures’ perceptual hashes are at most threshold bits apart (about 10 suits resized or recompressed copies). Groups are linked transitively.
find_near_duplicates_cached
find_near_duplicates with a cache. Entries are keyed on the original’s size and mtime, like the content hash, since a thumbnail only changes with its original.
find_near_duplicates_in
find_near_duplicates_cached among the items in only; items outside it never link two groups together.
group_close
Links every pair within threshold and returns the connected groups.
hamming
Number of differing bits.
perceptual_hash
A 64-bit perceptual hash (pHash): the image is reduced to 32×32 grey, transformed with a 2-D DCT, and each of the 8×8 lowest frequencies becomes a bit, set when it is above their median (the DC term excluded from the median).