How sachsahu21/photo works
This repository is a versioned monorepo for a local-first photo/video scanner. Each release folder (v1 through v6.2) is a mostly self-contained application with its own main.py, config.yaml, src/, and usually tests/ plus an optional web/ Streamlit UI. The code in z.old_code/ is archival; the actively documented baseline is v4.0, while later folders (v5.x, v6.2) extend the same pipeline with persistence, face indexing, and stronger checkpointing.
The primary runtime boundary is the local filesystem. The app scans user-selected folders on disk, not a hosted backend. Cloud-backed folders are treated as local sync targets, so OneDrive/cloud behavior is an operational concern rather than a separate service architecture.
The main entry point in each release is main.py, which drives an interactive CLI workflow. In v4.0, this CLI orchestrates scan/extract, resume-from-backup, deletion-by-workbook, and organization actions. A separate web/streamlit_app.py exists in newer releases as an optional dashboard layered on top of the same core modules.
Configuration is centralized in config.yaml and loaded through config_manager.py. This file defines scan scope, recursion, thread count, blur threshold, duplicate settings, and output locations. That configuration layer is the main control boundary for how the pipeline behaves across releases.
The core data flow starts with scanner.py, which walks the filesystem and extracts image/video metadata. Supporting modules such as video_metadata.py, cloud_scanner.py, and geocoder.py enrich records with media-specific details, GPS-derived location data, and cloud/folder-source handling where enabled. The scanner produces record objects that become the canonical in-memory dataset for downstream analysis.
Processing is often parallelized. parallel_processor.py provides the worker-pool layer, while checkpoint_manager.py and, in later versions, global_checkpoint.py preserve progress so long scans can resume safely. This makes scan-and-analyze a resumable batch pipeline rather than a single monolithic run.
Analysis is split into focused subsystems. blur_detector.py scores image sharpness, duplicate_handler.py groups identical files and selects the best copy, and similar_detector.py handles near-duplicate comparisons in later releases. Additional enrichment modules include face_detector.py and face_indexer.py for people detection/indexing, image_clusterer.py for grouping, auto_tagger.py for automated labels, and thumbnail_generator.py for preview assets.
The reporting boundary is explicit. excel_writer.py produces the multi-sheet workbook used for review and, in some workflows, deletion decisions. Later releases add generate_report.py, analytics.py, and comparison_generator.py to build summary views and side-by-side comparison artifacts. Backups such as records-backup.pkl and record-store modules in v5+ make the scanned dataset durable across runs.
File mutation is isolated in organizer.py, which copies or moves assets into date-based folder structures, and vault_maintenance.py, which handles cleanup and repository-specific housekeeping in later versions. people_sync.py and metadata reconciliation modules in v5+ keep derived metadata aligned with file organization changes.
The repository also contains a small quality layer: tests/ focuses on scanner and blur logic, with additional pipeline tests in later versions such as test_face_pipeline.py. There are also run/test helpers like run_full_test.py and a notebook (image_scan.ipynb), but these are supporting assets rather than primary runtime components.
For an architecture diagram, the most important boxes are: local filesystem input, config-driven scan engine, parallel enrichment/analysis, checkpoint/resume state, report/output generation, and optional organization/mutation. The versioned folders should be shown as evolving snapshots of the same product line, not as independent services.
Main entry points: parallel_processor.py Workers · main.py CLI entry · scanner.py Scanner · metadata_store.py Metadata store
Components 23
Inputs & control
Local filesystem sources and config-driven behavior
- Local files · User-selected folders on disk; the primary runtime boundary
- Config · Centralized scan and processing settings loaded from config.yaml
v4.0/config.yaml
Core pipeline
Scan, enrich, analyze, and mutate photo/video records
- CLI entry · Interactive command-line entrypoint for each release
v4.0/main.py - Scanner · Walks folders and builds canonical media records
v4.0/src/scanner.py - Media meta · Extracts video and file-level metadata for records
v4.0/src/video_metadata.py - Cloud scan · Treats synced cloud folders as local scan targets where enabled
v4.0/src/cloud_scanner.py - Geocoder · Converts GPS metadata into human-readable place data
v4.0/src/geocoder.py - Workers · Worker-pool layer for resumable batch processing
v4.0/src/parallel_processor.py - Checkpoint · Persists scan progress so long runs can resume safely
v4.0/src/checkpoint_manager.py - Blur score · Scores image sharpness and quality
v4.0/src/blur_detector.py - Duplicates · Groups exact duplicates and chooses preferred copies
v4.0/src/duplicate_handler.py - Similarity · Finds near-duplicate media in later releases
v4.0/src/similar_detector.py - Faces · Detects faces and builds people indexes in later releases
v5.0/src/face_indexer.py - Cluster/tag · Clusters media and generates auto-tags
v4.0/src/image_clusterer.py - Thumbnails · Builds preview assets for review workflows
v4.0/src/thumbnail_generator.py - Metadata store · Durable record store and path reconciliation in v5+
v5.0/src/metadata_store.py - Organizer · Copies or moves media into date-based folder structures
v4.0/src/organizer.py - Vault maint. · Cleanup and repository-specific maintenance in later releases
v5.0/src/vault_maintenance.py
Outputs & review
Reports, backups, and optional dashboard
- Workbook · Produces the multi-sheet Excel review workbook
v4.0/src/excel_writer.py - Reports · Higher-level analytics and comparison artifacts in later releases
v5.2/src/generate_report.py - Backup · Serialized record backups for durable recovery between runs
v3.1/records-backup.pkl - Dashboard · Streamlit review UI layered over the same core pipeline
v4.0/web/streamlit_app.py
Legacy archive
Earlier experimental code and historical scripts
- Old code · Historical scripts and earlier scanner generations
z.old_code/v1/main.py
Connections 24
- Local files → Scanner: scan · Scanner walks the selected folders
- Config → CLI entry: load · Configuration drives the CLI workflow
- CLI entry → Scanner: orchestrate · Main entrypoint starts scans and follow-on actions
- CLI entry → Workbook: review · CLI can generate workbook outputs for inspection
- CLI entry → Organizer: mutate · CLI can trigger organization and file moves
- CLI entry → Dashboard: optional · Later releases expose the same core functions through Streamlit
- Scanner → Media meta: enrich · Scanner captures media-specific metadata
- Scanner → Cloud scan: adapt · Cloud-synced folders are handled as local sources
- Scanner → Geocoder: locate · GPS-derived location enrichment
- Scanner → Workers: fan out · Batch work is parallelized for long scans
- Workers → Checkpoint: resume · Progress is checkpointed for safe restarts
- Workers → Blur score: score · Quality scoring runs as part of analysis
- Workers → Duplicates: dedupe · Exact duplicate grouping happens downstream
- Workers → Similarity: compare · Near-duplicate comparison is added in later releases
- Workers → Faces: index · Face detection/indexing extends the analysis pipeline
- Workers → Cluster/tag: group · Media are clustered and auto-tagged
- Workers → Thumbnails: render · Preview assets are generated for review
- Workers → Metadata store: persist · Later releases store records durably across runs
- Metadata store → Backup: snapshot · Record state can be backed up between sessions
- Metadata store → Reports: summarize · Stored records feed analytics and generated reports
- Workbook → Reports: extend · Workbook review evolves into richer reporting artifacts
- Organizer → Vault maint.: clean · Maintenance follows file organization and workspace changes
- Organizer → Metadata store: reconcile · Metadata and paths are reconciled after file moves
- Old code → CLI entry: evolved into · Archived scripts show the earlier generations of the same product