Updated Understanding the Photos database (markdown)
@@ -33,6 +33,12 @@ The version is a 4-digit integer, the first digit of which signifies which versi
|
||||
|
||||
Most of what is described in the following comes from reverse engineering what Photos is doing or looking at the code of [others](https://github.com/RhetTbull/osxphotos/wiki/Related-projects) who have done related work. I had to make many, many assumptions and some of them are surely wrong. If you discover any errors or have additional information to add I welcome edits to the wiki or opening an [issue](https://github.com/RhetTbull/osxphotos/issues)!
|
||||
|
||||
## dates/times in the database
|
||||
Dates & times in the database are stored as a MacOS time value which is the number of seconds since 2001-01-01 00:00:00. To work with these in python, you'll need add the number of seconds since the Unix time epoch of 1970-01-01 00:00:00. I do this by computing a time delta thusly:
|
||||
|
||||
```python
|
||||
td = (datetime(2001, 1, 1, 0, 0) - datetime(1970, 1, 1, 0, 0)).total_seconds()```
|
||||
|
||||
Additional details about the Photos 5 database structure are [here](https://github.com/RhetTbull/osxphotos/wiki/Photos-version-5-database).
|
||||
|
||||
Additional details about the Photos 4 database structure are [here](https://github.com/RhetTbull/osxphotos/wiki/Photos-version-4-database).
|
||||
|
||||
Reference in New Issue
Block a user