Updated Structure of the code (markdown)

Rhet Turnbull
2020-05-30 13:18:32 -07:00
parent 6bed2ff27b
commit 853d9beb19

@@ -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. * FolderInfo: represents a folder in the library.
* PlaceInfo: represents the reverse geolocation info (e.g. the address or place name) associated with a photo. * 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. * 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. 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| |`exiftool.py`| ExifTool class|
|`photoinfo/`| PhotoInfo class| |`photoinfo/`| PhotoInfo class|
|`photosdb/`| PhotosDB class| |`photosdb/`| PhotosDB class|
|`phototemplate.py`| PhotoTemplate class|
|`placeinfo.py`| PlaceInfo 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| |`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| |`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 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` 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 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. 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/`! 6. Add at least one test to `tests/`!
7. Ensure all tests pass `python3 -m pytest tests/` 7. Ensure all tests pass `python3 -m pytest tests/`