Updated Structure of the code (markdown)

Rhet Turnbull
2020-05-09 13:34:41 -05:00
parent 9ed34bf504
commit 8f9e5a86de

@@ -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.