Compare commits

..

130 Commits

Author SHA1 Message Date
Rhet Turnbull
bf8aed69cf Updated export example 2019-12-14 10:35:39 -08:00
Rhet Turnbull
800daf3658 Added PhotoInfo.export(); closes #10 2019-12-14 10:29:06 -08:00
Rhet Turnbull
d5a5bd41b3 refactored private vars in PhotoInfo 2019-12-09 21:45:50 -08:00
Rhet Turnbull
911804317b Updated PhotosDB.__init__() to accept positional or named arg for dbfile and added associated tests 2019-12-08 17:20:51 -08:00
Rhet Turnbull
aaba5cabf3 Added list option to cmd_line. Closes #14 2019-12-08 09:14:48 -08:00
Rhet Turnbull
7fef67f852 list_photo_libraries now searches entire disk 2019-12-08 00:38:58 -08:00
Rhet Turnbull
62fedc7fbf added list_photo_libraries 2019-12-08 00:24:34 -08:00
Rhet Turnbull
1d006a4b50 Added get_db_path and get_library_path to PhotosDB 2019-12-07 23:54:55 -08:00
Rhet Turnbull
2cedaedebb Added get_system_library_path 2019-12-07 23:10:36 -08:00
Rhet Turnbull
22d747ebab updated test library 2019-12-07 22:38:43 -08:00
Rhet Turnbull
c1c7b0092d removed TODO 2019-12-07 21:04:43 -08:00
Rhet Turnbull
0220b0eaff refactored code for unknown persons in Photos 5 2019-12-07 21:03:48 -08:00
Rhet Turnbull
d22affebd7 Updated test for unknown persons 2019-12-07 20:58:14 -08:00
Rhet Turnbull
da320e4f56 Handle blank persons in Photos 5 2019-12-07 20:57:23 -08:00
Rhet Turnbull
591336673a Fixed cmd_line so it doesn't create PhotosDB object unless needed 2019-12-07 20:44:15 -08:00
Rhet Turnbull
906b6c0911 added edited and external_edit to cmd_line and __str__, to_json; closes #12 2019-12-07 20:32:23 -08:00
Rhet Turnbull
f21c7c8b08 Removed applescript to close Photos 2019-12-07 19:35:42 -08:00
Rhet Turnbull
1ea83e6c8e updated test library 2019-12-07 19:22:07 -08:00
Rhet Turnbull
45da323840 README update 2019-12-07 16:20:23 -08:00
Rhet Turnbull
def6f8cdfe added --version to cmd_line 2019-12-07 15:56:46 -08:00
Rhet Turnbull
6e45cf9591 added _version.py 2019-12-07 15:34:49 -08:00
Rhet Turnbull
7fb0bad6be Added test for duplicate albums on 10.14.6 2019-12-07 15:10:34 -08:00
Rhet Turnbull
811946018d Fixed warning message for duplicate edit_resource_id 2019-12-07 13:13:34 -08:00
Rhet Turnbull
2a0f27ca57 Supports duplicate album names (treated as single album) 2019-12-07 12:51:39 -08:00
Rhet Turnbull
ff4066c49c version bump 2019-12-07 10:36:23 -08:00
Rhet Turnbull
1cf3e4b954 Updated album code in process_database4 and process_database5 to use album uuid 2019-12-07 10:29:09 -08:00
Rhet Turnbull
0219a9b4da Updated doc strings 2019-12-07 09:08:28 -08:00
Rhet Turnbull
b3c798033c Cleaned up logic in cmd_line query(). Closes #17 2019-12-07 07:21:23 -08:00
Rhet Turnbull
9777e27e3a Added external_edit() to README 2019-12-01 08:14:25 -08:00
Rhet Turnbull
3a1ca343a6 Added external edit for Photos 4 2019-12-01 08:01:09 -08:00
Rhet Turnbull
42baa29c18 Added external_edit for Photos 5 2019-12-01 07:36:16 -08:00
Rhet Turnbull
6a2be3e7d9 Fixed typo in README 2019-11-30 23:14:51 -08:00
Rhet Turnbull
9c32d77b2c Added hidden --debug option to cmd_line 2019-11-30 23:08:49 -08:00
Rhet Turnbull
eb563ad297 Updated get_db_version and associated tests 2019-11-30 21:39:58 -08:00
Rhet Turnbull
d056b6f8c0 Merge branch 'master' of https://github.com/RhetTbull/osxphotos 2019-11-30 18:32:10 -08:00
Rhet Turnbull
5a1176ed86 README update 2019-11-30 18:31:45 -08:00
Rhet Turnbull
e77b8e8a0a README update 2019-11-30 12:22:39 -08:00
Rhet Turnbull
55a6b5bf1c version bump 2019-11-30 11:03:07 -08:00
Rhet Turnbull
37dfc1e151 Fixed path_edited() for Photos 4.0 2019-11-30 10:54:43 -08:00
Rhet Turnbull
01b2f4420f fixed typo 2019-11-29 08:48:35 -08:00
Rhet Turnbull
68eef42599 Added path_edited() for Photos 5, still needs to be added for Photos <= 4.0 2019-11-29 08:47:11 -08:00
Rhet Turnbull
3dc0943453 cleaned up commented out code 2019-11-29 06:56:33 -08:00
Rhet Turnbull
7818fe0fcf Now copy write-ahead log and shared memory files which fixes problem with access to recently changed data 2019-11-28 09:25:22 -08:00
Rhet Turnbull
792fff13b8 added hasadjustments and tests for Photo5 2019-11-27 22:37:42 -08:00
Rhet Turnbull
b2242da9b7 cleaned up test code 2019-11-27 21:37:49 -08:00
Rhet Turnbull
1e5633efc8 TODO update 2019-11-27 07:42:44 -08:00
Rhet Turnbull
27b3469513 Added latitude, longitude to cmd_line 2019-11-27 07:39:48 -08:00
Rhet Turnbull
aa25c9eab7 Updated TODO 2019-11-27 07:32:11 -08:00
Rhet Turnbull
44321da243 Added location (latitude/longitude), closes issue #2 2019-11-27 07:27:49 -08:00
Rhet Turnbull
67127ef370 removed .jpg_originals that were added by mistake 2019-11-26 21:48:37 -08:00
Rhet Turnbull
51e720dce9 Added tests for hidden and favorite to both 14.6 and 15.1 2019-11-26 21:47:05 -08:00
Rhet Turnbull
45b8150d5f Added TODO 2019-11-25 21:25:21 -08:00
Rhet Turnbull
6ebacb7f38 README update 2019-11-25 20:57:48 -08:00
Rhet Turnbull
1b17608a02 Added TODOs 2019-11-24 21:24:02 -08:00
Rhet Turnbull
d4353d48bd Fixed bug in date() if imageTimeZoneOffsetSeconds was None 2019-11-24 21:12:26 -08:00
Rhet Turnbull
5af2b3e039 Added name and description to cmd_line 2019-11-24 21:08:01 -08:00
Rhet Turnbull
b36b7e7eb2 Added hidden/favorite/missing to cmd_line 2019-11-24 20:14:59 -08:00
Rhet Turnbull
99be93d88f version bump 2019-11-24 09:46:51 -08:00
Rhet Turnbull
d840c11ddb Added favorite and hidden to cmd_line 2019-11-24 09:45:36 -08:00
Rhet Turnbull
b1fd019120 Added hidden and favorite and test for 10.15 2019-11-24 09:39:36 -08:00
Rhet Turnbull
8b4a386c13 Fixed original_filename for older database versions 2019-11-24 08:46:02 -08:00
Rhet Turnbull
6abd10eddf removed old progress bar code 2019-11-24 08:35:30 -08:00
Rhet Turnbull
aa73c2f055 removed loguru code 2019-11-24 08:33:00 -08:00
Rhet Turnbull
966954340b version bump for release to pypi 2019-11-23 19:40:29 -08:00
Rhet Turnbull
7732708cb2 fixed command line to better handle detected but unidentified faces in Photos 5 2019-11-23 19:24:20 -08:00
Rhet Turnbull
a7d9f72372 Updated doc string 2019-11-23 19:06:52 -08:00
Rhet Turnbull
eabda3ea93 Turned off debug 2019-11-23 19:05:25 -08:00
Rhet Turnbull
a995a8d610 README update 2019-11-23 14:53:17 -08:00
Rhet Turnbull
ecd75c775d Added link to issues 2019-11-23 14:51:32 -08:00
Rhet Turnbull
ae7fc69b33 version bump 2019-11-23 14:49:13 -08:00
Rhet Turnbull
83186a655d Changed path() to return absolute path and fixed tests 2019-11-23 14:48:38 -08:00
Rhet Turnbull
243492df88 added test for 10.15/Catalina 2019-11-23 13:56:26 -08:00
Rhet Turnbull
986a092130 fixed == / != None 2019-11-23 13:27:54 -08:00
Rhet Turnbull
1c323338c6 version bump 2019-11-18 21:04:30 -08:00
Rhet Turnbull
b005f70133 fixed bug on 3.6 due to logging 2019-11-18 21:03:55 -08:00
Rhet Turnbull
9023a69073 Initial release for MacOS 10.15 / Photos 5 2019-11-17 18:01:03 -08:00
Rhet Turnbull
e7958c94e8 alpha version of filenames/paths 2019-11-17 17:19:33 -08:00
Rhet Turnbull
17bc04a24a replaced debug print statements with logging.debug 2019-11-17 16:46:34 -08:00
Rhet Turnbull
e0b1113870 replaced debug print statements with logging.debug 2019-11-17 16:45:46 -08:00
Rhet Turnbull
10f0cf1092 query will now run on Photos 5 2019-11-17 08:53:24 -08:00
Rhet Turnbull
a4b5f2a501 basic Photos 5 info now being read 2019-11-17 08:43:34 -08:00
Rhet Turnbull
02fcfbca2c More updates to _process_photos5 2019-11-16 11:01:04 -08:00
Rhet Turnbull
7eff015439 moved process_photos to process_photos4 and process_photos5 2019-11-16 08:18:22 -08:00
Rhet Turnbull
1c7e81b578 Fixed cleanup code 2019-11-16 07:59:59 -08:00
Rhet Turnbull
8649cda11f Fixed cleanup code 2019-11-16 07:59:04 -08:00
Rhet Turnbull
0c152c8c91 Updated some doc strings 2019-11-16 07:28:45 -08:00
Rhet Turnbull
b0a9e87d00 added _cleanup_tmp_files 2019-11-13 21:48:50 -08:00
Rhet Turnbull
fc6d7b1cf5 added comments/TODOs 2019-11-11 21:39:51 -08:00
Rhet Turnbull
5234567974 Moved db version check to function in prep for move to Photos 5 code 2019-11-11 21:30:51 -08:00
Rhet Turnbull
f62a9d3d4e fixed version check for Catalina 2019-10-14 09:44:11 -07:00
Rhet Turnbull
d311431c91 README update, added todo 2019-09-30 09:57:55 -07:00
Rhet Turnbull
572e32b71b version bump 2019-08-31 13:01:25 -07:00
Rhet Turnbull
3744a596b5 Merge branch 'master' of https://github.com/RhetTbull/osxphotos 2019-08-31 13:00:29 -07:00
Rhet Turnbull
221df0029e Added pythonpackage.yml for CI workflow 2019-08-31 12:52:21 -07:00
Rhet Turnbull
a1038314e2 added todo 2019-08-24 08:36:57 -07:00
Rhet Turnbull
39ef8ddf3f fixed typo in README 2019-08-24 08:31:34 -07:00
Rhet Turnbull
292f3e5ea4 release 0.12.2 for pypi 2019-08-24 08:24:51 -07:00
Rhet Turnbull
e9a4de447c Updated help text 2019-08-24 08:01:53 -07:00
Rhet Turnbull
42bc929142 Updated README for 10.12 2019-08-24 07:42:38 -07:00
Rhet Turnbull
58f52833d6 Added support and tests for 10.12 2019-08-24 07:25:48 -07:00
Rhet Turnbull
7cf8dcf22a sorted imports 2019-08-23 17:04:55 -07:00
Rhet Turnbull
e139fbb2fb import sort 2019-08-23 06:58:38 -07:00
Rhet Turnbull
332cbe3e37 black 2019-08-19 21:29:27 -07:00
Rhet Turnbull
e35876a1ba version bump 2019-08-19 21:28:16 -07:00
Rhet Turnbull
693d27c049 version bump 2019-08-19 21:27:32 -07:00
Rhet Turnbull
8742967885 updated requirements.txt 2019-08-19 21:24:46 -07:00
Rhet Turnbull
a27cf45f95 fixed PhotoInfo.date() to account for timezone, updated tests 2019-08-18 22:29:53 -07:00
Rhet Turnbull
93cc305fa7 added help to query 2019-08-18 19:13:35 -07:00
Rhet Turnbull
0d51798384 Updated README 2019-08-18 16:59:46 -07:00
Rhet Turnbull
22e466cd0e removed loguru 2019-08-18 16:56:05 -07:00
Rhet Turnbull
33ef56fd94 added click in to install_requires 2019-08-18 16:54:19 -07:00
Rhet Turnbull
6b24706851 fixed --json for query 2019-08-18 16:02:06 -07:00
Rhet Turnbull
be3d6dee8d added to_json() to PhotoInfo 2019-08-18 15:21:28 -07:00
Rhet Turnbull
07c9c31a09 Added query to cmd_line and added __repr__ and __str__ to osxphotos classes 2019-08-18 14:56:04 -07:00
Rhet Turnbull
9db32a51ca Added description to cmd_line commands 2019-08-18 09:59:16 -07:00
Rhet Turnbull
5200cd69ce Updated json output 2019-08-18 09:48:58 -07:00
Rhet Turnbull
0e65ab5452 Added osxphotos command line tool 2019-08-18 09:39:55 -07:00
Rhet Turnbull
cbdc193b83 version bump 2019-08-17 10:56:51 -04:00
Rhet Turnbull
fb2c12d981 Added tests for 10.14.6 2019-08-17 10:42:27 -04:00
Rhet Turnbull
81be373505 update requirements.txt 2019-07-27 21:55:19 -04:00
Rhet Turnbull
5f1bd5f13d More README updates 2019-07-27 21:52:30 -04:00
Rhet Turnbull
7ef472fcb2 README update 2019-07-27 21:48:10 -04:00
Rhet Turnbull
a58ac149f3 Updated README, added os & db version tests, updated test library for 10.13 2019-07-27 21:45:37 -04:00
Rhet Turnbull
32bd4cfb9d updated README 2019-07-27 21:17:02 -04:00
Rhet Turnbull
9b44adff34 Standardized warning for OS/DB version check 2019-07-27 21:06:48 -04:00
Rhet Turnbull
75c25c8bf5 Added checks for database version and OS version 2019-07-27 20:57:37 -04:00
Rhet Turnbull
a79472ba0c renamed test files 2019-07-27 20:24:31 -04:00
Rhet Turnbull
cafb88173f removed extra ismissing definition, fixed some linting issues 2019-07-27 20:16:17 -04:00
Rhet Turnbull
af122e9392 Added test for 10.14 mojave 2019-07-27 17:48:27 -04:00
Rhet Turnbull
470585bf8c Removed stray logging statement, fixed version check 2019-07-26 23:06:53 -04:00
452 changed files with 5670 additions and 386 deletions

