Photo Metadata and Search on MacOS
28mm.github.io
28mm.github.io
tags = list(set(descr.split()) & categories)
The following would also work: tags = [x for x in descr.split() if x in categories]
[1]https://gist.github.com/28mm/9820bd8b6eb27555efe9d6f46dd95a8...If memory serves, the reason it doesn’t first split the description on white space is that some categories contain whitespace, and would never match.
Thanks!
def get_all_phrases(descr):
words = descr.split()
if len(words) == 1:
return words
phrases = []
for i in range(2, len(words) + 1):
phrases += get_phrases_of_len(i, words)
return words + phrases
def get_phrases_of_len(length, words):
return [' '.join(words[i:i+length]) for i in range((len(words) - length) + 1)]You want "launchctl unload /System/Library/LaunchAgents/com.apple.photolibraryd.plist".
launchctl stop com.apple.photolibraryd
(And replace “stop” with “start” to get it going again.)Add a description to a photo, search for that description in Photos for iOS, and there will be no results.
Out of all the photo library management apps, apple photos is by far the most performant.
The data is there. It should be available to all applications!
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)
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.
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?