Documentation
¶
Overview ¶
Package indexer implements the core photo indexing engine with concurrent processing.
It extracts EXIF metadata, generates aspect-ratio-preserving thumbnails, analyzes color palettes, computes perceptual hashes, and infers additional metadata like time of day and season. The engine uses a worker pool pattern for parallel file processing and guarantees read-only access to photo files.
Index ¶
- Constants
- func AreSimilar(hash1, hash2 string, threshold int) (bool, error)
- func ColourDistance(c1, c2 models.Colour) float64
- func ComputePerceptualHash(img image.Image) (string, error)
- func DecodeRaw(path string) (image.Image, error)
- func ExportPerfStatsJSON(filename string, summary models.PerfSummary, detailed []models.PerfStats) error
- func ExtractColourPalette(img image.Image, numColours int) ([]models.DominantColour, error)
- func ExtractEmbeddedJPEG(path string) (image.Image, error)
- func ExtractMetadata(filePath string) (*models.PhotoMetadata, error)
- func FromStandardColour(c color.Color) models.Colour
- func GenerateThumbnails(filePath string) (map[models.ThumbnailSize][]byte, error)
- func GenerateThumbnailsFromImage(img image.Image) (map[models.ThumbnailSize][]byte, error)
- func HSLToRGB(hsl models.ColourHSL) models.Colour
- func HammingDistance(hash1, hash2 string) (int, error)
- func InferMetadata(metadata *models.PhotoMetadata)
- func IsRawSupported() bool
- func PrintPerfStats(summary models.PerfSummary, detailed []models.PerfStats)
- func ToStandardColour(c models.Colour) color.Color
- type BurstDetector
- type BurstGroup
- type Engine
- func (e *Engine) Close() error
- func (e *Engine) EnablePerfTracking()
- func (e *Engine) GetPerfStats() []models.PerfStats
- func (e *Engine) GetPerfSummary() models.PerfSummary
- func (e *Engine) GetStats() models.IndexStats
- func (e *Engine) IndexDirectory(rootPath string) error
- func (e *Engine) SetProgressCallback(callback ProgressCallback)
- type Photo
- type ProgressCallback
Constants ¶
const LibRawImpl = "inokone/golibraw"
LibRawImpl identifies which library implementation is in use
Variables ¶
This section is empty.
Functions ¶
func AreSimilar ¶
AreSimilar checks if two images are similar based on their perceptual hashes threshold defines the maximum Hamming distance for similarity Common thresholds:
0-5: Identical/near-identical 6-10: Very similar 11-15: Similar (burst variations) 16-20: Somewhat similar 21+: Different
func ColourDistance ¶
ColourDistance calculates the Euclidean distance between two colours in RGB space
func ComputePerceptualHash ¶
ComputePerceptualHash computes a perceptual hash (pHash) for an image
func DecodeRaw ¶
DecodeRaw attempts to decode a RAW image file using LibRaw (inokone/golibraw) Returns image.Image on success, error on failure
func ExportPerfStatsJSON ¶
func ExportPerfStatsJSON(filename string, summary models.PerfSummary, detailed []models.PerfStats) error
ExportPerfStatsJSON exports detailed performance statistics to a JSON file
func ExtractColourPalette ¶
ExtractColourPalette extracts the dominant colours from an image
func ExtractEmbeddedJPEG ¶
ExtractEmbeddedJPEG extracts the embedded JPEG preview from a DNG file DNG files (which are TIFF-based) often contain embedded JPEG previews This function finds the LARGEST valid embedded JPEG (best quality)
func ExtractMetadata ¶
func ExtractMetadata(filePath string) (*models.PhotoMetadata, error)
ExtractMetadata extracts EXIF metadata using the exif-go library
func FromStandardColour ¶
FromStandardColour converts color.Color to models.Colour
func GenerateThumbnails ¶
func GenerateThumbnails(filePath string) (map[models.ThumbnailSize][]byte, error)
GenerateThumbnails generates multiple thumbnail sizes from an image file Each thumbnail preserves aspect ratio with longest edge constrained to the specified size
func GenerateThumbnailsFromImage ¶
GenerateThumbnailsFromImage generates thumbnails from an already-decoded image
func HammingDistance ¶
HammingDistance calculates the Hamming distance between two perceptual hashes
func InferMetadata ¶
func InferMetadata(metadata *models.PhotoMetadata)
InferMetadata adds inferred metadata based on extracted EXIF data
func IsRawSupported ¶
func IsRawSupported() bool
IsRawSupported returns true if LibRaw support is compiled in
func PrintPerfStats ¶
func PrintPerfStats(summary models.PerfSummary, detailed []models.PerfStats)
PrintPerfStats outputs performance statistics in a human-friendly, machine-readable format
Types ¶
type BurstDetector ¶
type BurstDetector struct {
// contains filtered or unexported fields
}
BurstDetector detects burst photo sequences
func NewBurstDetector ¶
func NewBurstDetector(db *database.DB) *BurstDetector
NewBurstDetector creates a new burst detector with default settings
func (*BurstDetector) DetectBursts ¶
func (bd *BurstDetector) DetectBursts() ([][]int, error)
DetectBursts finds all burst sequences in the database
func (*BurstDetector) GetAllBursts ¶
func (bd *BurstDetector) GetAllBursts() ([]BurstGroup, error)
GetAllBursts retrieves all burst groups from the database
func (*BurstDetector) GetBurstStats ¶
func (bd *BurstDetector) GetBurstStats() (int, int, error)
GetBurstStats returns statistics about detected bursts
func (*BurstDetector) SaveBursts ¶
func (bd *BurstDetector) SaveBursts(bursts [][]int) error
SaveBursts saves detected burst groups to the database
type BurstGroup ¶
BurstGroup represents a detected burst group
type Engine ¶
type Engine struct {
// contains filtered or unexported fields
}
Engine is the main indexer engine
func (*Engine) EnablePerfTracking ¶
func (e *Engine) EnablePerfTracking()
EnablePerfTracking enables detailed performance tracking
func (*Engine) GetPerfStats ¶
GetPerfStats returns the collected performance statistics
func (*Engine) GetPerfSummary ¶
func (e *Engine) GetPerfSummary() models.PerfSummary
GetPerfSummary returns the aggregate performance summary
func (*Engine) GetStats ¶
func (e *Engine) GetStats() models.IndexStats
GetStats returns the current indexing statistics
func (*Engine) IndexDirectory ¶
IndexDirectory recursively indexes all DNG files in a directory
func (*Engine) SetProgressCallback ¶
func (e *Engine) SetProgressCallback(callback ProgressCallback)
SetProgressCallback sets the progress callback function
type Photo ¶
type Photo struct {
ID int
FilePath string
DateTaken time.Time
CameraMake string
CameraModel string
FocalLength float64
}
Photo represents a photo for burst detection
type ProgressCallback ¶
type ProgressCallback func(processed, total int)
ProgressCallback is called with progress updates