34
.github/workflows/pythonpackage.yml vendored Normal file
View File

@@ -0,0 +1,34 @@
name: Python package
on: [push]
jobs:
build:
runs-on: macOS-10.14
strategy:
max-parallel: 4
matrix:
python-version: [3.6, 3.7]
steps:
- uses: actions/checkout@v1
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v1
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
- name: Lint with flake8
run: |
# pip install flake8
# stop the build if there are Python syntax errors or undefined names
# flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
# flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
- name: Test with pytest
run: |
pip install pytest
python -m pytest tests/

274
README.md
View File

@@ -1,12 +1,21 @@
# [OSXPhotos](https://github.com/RhetTbull/osxphotos)
# OSXPhotos
[![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/python/black)
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
## What is osxphotos?
OSXPhotos provides the ability to interact with and query Apple's Photos app library database on Mac OS X.
OSXPhotos provides the ability to interact with and query Apple's Photos.app library database on MacOS. Using this module you can query the Photos database for information about the photos stored in a Photos library on your Mac--for example, file name, file path, and metadata such as keywords/tags, persons/faces, albums, etc. You can also easily export both the original and edited photos.
**NOTE**: OSXPhotos currently only supports image files -- e.g. it does not handle movies.
## Supported operating systems
Only works on Mac OS X. Only tested on Mac OS 10.13 and Photos 3.0. Requires python >= 3.6
Only works on MacOS (aka Mac OS X). Tested on MacOS 10.12.6 / Photos 2.0, 10.13.6 / Photos 3.0, MacOS 10.14.5, 10.14.6 / Photos 4.0, MacOS 10.15.1 / Photos 5.0. Requires python >= 3.6
This module will read Photos databases for any supported version on any supported OS version. E.g. you can read a database created with Photos 4.0 on MacOS 10.14 on a machine running MacOS 10.12
## Installation instructions
@@ -16,9 +25,72 @@ osxmetadata uses setuptools, thus simply run:
## Command Line Usage
This project started as a command line utility, `photosmeta`, available at [photosmeta](https://github.com/RhetTbull/photosmeta) This module converts the photosmeta functionality into a module. Eventually, I plan to rewrite photosmeta using this module and include it as a command line script in this module.
This module will install a command line utility called `osxphotos` that allows you to query the Photos database.
## Example uses of the module
If you only care about the command line tool, I recommend installing with [pipx](https://github.com/pipxproject/pipx)
After installing pipx:
`pipx install osxphotos`
```
Usage: osxphotos [OPTIONS] COMMAND [ARGS]...
Options:
--db <Photos database path> Specify database file.
--json Print output in JSON format.
-v, --version Show the version and exit.
-h, --help Show this message and exit.
Commands:
albums Print out albums found in the Photos library.
dump Print list of all photos & associated info from the Photos...
help Print help; for help on commands: help <command>.
info Print out descriptive info of the Photos library database.
keywords Print out keywords found in the Photos library.
list Print list of Photos libraries found on the system.
persons Print out persons (faces) found in the Photos library.
query Query the Photos database using 1 or more search options; if...
```
To get help on a specific command, use `osxphotos help <command_name>`
Example: `osxphotos help query`
```
Usage: osxphotos help [OPTIONS]
Query the Photos database using 1 or more search options; if more than
one option is provided, they are treated as "AND" (e.g. search for photos
matching all options).
Options:
--keyword TEXT Search for keyword(s).
--person TEXT Search for person(s).
--album TEXT Search for album(s).
--uuid TEXT Search for UUID(s).
--name TEXT Search for TEXT in name of photo.
--no-name Search for photos with no name.
--description TEXT Search for TEXT in description of photo.
--no-description Search for photos with no description.
-i, --ignore-case Case insensitive search for name or description. Does
not apply to keyword, person, or album.
--edited Search for photos that have been edited.
--external-edit Search for photos edited in external editor.
--favorite Search for photos marked favorite.
--not-favorite Search for photos not marked favorite.
--hidden Search for photos marked hidden.
--not-hidden Search for photos not marked hidden.
--missing Search for photos missing from disk.
--not-missing Search for photos present on disk (e.g. not missing).
--json Print output in JSON format
-h, --help Show this message and exit.
```
Example: find all photos with keyword "Kids" and output results to json file named results.json:
`osxphotos query --keyword Kids --json >results.json`
## Example uses of the module
```python
import osxphotos
@@ -43,6 +115,7 @@ def main():
print(
p.uuid,
p.filename(),
p.original_filename(),
p.date(),
p.description(),
p.name(),
@@ -56,19 +129,68 @@ if __name__ == "__main__":
main()
```
```python
""" Export all photos to ~/Desktop/export
If file has been edited, export the edited version,
otherwise, export the original version """
import os.path
import osxphotos
def main():
photosdb = osxphotos.PhotosDB()
photos = photosdb.photos()
export_path = os.path.expanduser("~/Desktop/export")
for p in photos:
if not p.ismissing():
if p.hasadjustments():
exported = p.export(export_path, edited=True)
else:
exported = p.export(export_path)
print(f"Exported {p.filename()} to {exported}")
else:
print(f"Skipping missing photo: {p.filename()}")
if __name__ == "__main__":
main()
```
## Module Interface
### Utility Functions
#### ```get_system_library_path()```
**MacOS 10.15 Only** Returns path to System Photo Library as string. On MacOS version < 10.15, raises Exception.
#### ```get_last_library_path()```
Returns path to last opened Photo Library as string.
#### ```list_photo_libraries()```
Returns list of Photos libraries found on the system. **Note**: On MacOS 10.15, this appears to list all libraries. On older systems, it may not find some libraries if they are not located in ~/Pictures. Provided for convenience but do not rely on this to find all libraries on the system.
### PhotosDB
#### Open the default Photos library
```python
osxphotos.PhotosDB([dbfile="path to database file"])
osxphotos.PhotosDB()
osxphotos.PhotosDB(path)
osxphotos.PhotosDB(dbfile=path)
```
Opens the Photos library database and returns a PhotosDB object. Optionally, pass the path to a specific database file. If `dbfile` is not included, will open the default (last opened) Photos database.
Opens the Photos library database and returns a PhotosDB object.
Note: this will open the last library that was opened in Photos. This is not necessarily the System Photos Library. If you have more than one Photos library, you can select which to open by holding down Option key while opening Photos.
Optionally, pass the path to a specific database file or a Photos library (e.g. "/Users/smith/Pictures/Photos Library.photoslibrary" or "/Users/smith/Pictures/Photos Library.photoslibrary/database/photos.db"). Path to photos library may be passed **either** as first argument **or** as named argument `dbfile`. If path is not passed, PhotosDB will attempt to open the default Photos library (that is, the last library that was opened in Photos.app which may or may not also be the System Photos Library). **Note**: Users may specify a different library to open by holding down the *option* key while opening Photos.app.
If an invalid path is passed, PhotosDB will raise `ValueError` exception.
Open the default (last opened) Photos library. (E.g. this is the library that would open if the user opened Photos.app)
```python
import osxphotos
@@ -76,7 +198,25 @@ import osxphotos
photosdb = osxphotos.PhotosDB()
```
Returns a PhotosDB object.
#### Open System Photos library
In Photos 5 (Catalina / MacOS 10.15), you can use `get_system_library_path()` to get the path to the System photo library if you want to ensure PhotosDB opens the system library. This does not work on older versions of MacOS. E.g.
```python
import osxphotos
path = osxphotos.get_system_library_path()
photosdb = osxphotos.PhotosDB(path)
```
also,
```python
import osxphotos
path = osxphotos.get_system_library_path()
photosdb = osxphotos.PhotosDB(dbfile=path)
```
#### Open a specific Photos library
```python
@@ -85,7 +225,17 @@ import osxphotos
photosdb = osxphotos.PhotosDB(dbfile="/Users/smith/Pictures/Test.photoslibrary/database/photos.db")
```
Pass the fully qualified path to the specific Photos database you want to open. The database is called photos.db and resides in the database folder in your Photos library
or
```python
import osxphotos
photosdb = osxphotos.PhotosDB("/Users/smith/Pictures/Test.photoslibrary")
```
Pass the fully qualified path to the Photos library or the actual database file inside the library. The database is called photos.db and resides in the database folder in your Photos library. If you pass only the path to the library, PhotosDB will add the database path automatically. The option to pass the actual database path is provided so database files can be queried even if separated from the actual .photoslibrary file.
Returns a PhotosDB object.
#### ```keywords```
```python
@@ -101,7 +251,9 @@ Returns a list of the keywords found in the Photos library
albums = photosdb.albums()
```
Returns a list of the albums found in the Photos library
Returns a list of the albums found in the Photos library.
**Note**: In Photos 5.0 (MacOS 10.15/Catalina), It is possible to have more than one album with the same name in Photos. Albums with duplicate names are treated as a single album and the photos in each are combined. For example, if you have two albums named "Wedding" and each has 2 photos, osxphotos will treat this as a single album named "Wedding" with 4 photos in it.
#### ```persons```
```python
@@ -133,9 +285,11 @@ Returns a dictionary of persons (faces) found in the Photos library where key is
albums_dict = photosdb.albums_as_dict()
```
Returns a dictionary of albums found in the Photos library where key is the album name and value is the count of how many photos are in the album. Resulting dictionary is in reverse sorted order (e.g. album with the most photos is listed first)
Returns a dictionary of albums found in the Photos library where key is the album name and value is the count of how many photos are in the album. Resulting dictionary is in reverse sorted order (e.g. album with the most photos is listed first).
#### ```get_photos_library_path```
**Note**: In Photos 5.0 (MacOS 10.15/Catalina), It is possible to have more than one album with the same name in Photos. Albums with duplicate names are treated as a single album and the photos in each are combined. For example, if you have two albums named "Wedding" and each has 2 photos, osxphotos will treat this as a single album named "Wedding" with 4 photos in it.
#### ```get_library_path```
```python
# assumes photosdb is a PhotosDB object (see above)
photosdb.get_photos_library_path()
@@ -143,6 +297,23 @@ photosdb.get_photos_library_path()
Returns the path to the Photos library as a string
#### ```get_db_path```
```python
# assumes photosdb is a PhotosDB object (see above)
photosdb.get_db_path()
```
Returns the path to the Photos database PhotosDB was initialized with
#### ```get_db_version```
```python
# assumes photosdb is a PhotosDB object (see above)
photosdb.get_db_version()
```
Returns the version number for Photos library database. You likely won't need this but it's provided in case needed for debugging. PhotosDB will print a warning to `sys.stderr` if you open a database version that has not been tested.
#### ```photos```
```python
# assumes photosdb is a PhotosDB object (see above)
@@ -164,7 +335,7 @@ photos = photosdb.photos(
```
- ```keywords```: list of one or more keywords. Returns only photos containing the keyword(s). If more than one keyword is provided finds photos matching any of the keywords (e.g. treated as "or")
- ```uuid```: list of one or more uuids. Returns only photos whos UUID matches. Note: The UUID is the universally unique identifier that the Photos database uses to identify each photo. You shouldn't normally need to use this but it is a way to access a specific photo if you know the UUID. If more than more uuid is provided, returns photos that match any of the uuids (e.g. treated as "or")
- ```uuid```: list of one or more uuids. Returns only photos whos UUID matches. **Note**: The UUID is the universally unique identifier that the Photos database uses to identify each photo. You shouldn't normally need to use this but it is a way to access a specific photo if you know the UUID. If more than more uuid is provided, returns photos that match any of the uuids (e.g. treated as "or")
- ```persons```: list of one or more persons. Returns only photos containing the person(s). If more than one person provided, returns photos that match any of the persons (e.g. treated as "or")
- ```albums```: list of one or more album names. Returns only photos contained in the album(s). If more than one album name is provided, returns photos contained in any of the albums (.e.g. treated as "or")
@@ -216,7 +387,10 @@ PhotosDB.photos() returns a list of PhotoInfo objects. Each PhotoInfo object re
Returns the universally unique identifier (uuid) of the photo. This is how Photos keeps track of individual photos within the database.
#### `filename()`
Returns the filename of the photo
Returns the current filename of the photo on disk. See also `original_filename()`
#### `original_filename()`
Returns the original filename of the photo when it was imported to Photos. **Note**: Photos 5.0+ renames the photo when it adds the file to the library using UUID. See also `filename()`
#### `date()`
Returns the date of the photo as a datetime.datetime object
@@ -237,23 +411,59 @@ Returns a list of albums the photo is contained in
Returns a list of the names of the persons in the photo
#### `path()`
Returns the path to the photo on disk as a string. Note: this returns the path to the *original* unedited file (see `hasadjustments()`). If the file is missing on disk, path=`None` (see `ismissing()`)
Returns the absolute path to the photo on disk as a string. **Note**: this returns the path to the *original* unedited file (see `hasadjustments()`). If the file is missing on disk, path=`None` (see `ismissing()`)
#### `path_edited()`
Returns the absolute path to the edited photo on disk as a string. If the photo has not been edited, returns `None`. See also `path()` and `hasadjustments()`.
#### `ismissing()`
Returns `True` if the original image file is missing on disk, otherwise `False`. This can occur if the file has been uploaded to iCloud but not yet downloaded to the local library or if the file was deleted or imported from a disk that has been unmounted. Note: this status is set by Photos and osxphotos does not verify that the file path returned by `path()` actually exists. It merely reports what Photos has stored in the library database.
Returns `True` if the original image file is missing on disk, otherwise `False`. This can occur if the file has been uploaded to iCloud but not yet downloaded to the local library or if the file was deleted or imported from a disk that has been unmounted. **Note**: this status is set by Photos and osxphotos does not verify that the file path returned by `path()` actually exists. It merely reports what Photos has stored in the library database.
#### `hasadjustments()`
Returns `True` if the file has been edited in Photos, otherwise `False`
Returns `True` if the picture has been edited, otherwise `False`
Examples:
#### `external_edit()`
Returns `True` if the picture was edited in an external editor (outside Photos.app), otherwise `False`
#### `favorite()`
Returns `True` if the picture has been marked as a favorite, otherwise `False`
#### `hidden()`
Returns `True` if the picture has been marked as hidden, otherwise `False`
#### `location()`
Returns latitude and longitude as a tuple of floats (latitude, longitude). If location is not set, latitude and longitude are returned as `None`
#### `to_json()`
Returns a JSON representation of all photo info
#### `export(self, *args, edited=False, overwrite=False, increment=True)`
Export photo from the Photos library to another destination on disk.
- First argument of *args must be valid destination path (or exception raised).
- Second argument of *args (optional): name of picture; if not provided, will use current filename
- edited: boolean; if True (default=False), will export the edited version of the photo (or raise exception if no edited version)
- overwrite: boolean; if True (default=False), will overwrite files if they alreay exist
- increment: boolean; if True (default=True), will increment file name until a non-existant name is found
If overwrite=False and increment=False, export will fail if destination file already exists
Returns the full path to the exported file
**Implementation Note**: Because the usual python file copy methods don't preserve all the metadata available on MacOS, export uses /usr/bin/ditto to do the copy for export. ditto preserves most metadata such as extended attributes, permissions, ACLs, etc.
### Examples
```python
# assumes photosdb is a PhotosDB object (see above)
import osxphotos
photosdb = osxphotos.PhotosDB()
photos=photosdb.photos()
for p in photos:
print(
p.uuid(),
p.filename(),
p.original_filename(),
p.date(),
p.description(),
p.name(),
@@ -266,19 +476,33 @@ for p in photos:
)
```
## History
This project started as a command line utility, `photosmeta`, available at [photosmeta](https://github.com/RhetTbull/photosmeta) This module converts the photosmeta Photos library query functionality into a module.
## Contributing
Contributing is easy! If you find bugs or want to suggest additional features/changes, please open an [issue](https://github.com/RhetTbull/osxphotos/issues/).
I'll gladly consider pull requests for bug fixes or feature implementations.
If you have an interesting example that shows usage of this module, submit an issue or pull request and I'll include it or link to it.
## Implementation Notes
This module is very kludgy. It works by creating a copy of the sqlite3 database that Photos uses to store data about the Photos library. The class PhotosDB then queries this database to extract information about the photos such as persons (faces identified in the photos), albums, keywords, etc.
This module works by creating a copy of the sqlite3 database that Photos uses to store data about the Photos library. The class PhotosDB then queries this database to extract information about the photos such as persons (faces identified in the photos), albums, keywords, etc.
If Apple changes the database format this will likely break.
If Apple changes the database format this will likely break.
The sqlite3 database used by Photos uses write ahead logging that is updated asynchronously in the background by a Photos helper service. Sometimes the update takes a long time meaning the latest changes made in Photos (e.g. add a keyword) will not show up in the database for sometime. I know of no way around this.
Apple does provide a framework ([PhotoKit](https://developer.apple.com/documentation/photokit?language=objc)) for querying the user's Photos library and I attempted to create the funcationality in this module using this framework but unfortunately PhotoKit does not provide access to much of the needed metadata (such as Faces/Persons). While copying the sqlite file is a bit kludgy, it allows osxphotos to provide access to all available metadata.
## Dependencies
[PyObjC](https://pythonhosted.org/pyobjc/)
- [PyObjC](https://pythonhosted.org/pyobjc/)
- [PyYAML](https://pypi.org/project/PyYAML/)
- [Click](https://pypi.org/project/click/)
## Acknowledgements
This code was inspired by photo-export by Patrick Fältström see: (https://github.com/patrikhson/photo-export) Copyright (c) 2015 Patrik Fältström paf@frobbit.se
This project was originally inspired by photo-export by Patrick Fältström see: (https://github.com/patrikhson/photo-export) Copyright (c) 2015 Patrik Fältström paf@frobbit.se
To interact with the Photos app, I use [py-applescript]( https://github.com/rdhyee/py-applescript) by "Raymond Yee / rdhyee". Rather than import this module, I included the entire module
(which is published as public domain code) in a private module to prevent ambiguity with

View File

@@ -3,6 +3,9 @@ import osxphotos
def main():
photosdb = osxphotos.PhotosDB()
print(f"db file = {photosdb.get_db_path()}")
print(f"db version = {photosdb.get_db_version()}")
print(photosdb.keywords())
print(photosdb.persons())
print(photosdb.albums())

26
examples/export.py Normal file
View File

@@ -0,0 +1,26 @@
""" Export all photos to ~/Desktop/export
If file has been edited, export the edited version,
otherwise, export the original version """
import os.path
import osxphotos
def main():
photosdb = osxphotos.PhotosDB()
photos = photosdb.photos()
export_path = os.path.expanduser("~/Desktop/export")
for p in photos:
if not p.ismissing():
if p.hasadjustments():
exported = p.export(export_path, edited=True)
else:
exported = p.export(export_path)
print(f"Exported {p.filename()} to {exported}")
else:
print(f"Skipping missing photo: {p.filename()}")
if __name__ == "__main__":
main()

File diff suppressed because it is too large Load Diff

4
osxphotos/_version.py Normal file
View File

@@ -0,0 +1,4 @@
""" version info """
__version__ = "0.15.0"

422
osxphotos/cmd_line.py Normal file
View File

@@ -0,0 +1,422 @@
import csv
import json
import sys
import click
import yaml
import osxphotos
from ._version import __version__
# TODO: add "--any" to search any field (e.g. keyword, description, name contains "wedding") (add case insensitive option)
class CLI_Obj:
def __init__(self, db=None, json=False, debug=False):
if debug:
osxphotos._debug(True)
self.db = db
self.json = json
CTX_SETTINGS = dict(help_option_names=["-h", "--help"])
@click.group(context_settings=CTX_SETTINGS)
@click.option(
"--db",
required=False,
metavar="<Photos database path>",
default=None,
help="Specify database file.",
)
@click.option(
"--json",
required=False,
is_flag=True,
default=False,
help="Print output in JSON format.",
)
@click.option("--debug", required=False, is_flag=True, default=False, hidden=True)
@click.version_option(__version__, "--version", "-v")
@click.pass_context
def cli(ctx, db, json, debug):
ctx.obj = CLI_Obj(db=db, json=json, debug=debug)
@cli.command()
@click.pass_obj
def keywords(cli_obj):
""" Print out keywords found in the Photos library. """
photosdb = osxphotos.PhotosDB(dbfile=cli_obj.db)
keywords = {"keywords": photosdb.keywords_as_dict()}
if cli_obj.json:
click.echo(json.dumps(keywords))
else:
click.echo(yaml.dump(keywords, sort_keys=False))
@cli.command()
@click.pass_obj
def albums(cli_obj):
""" Print out albums found in the Photos library. """
photosdb = osxphotos.PhotosDB(dbfile=cli_obj.db)
albums = {"albums": photosdb.albums_as_dict()}
if cli_obj.json:
click.echo(json.dumps(albums))
else:
click.echo(yaml.dump(albums, sort_keys=False))
@cli.command()
@click.pass_obj
def persons(cli_obj):
""" Print out persons (faces) found in the Photos library. """
photosdb = osxphotos.PhotosDB(dbfile=cli_obj.db)
persons = {"persons": photosdb.persons_as_dict()}
if cli_obj.json:
click.echo(json.dumps(persons))
else:
click.echo(yaml.dump(persons, sort_keys=False))
@cli.command()
@click.pass_obj
def info(cli_obj):
""" Print out descriptive info of the Photos library database. """
pdb = osxphotos.PhotosDB(dbfile=cli_obj.db)
info = {}
info["database_path"] = pdb.get_db_path()
info["database_version"] = pdb.get_db_version()
photos = pdb.photos()
info["photo_count"] = len(photos)
keywords = pdb.keywords_as_dict()
info["keywords_count"] = len(keywords)
info["keywords"] = keywords
albums = pdb.albums_as_dict()
info["albums_count"] = len(albums)
info["albums"] = albums
persons = pdb.persons_as_dict()
# handle empty person names (added by Photos 5.0+ when face detected but not identified)
# TODO: remove this
# noperson = "UNKNOWN"
# if "" in persons:
# if noperson in persons:
# persons[noperson].append(persons[""])
# else:
# persons[noperson] = persons[""]
# persons.pop("", None)
info["persons_count"] = len(persons)
info["persons"] = persons
if cli_obj.json:
click.echo(json.dumps(info))
else:
click.echo(yaml.dump(info, sort_keys=False))
@cli.command()
@click.pass_obj
def dump(cli_obj):
""" Print list of all photos & associated info from the Photos library. """
pdb = osxphotos.PhotosDB(dbfile=cli_obj.db)
photos = pdb.photos()
print_photo_info(photos, cli_obj.json)
@cli.command(name="list")
@click.pass_obj
def list_libraries(cli_obj):
""" Print list of Photos libraries found on the system. """
photo_libs = osxphotos.list_photo_libraries()
sys_lib = None
_, major, _ = osxphotos._get_os_version()
if int(major) >= 15:
sys_lib = osxphotos.get_system_library_path()
last_lib = osxphotos.get_last_library_path()
last_lib_flag = sys_lib_flag = False
for lib in photo_libs:
if lib == sys_lib:
click.echo(f"(*)\t{lib}")
sys_lib_flag = True
elif lib == last_lib:
click.echo(f"(#)\t{lib}")
last_lib_flag = True
else:
click.echo(f"\t{lib}")
if sys_lib_flag or last_lib_flag:
click.echo("\n")
if sys_lib_flag:
click.echo("(*)\tSystem Photos Library")
if last_lib_flag:
click.echo("(#)\tLast opened Photos Library")
@cli.command()
@click.option("--keyword", default=None, multiple=True, help="Search for keyword(s).")
@click.option("--person", default=None, multiple=True, help="Search for person(s).")
@click.option("--album", default=None, multiple=True, help="Search for album(s).")
@click.option("--uuid", default=None, multiple=True, help="Search for UUID(s).")
@click.option(
"--name", default=None, multiple=True, help="Search for TEXT in name of photo."
)
@click.option("--no-name", is_flag=True, help="Search for photos with no name.")
@click.option(
"--description",
default=None,
multiple=True,
help="Search for TEXT in description of photo.",
)
@click.option(
"--no-description", is_flag=True, help="Search for photos with no description."
)
@click.option(
"-i",
"--ignore-case",
is_flag=True,
help="Case insensitive search for name or description. Does not apply to keyword, person, or album.",
)
@click.option("--edited", is_flag=True, help="Search for photos that have been edited.")
@click.option(
"--external-edit", is_flag=True, help="Search for photos edited in external editor."
)
@click.option("--favorite", is_flag=True, help="Search for photos marked favorite.")
@click.option(
"--not-favorite", is_flag=True, help="Search for photos not marked favorite."
)
@click.option("--hidden", is_flag=True, help="Search for photos marked hidden.")
@click.option("--not-hidden", is_flag=True, help="Search for photos not marked hidden.")
@click.option("--missing", is_flag=True, help="Search for photos missing from disk.")
@click.option(
"--not-missing",
is_flag=True,
help="Search for photos present on disk (e.g. not missing).",
)
@click.option(
"--json",
required=False,
is_flag=True,
default=False,
help="Print output in JSON format",
)
@click.pass_obj
@click.pass_context
def query(
ctx,
cli_obj,
keyword,
person,
album,
uuid,
name,
no_name,
description,
no_description,
ignore_case,
json,
edited,
external_edit,
favorite,
not_favorite,
hidden,
not_hidden,
missing,
not_missing,
):
""" Query the Photos database using 1 or more search options;
if more than one option is provided, they are treated as "AND"
(e.g. search for photos matching all options).
"""
# if no query terms, show help and return
if not any(
[
keyword,
person,
album,
uuid,
name,
no_name,
description,
no_description,
edited,
external_edit,
favorite,
not_favorite,
hidden,
not_hidden,
missing,
not_missing,
]
):
click.echo(cli.commands["query"].get_help(ctx))
return
elif favorite and not_favorite:
# can't search for both favorite and notfavorite
click.echo(cli.commands["query"].get_help(ctx))
return
elif hidden and not_hidden:
# can't search for both hidden and nothidden
click.echo(cli.commands["query"].get_help(ctx))
return
elif missing and not_missing:
# can't search for both missing and notmissing
click.echo(cli.commands["query"].get_help(ctx))
return
elif name and no_name:
# can't search for both name and no_name
click.echo(cli.commands["query"].get_help(ctx))
return
elif description and no_description:
# can't search for both description and no_description
click.echo(cli.commands["query"].get_help(ctx))
return
else:
photosdb = osxphotos.PhotosDB(dbfile=cli_obj.db)
photos = photosdb.photos(
keywords=keyword, persons=person, albums=album, uuid=uuid
)
if name:
# search name field for text
# if more than one, find photos with all name values in in name
if ignore_case:
# case-insensitive
for n in name:
n = n.lower()
photos = [p for p in photos if p.name() and n in p.name().lower()]
else:
for n in name:
photos = [p for p in photos if p.name() and n in p.name()]
elif no_name:
photos = [p for p in photos if not p.name()]
if description:
# search description field for text
# if more than one, find photos with all name values in in description
if ignore_case:
# case-insensitive
for d in description:
d = d.lower()
photos = [
p
for p in photos
if p.description() and d in p.description().lower()
]
else:
for d in description:
photos = [
p for p in photos if p.description() and d in p.description()
]
elif no_description:
photos = [p for p in photos if not p.description()]
if edited:
photos = [p for p in photos if p.hasadjustments()]
if external_edit:
photos = [p for p in photos if p.external_edit()]
if favorite:
photos = [p for p in photos if p.favorite()]
elif not_favorite:
photos = [p for p in photos if not p.favorite()]
if hidden:
photos = [p for p in photos if p.hidden()]
elif not_hidden:
photos = [p for p in photos if not p.hidden()]
if missing:
photos = [p for p in photos if p.ismissing()]
elif not_missing:
photos = [p for p in photos if not p.ismissing()]
print_photo_info(photos, cli_obj.json or json)
@cli.command()
@click.argument("topic", default=None, required=False, nargs=1)
@click.pass_context
def help(ctx, topic, **kw):
""" Print help; for help on commands: help <command>. """
if topic is None:
click.echo(ctx.parent.get_help())
else:
click.echo(cli.commands[topic].get_help(ctx))
def print_photo_info(photos, json=False):
if json:
dump = []
for p in photos:
dump.append(p.to_json())
click.echo(f"[{', '.join(dump)}]")
else:
# dump as CSV
csv_writer = csv.writer(
sys.stdout, delimiter=",", quotechar='"', quoting=csv.QUOTE_MINIMAL
)
dump = []
# add headers
dump.append(
[
"uuid",
"filename",
"original_filename",
"date",
"description",
"name",
"keywords",
"albums",
"persons",
"path",
"ismissing",
"hasadjustments",
"external_edit",
"favorite",
"hidden",
"latitude",
"longitude",
"path_edited",
]
)
for p in photos:
dump.append(
[
p.uuid(),
p.filename(),
p.original_filename(),
str(p.date()),
p.description(),
p.name(),
", ".join(p.keywords()),
", ".join(p.albums()),
", ".join(p.persons()),
p.path(),
p.ismissing(),
p.hasadjustments(),
p.external_edit(),
p.favorite(),
p.hidden(),
p._latitude(),
p._longitude(),
p.path_edited(),
]
)
for row in dump:
csv_writer.writerow(row)
if __name__ == "__main__":
cli()

View File

@@ -1,4 +1,122 @@
# pip install -r requirements.txt
pyobjc-core
pyobjc
ansimarkup==1.4.0
astroid==2.2.5
atomicwrites==1.3.0
attrs==19.1.0
better-exceptions-fork==0.2.1.post6
certifi==2019.3.9
Click==7.0
colorama==0.4.1
importlib-metadata==0.18
isort==4.3.20
lazy-object-proxy==1.4.1
mccabe==0.6.1
more-itertools==7.2.0
packaging==19.0
pluggy==0.12.0
py==1.8.0
Pygments==2.4.2
pylint==2.3.1
pyobjc==5.2
pyobjc-core==5.2
pyobjc-framework-Accounts==5.2
pyobjc-framework-AddressBook==5.2
pyobjc-framework-AdSupport==5.2
pyobjc-framework-AppleScriptKit==5.2
pyobjc-framework-AppleScriptObjC==5.2
pyobjc-framework-ApplicationServices==5.2
pyobjc-framework-Automator==5.2
pyobjc-framework-AVFoundation==5.2
pyobjc-framework-AVKit==5.2
pyobjc-framework-BusinessChat==5.2
pyobjc-framework-CalendarStore==5.2
pyobjc-framework-CFNetwork==5.2
pyobjc-framework-CloudKit==5.2
pyobjc-framework-Cocoa==5.2
pyobjc-framework-Collaboration==5.2
pyobjc-framework-ColorSync==5.2
pyobjc-framework-Contacts==5.2
pyobjc-framework-ContactsUI==5.2
pyobjc-framework-CoreAudio==5.2
pyobjc-framework-CoreAudioKit==5.2
pyobjc-framework-CoreBluetooth==5.2
pyobjc-framework-CoreData==5.2
pyobjc-framework-CoreLocation==5.2
pyobjc-framework-CoreMedia==5.2
pyobjc-framework-CoreMediaIO==5.2
pyobjc-framework-CoreML==5.2
pyobjc-framework-CoreServices==5.2
pyobjc-framework-CoreSpotlight==5.2
pyobjc-framework-CoreText==5.2
pyobjc-framework-CoreWLAN==5.2
pyobjc-framework-CryptoTokenKit==5.2
pyobjc-framework-DictionaryServices==5.2
pyobjc-framework-DiscRecording==5.2
pyobjc-framework-DiscRecordingUI==5.2
pyobjc-framework-DiskArbitration==5.2
pyobjc-framework-DVDPlayback==5.2
pyobjc-framework-EventKit==5.2
pyobjc-framework-ExceptionHandling==5.2
pyobjc-framework-ExternalAccessory==5.2
pyobjc-framework-FinderSync==5.2
pyobjc-framework-FSEvents==5.2
pyobjc-framework-GameCenter==5.2
pyobjc-framework-GameController==5.2
pyobjc-framework-GameKit==5.2
pyobjc-framework-GameplayKit==5.2
pyobjc-framework-ImageCaptureCore==5.2
pyobjc-framework-IMServicePlugIn==5.2
pyobjc-framework-InputMethodKit==5.2
pyobjc-framework-InstallerPlugins==5.2
pyobjc-framework-InstantMessage==5.2
pyobjc-framework-Intents==5.2
pyobjc-framework-IOSurface==5.2
pyobjc-framework-iTunesLibrary==5.2
pyobjc-framework-LatentSemanticMapping==5.2
pyobjc-framework-LaunchServices==5.2
pyobjc-framework-libdispatch==5.2
pyobjc-framework-LocalAuthentication==5.2
pyobjc-framework-MapKit==5.2
pyobjc-framework-MediaAccessibility==5.2
pyobjc-framework-MediaLibrary==5.2
pyobjc-framework-MediaPlayer==5.2
pyobjc-framework-MediaToolbox==5.2
pyobjc-framework-ModelIO==5.2
pyobjc-framework-MultipeerConnectivity==5.2
pyobjc-framework-NaturalLanguage==5.2
pyobjc-framework-NetFS==5.2
pyobjc-framework-Network==5.2
pyobjc-framework-NetworkExtension==5.2
pyobjc-framework-NotificationCenter==5.2
pyobjc-framework-OpenDirectory==5.2
pyobjc-framework-OSAKit==5.2
pyobjc-framework-Photos==5.2
pyobjc-framework-PhotosUI==5.2
pyobjc-framework-PreferencePanes==5.2
pyobjc-framework-PubSub==5.2
pyobjc-framework-QTKit==5.2
pyobjc-framework-Quartz==5.2
pyobjc-framework-SafariServices==5.2
pyobjc-framework-SceneKit==5.2
pyobjc-framework-ScreenSaver==5.2
pyobjc-framework-ScriptingBridge==5.2
pyobjc-framework-SearchKit==5.2
pyobjc-framework-Security==5.2
pyobjc-framework-SecurityFoundation==5.2
pyobjc-framework-SecurityInterface==5.2
pyobjc-framework-ServiceManagement==5.2
pyobjc-framework-Social==5.2
pyobjc-framework-SpriteKit==5.2
pyobjc-framework-StoreKit==5.2
pyobjc-framework-SyncServices==5.2
pyobjc-framework-SystemConfiguration==5.2
pyobjc-framework-UserNotifications==5.2
pyobjc-framework-VideoSubscriberAccount==5.2
pyobjc-framework-VideoToolbox==5.2
pyobjc-framework-Vision==5.2
pyobjc-framework-WebKit==5.2
pyparsing==2.4.1.1
PyYAML==5.1.2
six==1.12.0
wcwidth==0.1.7
wrapt==1.11.1
zipp==0.5.2

View File

@@ -1,7 +1,7 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# setup.py script for osxphotos
# setup.py script for osxphotos
#
# Copyright (c) 2019 Rhet Turnbull, rturnbull+git@gmail.com
# All rights reserved.
@@ -26,19 +26,22 @@
# CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.
# from distutils.core import setup
from setuptools import setup, find_packages
import os
from setuptools import find_packages, setup
# read the contents of README file
from os import path
this_directory = path.abspath(path.dirname(__file__))
with open(path.join(this_directory, "README.md"), encoding="utf-8") as f:
this_directory = os.path.abspath(os.path.dirname(__file__))
with open(os.path.join(this_directory, "README.md"), encoding="utf-8") as f:
long_description = f.read()
about = {}
with open(
os.path.join(this_directory, "osxphotos", "_version.py"), mode="r", encoding="utf-8"
) as f:
exec(f.read(), about)
setup(
name="osxphotos",
version="0.10.1",
version=about["__version__"],
description="Manipulate (read-only) Apple's Photos app library on Mac OS X",
long_description=long_description,
long_description_content_type="text/markdown",
@@ -47,7 +50,7 @@ setup(
url="https://github.com/RhetTbull/",
project_urls={"GitHub": "https://github.com/RhetTbull/osxphotos"},
download_url="https://github.com/RhetTbull/osxphotos",
packages=find_packages(exclude=["tests","examples"]),
packages=find_packages(exclude=["tests", "examples"]),
license="License :: OSI Approved :: MIT License",
classifiers=[
"Development Status :: 4 - Beta",
@@ -58,8 +61,6 @@ setup(
"Programming Language :: Python :: 3.6",
"Topic :: Software Development :: Libraries :: Python Modules",
],
install_requires=["pyobjc",],
# entry_points = {
# 'console_scripts' : ['osxmetadata=osxmetadata.cmd_line:main'],
# }
install_requires=["pyobjc", "Click", "pyyaml"],
entry_points={"console_scripts": ["osxphotos=osxphotos.cmd_line:cli"]},
)

Binary file not shown.

After

Width:  |  Height:  |  Size: 541 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 528 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 574 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 500 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 450 KiB

View File

@@ -0,0 +1,18 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>DatabaseMinorVersion</key>
<integer>1</integer>
<key>DatabaseVersion</key>
<integer>112</integer>
<key>LastOpenMode</key>
<integer>2</integer>
<key>LibrarySchemaVersion</key>
<integer>2622</integer>
<key>MetaSchemaVersion</key>
<integer>2</integer>
<key>createDate</key>
<date>2019-08-24T02:50:48Z</date>
</dict>
</plist>

Binary file not shown.

View File

@@ -0,0 +1,25 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>LithiumMessageTracer</key>
<dict>
<key>LastReportedDate</key>
<date>2019-08-24T02:50:48Z</date>
</dict>
<key>PXPeopleScreenUnlocked</key>
<true/>
<key>Photos</key>
<dict>
<key>IPXWorkspaceControllerPhotosHasContentKey</key>
<true/>
<key>IPXWorkspaceControllerZoomLevelsKey</key>
<dict>
<key>kZoomLevelIdentifierAlbums</key>
<integer>7</integer>
<key>kZoomLevelIdentifierVersions</key>
<integer>7</integer>
</dict>
</dict>
</dict>
</plist>

View File

@@ -0,0 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>PhotoAnalysisGraphLastBackgroundGraphRebuildJobDate</key>
<date>2019-12-07T16:40:40Z</date>
<key>PhotoAnalysisGraphLastBackgroundMemoryGenerationJobDate</key>
<date>2019-12-07T16:40:41Z</date>
</dict>
</plist>

Binary file not shown.

After

Width:  |  Height:  |  Size: 20 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 22 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 73 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 59 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 460 KiB

View File

@@ -0,0 +1,16 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>PLLanguageAndLocaleKey</key>
<string>en-US:en_US</string>
<key>PLLastGeoProviderIdKey</key>
<string>7618</string>
<key>PLLastLocationInfoFormatVer</key>
<integer>12</integer>
<key>PLLastRevGeoForcedProviderOutOfDateCheckVersionKey</key>
<integer>1</integer>
<key>PLLastRevGeoVerFileFetchDateKey</key>
<date>2019-12-07T16:40:32Z</date>
</dict>
</plist>

View File

@@ -0,0 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>LastHistoryRowId</key>
<integer>414</integer>
<key>LibraryBuildTag</key>
<string>E3E46F2A-7168-4973-AB3E-5848F80BFC7D</string>
<key>LibrarySchemaVersion</key>
<integer>2622</integer>
</dict>
</plist>

View File

@@ -0,0 +1,47 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>FileVersion</key>
<integer>11</integer>
<key>Source</key>
<dict>
<key>35230</key>
<dict>
<key>CountryMinVersions</key>
<dict>
<key>OTHER</key>
<integer>1</integer>
</dict>
<key>CurrentVersion</key>
<integer>1</integer>
<key>NoResultErrorIsSuccess</key>
<true/>
</dict>
<key>57879</key>
<dict>
<key>CountryMinVersions</key>
<dict>
<key>OTHER</key>
<integer>1</integer>
</dict>
<key>CurrentVersion</key>
<integer>1</integer>
<key>NoResultErrorIsSuccess</key>
<true/>
</dict>
<key>7618</key>
<dict>
<key>AddCountyIfNeeded</key>
<true/>
<key>CountryMinVersions</key>
<dict>
<key>OTHER</key>
<integer>10</integer>
</dict>
<key>CurrentVersion</key>
<integer>10</integer>
</dict>
</dict>
</dict>
</plist>

Binary file not shown.

After

Width:  |  Height:  |  Size: 40 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 214 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 34 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 157 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 49 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 260 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 48 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 272 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 47 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 276 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 44 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 330 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 48 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 297 KiB

View File

@@ -0,0 +1,29 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>DatabaseMinorVersion</key>
<integer>1</integer>
<key>DatabaseVersion</key>
<integer>112</integer>
<key>HistoricalMarker</key>
<dict>
<key>LastHistoryRowId</key>
<integer>414</integer>
<key>LibraryBuildTag</key>
<string>E3E46F2A-7168-4973-AB3E-5848F80BFC7D</string>
<key>LibrarySchemaVersion</key>
<integer>2622</integer>
</dict>
<key>LibrarySchemaVersion</key>
<integer>2622</integer>
<key>MetaSchemaVersion</key>
<integer>2</integer>
<key>SnapshotComplete</key>
<true/>
<key>SnapshotCompletedDate</key>
<date>2019-08-24T02:50:48Z</date>
<key>SnapshotTables</key>
<dict/>
</dict>
</plist>

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 MiB

View File

@@ -3,8 +3,8 @@
<plist version="1.0">
<dict>
<key>PhotoAnalysisGraphLastBackgroundGraphRebuildJobDate</key>
<date>2019-07-26T20:15:18Z</date>
<date>2019-07-28T01:23:52Z</date>
<key>PhotoAnalysisGraphLastBackgroundMemoryGenerationJobDate</key>
<date>2019-07-26T20:15:18Z</date>
<date>2019-07-28T01:23:52Z</date>
</dict>
</plist>

View File

@@ -1,5 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict/>
<dict>
<key>SuggestedMeIdentifier</key>
<string></string>
</dict>
</plist>

Some files were not shown because too many files have changed in this diff Show More