From 8f9e5a86de8bf2ac7cc58c4052b65cd5be421cdc Mon Sep 17 00:00:00 2001 From: Rhet Turnbull Date: Sat, 9 May 2020 13:34:41 -0500 Subject: [PATCH] Updated Structure of the code (markdown) --- Structure-of-the-code.md | 1 + 1 file changed, 1 insertion(+) diff --git a/Structure-of-the-code.md b/Structure-of-the-code.md index 76df82a..b833032 100644 --- a/Structure-of-the-code.md +++ b/Structure-of-the-code.md @@ -34,4 +34,5 @@ Broadly, osxphotos works like this: 3. If library created with Photos version 2, 3, or 4, `PhotosDB._process_database4()` processes the database file to extract all required information. 4. If library created with Photos 5, the actual database is `Photos.sqlite` so this is opened readonly or copied to a temporary file if locked, then `PhotosDB._process_database5()` is called to process the database file and extra all required information. 5. `_process_database4` and `_process_database5` execute several SQL queries to extract the required data. These methods populate a series of data structures in `PhotosDB` which are then used by the rest of code to create the `PhotoInfo`, `AlbumInfo`, and `FolderInfo` objects. These database structures are ugly...in general, they flatten the SQL database into several different python dicts. The "master" dict is called `_dbphotos`. The key is the [UUID](https://en.wikipedia.org/wiki/Universally_unique_identifier) of the photo and the value is another dict containing details about the photo. Read the code for `PhotosDB.__init__()` for additional details. Each of the data structures is documented in the code. +6. The `PhotoInfo`, `AlbumInfo`, and `FolderInfo` objects are created as needed. For example, `PhotosDB.photos()` returns a list of `PhotoInfo` objects representing the photos in the database and `PhotoInfo.album_info` returns a list of `AlbumInfo` objects representing the albums the photo is contained in.