Updated Structure of the code (markdown)
@@ -7,6 +7,7 @@ osxphotos is built around a set of classes that each handle a particular aspect
|
||||
* FolderInfo: represents a folder in the library.
|
||||
* PlaceInfo: represents the reverse geolocation info (e.g. the address or place name) associated with a photo.
|
||||
* ExifTool: provides an interface to the [exiftool](https://exiftool.org/) tool for manipulating EXIF information associated with a photo.
|
||||
* PhotoTemplate: helper class for rendering a template string.
|
||||
|
||||
The package code is organized in osxphotos per the table below. Most of the files contain doc strings describing what they contain.
|
||||
|
||||
@@ -23,8 +24,9 @@ The package code is organized in osxphotos per the table below. Most of the file
|
||||
|`exiftool.py`| ExifTool class|
|
||||
|`photoinfo/`| PhotoInfo class|
|
||||
|`photosdb/`| PhotosDB class|
|
||||
|`phototemplate.py`| PhotoTemplate class|
|
||||
|`placeinfo.py`| PlaceInfo class|
|
||||
|`templates`| contains [mako](https://www.makotemplates.org/) templates for sidecar export (though the name is similar, these templates are not associated with `templates.py`|
|
||||
|`templates`| contains [mako](https://www.makotemplates.org/) templates for sidecar export (though the name is similar, these templates are not associated with `phototemplate.py`|
|
||||
|`templates/xmp_sidecar.mako`|mako template used to create [XMP](https://en.wikipedia.org/wiki/Extensible_Metadata_Platform) sidecar files|
|
||||
|`utils.py`| various utility methods--this file is getting bloated and needs to be refactored|
|
||||
|
||||
@@ -43,7 +45,7 @@ As an example, here's a rough outline of what you'd need to do to add support fo
|
||||
1. Reverse engineer Photos.sqlite and develop an sql query that extracts the data
|
||||
2. Add this query to `PhotosDB._process_database5` (assuming a Photos 5 library) and store the data in appropriate data structure accessible through `_dbphotos`
|
||||
3. Add a property to `PhotoInfo` which accesses `_dbphotos` through `self._db` which points to the PhotosDB object. If your change requires significant code, consider creating a separate file for the method -- see _photoinfo_export.py for an example
|
||||
4. If exposing the property to the templating system (`PhotoInfo.render_template()`) and add it to `templates.py` (which is relatively self-documenting)
|
||||
4. If exposing the property to the templating system (`PhotoTemplate` and `PhotoInfo.render_template()`) add it to `phototemplate.py` (which is relatively self-documenting)
|
||||
5. If exposing the property to the command line interface, add it to `__main__.py` -- you'll want to look at `query_options`, `_query()`, `export()`, and `export_photo()` at a minimum to ensure the command line tool can access your new attribute.
|
||||
6. Add at least one test to `tests/`!
|
||||
7. Ensure all tests pass `python3 -m pytest tests/`
|
||||
|
||||
Reference in New Issue
Block a user