Updated Structure of the code (markdown)
@@ -42,11 +42,12 @@ Broadly, osxphotos works like this:
|
|||||||
As an example, here's a rough outline of what you'd need to do to add support for a new metadata attribute:
|
As an example, here's a rough outline of what you'd need to do to add support for a new metadata attribute:
|
||||||
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
|
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 (`PhotoInfo.render_template()`) and add it to `templates.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/`
|
||||||
8. Submit a pull request :-)
|
8. Format code with [black](https://black.readthedocs.io/en/stable/)
|
||||||
|
9. Submit a pull request :-)
|
||||||
|
|
||||||
[home](https://github.com/RhetTbull/osxphotos/wiki)
|
[home](https://github.com/RhetTbull/osxphotos/wiki)
|
||||||
Reference in New Issue
Block a user