How to find out the albums a photo is in? - AppleScript working under Photos 6 on macOS 11 Big Sur
Photos for Mac offers "Show in All Photos" for the currently selected photo, but has no tools to find all albums, that contain that currently selected photo.
Solution for Photos 6 on macOS 11 Big Sur:
- 👍 I hereby confirm that How to find out the albums a photo is in: Catalina Version of a Script by Jacques Rioux still works.
- ⚠️ But bear in mind executing the script can take quite a while, as it does a costly query! Long recursive query I assume.
- ℹ️ In my large library {260 GB total, 44000 photos, 2500 videos, ca 500 albums (estimated, not counted) } on a MacBook Pro 15' (Mid 2014) it takes around 1-2 minutes on each invocation, that is querying just "In which albums is this selected photo?". So use wisely and sparingly.
Details on the script performance — Formats is mm:ss.fraction
1) Started Photos apps, selected image, ran script the first time.
Took quite some time, but came to a result.
2) Second invocation.
This time I wanted to take some numbers.
Searched for image. Was found in 6 albums.
Accumulated CPU time:
CPU time Photos.app = 1:36.08 = 19:50.71 - 18:14.63
CPU time photoanalysisd = 26.33 = 17:25.62 - 16:59.29
CPU time AppleScript = 7.99
CPU time photolibraryd = 0.02 = 04:22.71 - 04:22.69 = Defacto nothing happened.
The total execution time is more/less the time of the process which takes longest, so 1m36s.
3) Third invocation. Photos.app remained open til now.
Searched for image. Was found in 5 albums.
Wanted to see whether the next invocation is "cheaper", whether some stats/objects remain cached.
CPU time Photos.app = 1:10.36 = 20:13.46 - 21:23.82
CPU time photoanalysisd = 17.18 = 00:18:29.58 - 00:18:12.40
CPU time AppleScript = 8.11
CPU time photolibraryd = 0.01 = 04:22.74 - 04:22.75 = Defacto nothing happened.
Seems a bit faster. But not significantly faster. Maybe the difference simply comes due to the fact that it was found in 5 instead of 6 albums, I did not study the code. But the ratios of total execution times and results are pretty similar: (60m36s) / (60m+10s) = 1.37. 6 results / 5 results = 1.2.
So on my system with my library dimensions it is ca 70-90secs per each image.
MacBook Pro 15″, macOS 11.2