diff --git a/README.md b/README.md index 59b55ada..6d2b68b6 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,7 @@ -# [OSXPhotos](https://github.com/RhetTbull/osxphotos) +# OSXPhotos [Homepage](https://github.com/RhetTbull/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? diff --git a/osxphotos/__init__.py b/osxphotos/__init__.py index a170fce0..8aa58073 100644 --- a/osxphotos/__init__.py +++ b/osxphotos/__init__.py @@ -21,12 +21,13 @@ from . import _applescript # TODO: standardize _ and __ as leading char for private variables # which Photos library database versions have been tested -# Photos 3.0 (10.13.6) == +# Photos 3.0 (10.13.6) == # Photos 4.0 (10.14.5) == 4016 -_TESTED_DB_VERSIONS = ["4016"] +# TODO: Should this also use compatibleBackToVersion from LiGlobals? +_TESTED_DB_VERSIONS = ["4016", "3301"] # which major version operating systems have been tested -_TESTED_OS_VERSIONS = ["13","14"] +_TESTED_OS_VERSIONS = ["13", "14"] _debug = False @@ -53,9 +54,10 @@ class PhotosDB: # logger.debug(system, major) if system != "Darwin" or (major not in _TESTED_OS_VERSIONS): print( - "WARNING: This module has only been tested with MacOS 10." + "WARNING: This module has only been tested with MacOS 10." + f"[{', '.join(_TESTED_OS_VERSIONS)}]: " - + f"you have {system}, OS version: {major}", file=sys.stderr + + f"you have {system}, OS version: {major}", + file=sys.stderr, ) # Dict with information about all photos by uuid @@ -275,14 +277,18 @@ class PhotosDB: # logger.debug("Have connection with database") # get database version - c.execute("SELECT value from LiGlobals where LiGlobals.keyPath is 'libraryVersion'") + c.execute( + "SELECT value from LiGlobals where LiGlobals.keyPath is 'libraryVersion'" + ) for ver in c: self.__db_version = ver[0] break # TODO: is there a more pythonic way to do get the first element from cursor? if self.__db_version not in _TESTED_DB_VERSIONS: - print(f"WARNING: Only tested on database versions [{', '.join(_TESTED_DB_VERSIONS)}]" - +f" You have database version={self.__db_version} which has not been tested") + print( + f"WARNING: Only tested on database versions [{', '.join(_TESTED_DB_VERSIONS)}]" + + f" You have database version={self.__db_version} which has not been tested" + ) # Look for all combinations of persons and pictures # logger.debug("Getting information about persons") @@ -434,17 +440,17 @@ class PhotosDB: self._dbphotos[uuid]["name"] = row[13] self._dbphotos[uuid]["isMissing"] = row[14] # logger.debug( -# "Fetching data for photo %d %s %s %s %s %s: %s" - # % ( - # i, - # uuid, - # self._dbphotos[uuid]["masterUuid"], - # self._dbphotos[uuid]["volumeId"], - # self._dbphotos[uuid]["filename"], - # self._dbphotos[uuid]["extendedDescription"], - # self._dbphotos[uuid]["imageDate"], - # ) - # ) + # "Fetching data for photo %d %s %s %s %s %s: %s" + # % ( + # i, + # uuid, + # self._dbphotos[uuid]["masterUuid"], + # self._dbphotos[uuid]["volumeId"], + # self._dbphotos[uuid]["filename"], + # self._dbphotos[uuid]["extendedDescription"], + # self._dbphotos[uuid]["imageDate"], + # ) + # ) # close_pbar_status() conn.close() @@ -518,7 +524,7 @@ class PhotosDB: """ def photos(self, keywords=[], uuid=[], persons=[], albums=[]): - #TODO: remove the logger code then dangling else: pass statements + # TODO: remove the logger code then dangling else: pass statements photos_sets = [] # list of photo sets to perform intersection of if not keywords and not uuid and not persons and not albums: # return all the photos @@ -605,6 +611,7 @@ class PhotoInfo: downloaded from cloud to local storate their status in the database might still show isMissing = 1 """ + def path(self): photopath = "" @@ -616,7 +623,7 @@ class PhotoInfo: if self.__info["isMissing"] == 1: # logger.warning( - # f"Skipping photo, not yet downloaded from iCloud: {photopath}" + # f"Skipping photo, not yet downloaded from iCloud: {photopath}" # ) # logger.debug(self.__info) photopath = None # path would be meaningless until downloaded diff --git a/setup.py b/setup.py index 2e9f3495..7c19bfc2 100755 --- a/setup.py +++ b/setup.py @@ -38,7 +38,7 @@ with open(path.join(this_directory, "README.md"), encoding="utf-8") as f: setup( name="osxphotos", - version="0.10.2", + version="0.10.3", description="Manipulate (read-only) Apple's Photos app library on Mac OS X", long_description=long_description, long_description_content_type="text/markdown", diff --git a/tests/Test-10.13.6.photoslibrary/Masters/2019/07/28/20190728-013355/St James Park.jpg b/tests/Test-10.13.6.photoslibrary/Masters/2019/07/28/20190728-013355/St James Park.jpg new file mode 100644 index 00000000..e5a6b0bd Binary files /dev/null and b/tests/Test-10.13.6.photoslibrary/Masters/2019/07/28/20190728-013355/St James Park.jpg differ diff --git a/tests/Test-10.13.6.photoslibrary/database/RKVersion_searchIndexText.skindex b/tests/Test-10.13.6.photoslibrary/database/RKVersion_searchIndexText.skindex index 772109d2..e401abb4 100644 Binary files a/tests/Test-10.13.6.photoslibrary/database/RKVersion_searchIndexText.skindex and b/tests/Test-10.13.6.photoslibrary/database/RKVersion_searchIndexText.skindex differ diff --git a/tests/Test-10.13.6.photoslibrary/database/photos.db b/tests/Test-10.13.6.photoslibrary/database/photos.db index bb717387..0b4542e0 100644 Binary files a/tests/Test-10.13.6.photoslibrary/database/photos.db and b/tests/Test-10.13.6.photoslibrary/database/photos.db differ diff --git a/tests/Test-10.13.6.photoslibrary/private/com.apple.photoanalysisd/GraphService/PhotoAnalysisServicePreferences.plist b/tests/Test-10.13.6.photoslibrary/private/com.apple.photoanalysisd/GraphService/PhotoAnalysisServicePreferences.plist index a0e7513f..1c299bd0 100644 --- a/tests/Test-10.13.6.photoslibrary/private/com.apple.photoanalysisd/GraphService/PhotoAnalysisServicePreferences.plist +++ b/tests/Test-10.13.6.photoslibrary/private/com.apple.photoanalysisd/GraphService/PhotoAnalysisServicePreferences.plist @@ -3,8 +3,8 @@ PhotoAnalysisGraphLastBackgroundGraphRebuildJobDate - 2019-07-26T20:15:18Z + 2019-07-28T01:23:52Z PhotoAnalysisGraphLastBackgroundMemoryGenerationJobDate - 2019-07-26T20:15:18Z + 2019-07-28T01:23:52Z diff --git a/tests/Test-10.13.6.photoslibrary/private/com.apple.photoanalysisd/GraphService/PhotosGraph/liveupdate-photosgraph.graphdb b/tests/Test-10.13.6.photoslibrary/private/com.apple.photoanalysisd/GraphService/PhotosGraph/liveupdate-photosgraph.graphdb index a96210ed..0ff2a56f 100644 Binary files a/tests/Test-10.13.6.photoslibrary/private/com.apple.photoanalysisd/GraphService/PhotosGraph/liveupdate-photosgraph.graphdb and b/tests/Test-10.13.6.photoslibrary/private/com.apple.photoanalysisd/GraphService/PhotosGraph/liveupdate-photosgraph.graphdb differ diff --git a/tests/Test-10.13.6.photoslibrary/private/com.apple.photoanalysisd/GraphService/PhotosGraph/photosgraph.graphdb b/tests/Test-10.13.6.photoslibrary/private/com.apple.photoanalysisd/GraphService/PhotosGraph/photosgraph.graphdb index 8c47ffff..88129f70 100644 Binary files a/tests/Test-10.13.6.photoslibrary/private/com.apple.photoanalysisd/GraphService/PhotosGraph/photosgraph.graphdb and b/tests/Test-10.13.6.photoslibrary/private/com.apple.photoanalysisd/GraphService/PhotosGraph/photosgraph.graphdb differ diff --git a/tests/Test-10.13.6.photoslibrary/private/com.apple.photoanalysisd/VisionService/PersonPromoter b/tests/Test-10.13.6.photoslibrary/private/com.apple.photoanalysisd/VisionService/PersonPromoter index 0c67376e..fce0698d 100644 --- a/tests/Test-10.13.6.photoslibrary/private/com.apple.photoanalysisd/VisionService/PersonPromoter +++ b/tests/Test-10.13.6.photoslibrary/private/com.apple.photoanalysisd/VisionService/PersonPromoter @@ -1,5 +1,8 @@ - + + SuggestedMeIdentifier + + diff --git a/tests/Test-10.13.6.photoslibrary/private/com.apple.photomodel/appPrivateData.plist b/tests/Test-10.13.6.photoslibrary/private/com.apple.photomodel/appPrivateData.plist new file mode 100644 index 00000000..ef4b164d --- /dev/null +++ b/tests/Test-10.13.6.photoslibrary/private/com.apple.photomodel/appPrivateData.plist @@ -0,0 +1,11 @@ + + + + + LithiumMessageTracer + + LastReportedDate + 2019-07-27T12:01:15Z + + + diff --git a/tests/Test-10.13.6.photoslibrary/resources/moments/historicalmarker.plist b/tests/Test-10.13.6.photoslibrary/resources/moments/historicalmarker.plist index 70051206..3fa0ee5c 100644 --- a/tests/Test-10.13.6.photoslibrary/resources/moments/historicalmarker.plist +++ b/tests/Test-10.13.6.photoslibrary/resources/moments/historicalmarker.plist @@ -3,7 +3,7 @@ LastHistoryRowId - 545 + 615 LibraryBuildTag BEA5F0E8-BA6B-4462-8F73-3E53BBE4C943 LibrarySchemaVersion diff --git a/tests/Test-10.13.6.photoslibrary/resources/proxies/derivatives/00/00/8/UNADJUSTEDNONRAW_mini_8.jpg b/tests/Test-10.13.6.photoslibrary/resources/proxies/derivatives/00/00/a/UNADJUSTEDNONRAW_mini_a.jpg similarity index 100% rename from tests/Test-10.13.6.photoslibrary/resources/proxies/derivatives/00/00/8/UNADJUSTEDNONRAW_mini_8.jpg rename to tests/Test-10.13.6.photoslibrary/resources/proxies/derivatives/00/00/a/UNADJUSTEDNONRAW_mini_a.jpg diff --git a/tests/Test-10.13.6.photoslibrary/resources/proxies/derivatives/00/00/8/UNADJUSTEDNONRAW_thumb_8.jpg b/tests/Test-10.13.6.photoslibrary/resources/proxies/derivatives/00/00/a/UNADJUSTEDNONRAW_thumb_a.jpg similarity index 100% rename from tests/Test-10.13.6.photoslibrary/resources/proxies/derivatives/00/00/8/UNADJUSTEDNONRAW_thumb_8.jpg rename to tests/Test-10.13.6.photoslibrary/resources/proxies/derivatives/00/00/a/UNADJUSTEDNONRAW_thumb_a.jpg diff --git a/tests/Test-10.13.6.photoslibrary/resources/recovery/Info.plist b/tests/Test-10.13.6.photoslibrary/resources/recovery/Info.plist index a077346e..732c34b3 100644 --- a/tests/Test-10.13.6.photoslibrary/resources/recovery/Info.plist +++ b/tests/Test-10.13.6.photoslibrary/resources/recovery/Info.plist @@ -9,7 +9,7 @@ HistoricalMarker LastHistoryRowId - 551 + 615 LibraryBuildTag BEA5F0E8-BA6B-4462-8F73-3E53BBE4C943 LibrarySchemaVersion @@ -24,7 +24,7 @@ SnapshotCompletedDate 2019-07-26T20:15:17Z SnapshotLastValidated - 2019-07-26T20:15:17Z + 2019-07-27T12:01:15Z SnapshotTables diff --git a/tests/Test-10.13.6.photoslibrary/resources/recovery/RKAlbum/0000000000.lij b/tests/Test-10.13.6.photoslibrary/resources/recovery/RKAlbum/0000000000.lij index fa968e1d..2493bbcf 100644 Binary files a/tests/Test-10.13.6.photoslibrary/resources/recovery/RKAlbum/0000000000.lij and b/tests/Test-10.13.6.photoslibrary/resources/recovery/RKAlbum/0000000000.lij differ diff --git a/tests/Test-10.13.6.photoslibrary/resources/recovery/RKBookmark/0000000000.lij b/tests/Test-10.13.6.photoslibrary/resources/recovery/RKBookmark/0000000000.lij index b9ee0bf7..9a142f22 100644 Binary files a/tests/Test-10.13.6.photoslibrary/resources/recovery/RKBookmark/0000000000.lij and b/tests/Test-10.13.6.photoslibrary/resources/recovery/RKBookmark/0000000000.lij differ diff --git a/tests/Test-10.13.6.photoslibrary/resources/recovery/RKImageProxyState/0000000000.lij b/tests/Test-10.13.6.photoslibrary/resources/recovery/RKImageProxyState/0000000000.lij index b2882d1d..d4d26b49 100644 Binary files a/tests/Test-10.13.6.photoslibrary/resources/recovery/RKImageProxyState/0000000000.lij and b/tests/Test-10.13.6.photoslibrary/resources/recovery/RKImageProxyState/0000000000.lij differ diff --git a/tests/Test-10.13.6.photoslibrary/resources/recovery/RKImportGroup/0000000000.lij b/tests/Test-10.13.6.photoslibrary/resources/recovery/RKImportGroup/0000000000.lij index 6b6987a4..53ca9d5f 100644 Binary files a/tests/Test-10.13.6.photoslibrary/resources/recovery/RKImportGroup/0000000000.lij and b/tests/Test-10.13.6.photoslibrary/resources/recovery/RKImportGroup/0000000000.lij differ diff --git a/tests/Test-10.13.6.photoslibrary/resources/recovery/RKKeywordForVersion/0000000000.lij b/tests/Test-10.13.6.photoslibrary/resources/recovery/RKKeywordForVersion/0000000000.lij index 430c7e67..72d7f1f5 100644 Binary files a/tests/Test-10.13.6.photoslibrary/resources/recovery/RKKeywordForVersion/0000000000.lij and b/tests/Test-10.13.6.photoslibrary/resources/recovery/RKKeywordForVersion/0000000000.lij differ diff --git a/tests/Test-10.13.6.photoslibrary/resources/recovery/RKMaster/0000000000.lij b/tests/Test-10.13.6.photoslibrary/resources/recovery/RKMaster/0000000000.lij index b872eded..63db7d43 100644 Binary files a/tests/Test-10.13.6.photoslibrary/resources/recovery/RKMaster/0000000000.lij and b/tests/Test-10.13.6.photoslibrary/resources/recovery/RKMaster/0000000000.lij differ diff --git a/tests/Test-10.13.6.photoslibrary/resources/recovery/RKPlaceForVersion/0000000000.lij b/tests/Test-10.13.6.photoslibrary/resources/recovery/RKPlaceForVersion/0000000000.lij index c467b734..4df2f707 100644 Binary files a/tests/Test-10.13.6.photoslibrary/resources/recovery/RKPlaceForVersion/0000000000.lij and b/tests/Test-10.13.6.photoslibrary/resources/recovery/RKPlaceForVersion/0000000000.lij differ diff --git a/tests/Test-10.13.6.photoslibrary/resources/recovery/RKSceneInVersion/0000000000.lij b/tests/Test-10.13.6.photoslibrary/resources/recovery/RKSceneInVersion/0000000000.lij index eee564a2..14214c17 100644 Binary files a/tests/Test-10.13.6.photoslibrary/resources/recovery/RKSceneInVersion/0000000000.lij and b/tests/Test-10.13.6.photoslibrary/resources/recovery/RKSceneInVersion/0000000000.lij differ diff --git a/tests/Test-10.13.6.photoslibrary/resources/recovery/RKVersion/0000000000.lij b/tests/Test-10.13.6.photoslibrary/resources/recovery/RKVersion/0000000000.lij index 3b52f92c..27f9a78e 100644 Binary files a/tests/Test-10.13.6.photoslibrary/resources/recovery/RKVersion/0000000000.lij and b/tests/Test-10.13.6.photoslibrary/resources/recovery/RKVersion/0000000000.lij differ diff --git a/tests/Test-10.13.6.photoslibrary/resources/recovery/RKVersionAnalysisState/0000000000.lij b/tests/Test-10.13.6.photoslibrary/resources/recovery/RKVersionAnalysisState/0000000000.lij index e01455b2..d19a292b 100644 Binary files a/tests/Test-10.13.6.photoslibrary/resources/recovery/RKVersionAnalysisState/0000000000.lij and b/tests/Test-10.13.6.photoslibrary/resources/recovery/RKVersionAnalysisState/0000000000.lij differ diff --git a/tests/Test-10.13.6.photoslibrary/resources/segments/Thumb64Segment_0.data b/tests/Test-10.13.6.photoslibrary/resources/segments/Thumb64Segment_0.data index 97fef099..82c05ad4 100644 Binary files a/tests/Test-10.13.6.photoslibrary/resources/segments/Thumb64Segment_0.data and b/tests/Test-10.13.6.photoslibrary/resources/segments/Thumb64Segment_0.data differ diff --git a/tests/test_highsierra.py b/tests/test_highsierra.py index 0e518029..224aa803 100644 --- a/tests/test_highsierra.py +++ b/tests/test_highsierra.py @@ -38,6 +38,20 @@ def test_init(): assert isinstance(photosdb, osxphotos.PhotosDB) +def test_db_version(): + import osxphotos + + photosdb = osxphotos.PhotosDB(dbfile=PHOTOS_DB) + assert photosdb.get_db_version() in osxphotos._TESTED_DB_VERSIONS + + +def test_os_version(): + import osxphotos + + (_, major, _) = osxphotos._get_os_version() + assert major in osxphotos._TESTED_OS_VERSIONS + + def test_persons(): import osxphotos import collections diff --git a/tests/test_mojave.py b/tests/test_mojave.py index 277e4501..8b1641e9 100644 --- a/tests/test_mojave.py +++ b/tests/test_mojave.py @@ -38,6 +38,20 @@ def test_init(): assert isinstance(photosdb, osxphotos.PhotosDB) +def test_db_version(): + import osxphotos + + photosdb = osxphotos.PhotosDB(dbfile=PHOTOS_DB) + assert photosdb.get_db_version() in osxphotos._TESTED_DB_VERSIONS + + +def test_os_version(): + import osxphotos + + (_, major, _) = osxphotos._get_os_version() + assert major in osxphotos._TESTED_OS_VERSIONS + + def test_persons(): import osxphotos import collections