RhetTbull / osxphotos

Python app to work with pictures and associated metadata from Apple Photos on macOS. Also includes a package to provide programmatic access to the Photos library, pictures, and metadata.
MIT License
1.81k stars 94 forks source link

Add analysis dates to PhotoInfo #1494

Open RhetTbull opened 2 months ago

RhetTbull commented 2 months ago

See below and at this thread for more details on attributes to include.

@Conzpiral I'm not 100% certain this will do the trick but I think it's a good start. When the photo analysis process runs on a photo it updates a date stamp of when the analysis took place. OSXPhotos doesn't provide a way to directly access this but it can be queried using the tables() method which lets you access the underlying database tables. The following will run very slowly as it's got to run a query for every single photo in the library but it will find all photos that have not been analyzed. You can add --count just to see the total count or --add-to-album "Album name" to add the found photos to a given album.

osxphotos query --not-shared --query-eval "not photo.shared_moment" --query-eval "photo.tables().ZASSET.ZANALYSISSTATEMODIFICATIONDATE[0] is None"

The --not-shared and --query-eval "not photo.shared_moment" exclude images from shared albums and shared moments (photos shared as a group via Messages) which won't be analyzed.

If this doesn't give a result close to what you're expecting let me know and I'll dig further.

Originally posted by @RhetTbull in https://github.com/RhetTbull/osxphotos/discussions/1487#discussioncomment-9027635