Your script has what looks to be a pretty big inefficiency here[1] that's slowing it down. Looping over a set kills the constant-time presence-checking that you get from using that data structure; it will likely be much faster to do something like this:<p><pre><code> tags = list(set(descr.split()) & categories)
</code></pre>
The following would also work:<p><pre><code> tags = [x for x in descr.split() if x in categories]
</code></pre>
[1]<a href="https://gist.github.com/28mm/9820bd8b6eb27555efe9d6f46dd95a81#file-gistfile1-txt-L97" rel="nofollow">https://gist.github.com/28mm/9820bd8b6eb27555efe9d6f46dd95a8...</a>
> Undoubtedly, launchd can be told to disable photolibraryd, but the approved mechanism wasn’t immediately obvious to me.<p>You want "launchctl unload /System/Library/LaunchAgents/com.apple.photolibraryd.plist".
It's also absolute madness that the native Photos app on iOS will not search the meta-data of the photos, only of the apple-restricted "scene recognition" objects, and dates.<p>Add a description to a photo, search for that description in Photos for iOS, and there will be no results.
This is a major shortcoming of MacOS to those of us who use it heavily for photography. Or even those with large cameraphone libraries.<p>The data is there. It should be available to all applications!
<i>”Instead, I opted for an egregious hack. In order to lock its database, photoslibraryd, need to be able to write to it. I simply removed write permisions.
[…]
Now, it’s possible to open $photodb, and poke around.“</i><p>If photolibraryd has that file open permanently for exclusive access, I think that shouldn’t work; photolibraryd either should keep write rights and others shouldn’t be able to open the file, as long as it has the file open, or you run the risk of database corruption (probably recoverable) when photolibraryd can only write half of what it wants to write (which will happen is, I think, implementation defined because of the existence of NFS)<p>I also think it is unlikely that photolibraryd has code checking for that the file becomes read only ⇒ apparently, photolibraryd periodically reopens that file for writing. If so, one should be able to race it for exclusively opening it.<p>Also, I’m curious. Photos.app must have a way to open that database for writing. How does it do that? Does it stop photolibraryd? Send it a signal?