""" Simple usage of the package """ import os.path import osxphotos def main(): db = os.path.expanduser("~/Pictures/Photos Library.photoslibrary") photosdb = osxphotos.PhotosDB(db) print(photosdb.keywords) print(photosdb.persons) print(photosdb.albums) print(photosdb.keywords_as_dict) print(photosdb.persons_as_dict) print(photosdb.albums_as_dict) # find all photos with Keyword = Foo and containing John Smith photos = photosdb.photos(keywords=["Foo"], persons=["John Smith"]) # find all photos that include Alice Smith but do not contain the keyword Bar photos = [ p for p in photosdb.photos(persons=["Alice Smith"]) if p not in photosdb.photos(keywords=["Bar"]) ] for p in photos: print( p.uuid, p.filename, p.original_filename, p.date, p.description, p.title, p.keywords, p.albums, p.persons, p.path, ) if __name__ == "__main__": main()