- Implement cleanupDeletedFiles to remove orphaned database records for files no longer on disk
- Add verifyAndRegenerateThumbnail to detect and regenerate missing thumbnails for existing media
- Integrate new cleanup and verification steps into main scanLibrary async function
- Update scan stats to track files removed and thumbnails regenerated
- Enhance error handling to log but not block overall scan progress
- Maintain existing file discovery and processing workflows with new verification layers
- Provide detailed scanning process flow and statistics tracking for improved observability