v0.2.0: semaphore timeouts, error logging, dead code removal, parallel exports
Critical: - Replace DISPATCH_TIME_FOREVER with 120s/30s timeouts in ObjC - Log failed asset IDs and error messages in cmdExport/backupTree - Show failed count in export summaries Cleanup: - Remove legacy Bridge methods (ExportAlbumPreviews, ExportAlbumOriginals, BackupAll) - Remove legacy ObjC functions and C stub equivalents - Remove photos.go delegates (package-level pass-throughs) - Remove InterpretExportResult (only used by legacy methods) - Clean up mockBridge fields (rename Fn2 -> Fn) - Fix rc race condition in main_main.go (atomic.Int32) - Remove unused variables (_ = grandTotal, _ = sig) Design: - Fix resolveAlbumID: ListAlbums first (cheap), then direct ID - Unify Cloud type: Asset.Cloud string (was bool) - Extract shared export logic into exportAssets/exportOne - Add worker pool for parallel exports (3 workers when assets >= 4) - Fix backupTree progress bar counter and directory prefix Robustness: - Add nil checks for stringWithUTF8String: in ObjC - Log directory creation errors in ensure_directory (ObjC) Quality: - Add go vet and -race flag to Makefile test target - Add ADR for performSelector cloudIdentifier decision - Add sync comments between Go/ObjC sanitizePathComponent - Add package-level doc comment - Add tests: partial failure, skipped album, album-not-found message
This commit is contained in:
@@ -1,36 +1,8 @@
|
||||
// Package photos provides a Go bridge to Apple's PhotoKit framework via CGo,
|
||||
// enabling programmatic access to photos, albums, and export operations.
|
||||
package photos
|
||||
|
||||
import "fmt"
|
||||
|
||||
var errAccessDenied = fmt.Errorf("photos access denied: grant Full Disk Access or Photos permission in System Settings > Privacy & Security")
|
||||
var errBridgeNil = fmt.Errorf("bridge returned nil")
|
||||
|
||||
func RequestAccess() error { return DefaultBridge.RequestAccess() }
|
||||
|
||||
func ListAlbums() ([]Album, error) { return DefaultBridge.ListAlbums() }
|
||||
|
||||
func ListAssets(albumID string) ([]Asset, int, error) { return DefaultBridge.ListAssets(albumID) }
|
||||
|
||||
func ListTree() ([]CollectionNode, error) { return DefaultBridge.ListTree() }
|
||||
|
||||
func ExportAlbumPreviews(albumID, outputDir string, targetSize int) (int, error) {
|
||||
return DefaultBridge.ExportAlbumPreviews(albumID, outputDir, targetSize)
|
||||
}
|
||||
|
||||
func ExportAlbumOriginals(albumID, outputDir string) (int, error) {
|
||||
return DefaultBridge.ExportAlbumOriginals(albumID, outputDir)
|
||||
}
|
||||
|
||||
func BackupAll(outputDir string, targetSize int, originals bool) (int, error) {
|
||||
return DefaultBridge.BackupAll(outputDir, targetSize, originals)
|
||||
}
|
||||
|
||||
func Cancel() { DefaultBridge.Cancel() }
|
||||
|
||||
func ExportPreview(assetID, outputDir string, targetSize, index int) (ExportResult, error) {
|
||||
return DefaultBridge.ExportPreview(assetID, outputDir, targetSize, index)
|
||||
}
|
||||
|
||||
func ExportOriginal(assetID, outputDir string, index int) (ExportResult, error) {
|
||||
return DefaultBridge.ExportOriginal(assetID, outputDir, index)
|
||||
}
|
||||
var errBridgeNil = fmt.Errorf("bridge returned nil")
|
||||
Reference in New Issue
Block a user