diff --git a/README.md b/README.md index b658b6da..bfd97d29 100644 --- a/README.md +++ b/README.md @@ -25,7 +25,7 @@ - [`library_path`](#library_path) - [`db_path`](#db_path) - [`db_version`](#db_version) - - [`photos(keywords=[], uuid=[], persons=[], albums=[])`](#photoskeywords-uuid-persons-albums) + - [` photos(keywords=None, uuid=None, persons=None, albums=None, images=True, movies=False)`](#-photoskeywordsnone-uuidnone-personsnone-albumsnone-imagestrue-moviesfalse) + [PhotoInfo](#photoinfo) - [`uuid`](#uuid) - [`filename`](#filename) @@ -45,6 +45,9 @@ - [`hidden`](#hidden) - [`location`](#location) - [`shared`](#shared) + - [`isphoto`](#isphoto) + - [`ismovie`](#ismovie) + - [`uti`](#uti) - [`json()`](#json) - [`export(dest, *filename, edited=False, overwrite=False, increment=True, sidecar=False)`](#exportdest-filename-editedfalse-overwritefalse-incrementtrue-sidecarfalse) + [Utility Functions](#utility-functions) @@ -380,7 +383,7 @@ photosdb.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(keywords=[], uuid=[], persons=[], albums=[])` +#### ` photos(keywords=None, uuid=None, persons=None, albums=None, images=True, movies=False)` ```python # assumes photosdb is a PhotosDB object (see above) @@ -397,7 +400,9 @@ photos = photosdb.photos( keywords = [], uuid = [], persons = [], - albums = [] + albums = [], + images = bool, + movies = bool, ) ``` @@ -405,8 +410,10 @@ photos = photosdb.photos( - ```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") +- ```images```: bool; if True, returns photos/images; default is True +- ```movies```: bool; if True, returns movies/videos; default is False -If more than one of these parameters is provided, they are treated as "and" criteria. E.g. +If more than one of (keywords, uuid, persons, albums) is provided, they are treated as "and" criteria. E.g. Finds all photos with (keyword = "wedding" or "birthday") and (persons = "Juan Rodriguez") @@ -447,6 +454,16 @@ photos2 = photosdb.photos(keywords=["Kids"]) photos3 = [p for p in photos2 if p not in photos1] ``` +By default, photos() only returns images, not movies. To also get movies, pass movies=True: +```python +photos_and_movies = photosdb.photos(movies=True) +``` + +To get only movies: +```python +movies = photosdb.photos(images=False, movies=True) +``` + ### PhotoInfo PhotosDB.photos() returns a list of PhotoInfo objects. Each PhotoInfo object represents a single photo in the Photos library. @@ -506,6 +523,15 @@ Returns True if photo is in a shared album, otherwise False. **Note**: *Only valid on Photos 5 / MacOS 10.15*; on Photos <= 4, returns None instead of True/False. +#### `isphoto` +Returns True if type is photo/still image, otherwise False + +#### `ismovie` +Returns True if type is movie/video, otherwise False + +#### `uti` +Returns Uniform Type Identifier (UTI) for the image, for example: 'public.jpeg' or 'com.apple.quicktime-movie' + #### `json()` Returns a JSON representation of all photo info diff --git a/osxphotos/__init__.py b/osxphotos/__init__.py index c8629b3b..9c0a6b49 100644 --- a/osxphotos/__init__.py +++ b/osxphotos/__init__.py @@ -3,6 +3,7 @@ import logging from ._version import __version__ from .photoinfo import PhotoInfo from .photosdb import PhotosDB +from .utils import _set_debug, _debug, _get_logger # TODO: find edited photos: see https://github.com/orangeturtle739/photos-export/blob/master/extract_photos.py # TODO: Add test for imageTimeZoneOffsetSeconds = None @@ -13,31 +14,3 @@ from .photosdb import PhotosDB # TODO: Add special albums and magic albums # TODO: cleanup os.path and pathlib code (import pathlib and also from pathlib import Path) - -# set _DEBUG = True to enable debug output -_DEBUG = False - -logging.basicConfig( - level=logging.DEBUG, - format="%(asctime)s - %(levelname)s - %(filename)s - %(lineno)d - %(message)s", -) - -if not _DEBUG: - logging.disable(logging.DEBUG) - - -def _get_logger(): - """Used only for testing - - Returns: - logging.Logger object -- logging.Logger object for osxphotos - """ - return logging.Logger(__name__) - - -def _debug(debug): - """ Enable or disable debug logging """ - if debug: - logging.disable(logging.NOTSET) - else: - logging.disable(logging.DEBUG) diff --git a/osxphotos/__main__.py b/osxphotos/__main__.py index 986213f4..2cc76e52 100644 --- a/osxphotos/__main__.py +++ b/osxphotos/__main__.py @@ -16,12 +16,12 @@ from ._version import __version__ from .utils import create_path_by_date # TODO: add "--any" to search any field (e.g. keyword, description, title contains "wedding") (add case insensitive option) - +# TODO: add search for filename class CLI_Obj: def __init__(self, db=None, json=False, debug=False): if debug: - osxphotos._debug(True) + osxphotos._set_debug(True) self.db = db self.json = json @@ -106,6 +106,14 @@ def info(cli_obj): movies = pdb.photos(images=False, movies=True) info["movie_count"] = len(movies) + if pdb.db_version >= _PHOTOS_5_VERSION: + shared_photos = [p for p in photos if p.shared] + info["shared_photo_count"] = len(shared_photos) + + shared_movies = [p for p in movies if p.shared] + info["shared_movie_count"] = len(shared_movies) + + keywords = pdb.keywords_as_dict info["keywords_count"] = len(keywords) info["keywords"] = keywords diff --git a/osxphotos/_constants.py b/osxphotos/_constants.py index fd53dc77..c9c5d82d 100644 --- a/osxphotos/_constants.py +++ b/osxphotos/_constants.py @@ -2,6 +2,7 @@ Constants used by osxphotos """ + # which Photos library database versions have been tested # Photos 2.0 (10.12.6) == 2622 # Photos 3.0 (10.13.6) == 3301 @@ -28,3 +29,4 @@ _PHOTOS_5_SHARED_PHOTO_PATH = "resources/cloudsharing/data" # What type of file? Based on ZGENERICASSET.ZKIND in Photos 5 database _PHOTO_TYPE = 0 _MOVIE_TYPE = 1 + diff --git a/osxphotos/_version.py b/osxphotos/_version.py index 8b14d42d..35187c0e 100644 --- a/osxphotos/_version.py +++ b/osxphotos/_version.py @@ -1,3 +1,3 @@ """ version info """ -__version__ = "0.18.03" +__version__ = "0.19.00" diff --git a/osxphotos/photoinfo.py b/osxphotos/photoinfo.py index baad5a55..b6b96a01 100644 --- a/osxphotos/photoinfo.py +++ b/osxphotos/photoinfo.py @@ -83,20 +83,6 @@ class PhotoInfo: return photopath # TODO: Is there a way to use applescript or PhotoKit to force the download in this - if self._info["masterFingerprint"]: - # if masterFingerprint is not null, path appears to be valid - if self._info["directory"].startswith("/"): - photopath = os.path.join( - self._info["directory"], self._info["filename"] - ) - else: - photopath = os.path.join( - self._db._masters_path, - self._info["directory"], - self._info["filename"], - ) - return photopath - if self._info["shared"]: # shared photo photopath = os.path.join( @@ -107,13 +93,23 @@ class PhotoInfo: ) return photopath - # if all else fails, photopath = None - photopath = None - logging.debug( - f"WARNING: photopath None, masterFingerprint null, not shared {pformat(self._info)}" - ) + # if self._info["masterFingerprint"]: + # if masterFingerprint is not null, path appears to be valid + if self._info["directory"].startswith("/"): + photopath = os.path.join(self._info["directory"], self._info["filename"]) + else: + photopath = os.path.join( + self._db._masters_path, self._info["directory"], self._info["filename"] + ) return photopath + # if all else fails, photopath = None + # photopath = None + # logging.debug( + # f"WARNING: photopath None, masterFingerprint null, not shared {pformat(self._info)}" + # ) + # return photopath + @property def path_edited(self): """ absolute path on disk of the edited picture """ @@ -176,12 +172,20 @@ class PhotoInfo: if self._info["hasAdjustments"]: library = self._db._library_path directory = self._uuid[0] # first char of uuid + filename = None + if self._info["type"] == _PHOTO_TYPE: + # it's a photo + filename = f"{self._uuid}_1_201_a.jpeg" + elif self._info["type"] == _MOVIE_TYPE: + # it's a movie + filename = f"{self._uuid}_2_0_a.mov" + else: + # don't know what it is! + logging.debug(f"WARNING: unknown type {self._info['type']}") + return None + photopath = os.path.join( - library, - "resources", - "renders", - directory, - f"{self._uuid}_1_201_a.jpeg", + library, "resources", "renders", directory, filename ) if not os.path.isfile(photopath): diff --git a/osxphotos/photosdb.py b/osxphotos/photosdb.py index a807c87f..ca984114 100644 --- a/osxphotos/photosdb.py +++ b/osxphotos/photosdb.py @@ -16,16 +16,16 @@ from pprint import pformat from shutil import copyfile from ._constants import ( + _MOVIE_TYPE, + _PHOTO_TYPE, _PHOTOS_5_VERSION, _TESTED_DB_VERSIONS, _TESTED_OS_VERSIONS, _UNKNOWN_PERSON, - _PHOTO_TYPE, - _MOVIE_TYPE, ) from ._version import __version__ from .photoinfo import PhotoInfo -from .utils import _check_file_exists, _get_os_version, get_last_library_path +from .utils import _check_file_exists, _get_os_version, get_last_library_path, _debug # TODO: Add test for imageTimeZoneOffsetSeconds = None # TODO: Fix command line so multiple --keyword, etc. are AND (instead of OR as they are in .photos()) @@ -83,7 +83,8 @@ class PhotosDB: # list of temporary files created so we can clean them up later self._tmp_files = [] - logging.debug(f"dbfile = {dbfile}") + if _debug(): + logging.debug(f"dbfile = {dbfile}") # get the path to photos library database if args: @@ -117,7 +118,8 @@ class PhotosDB: if not _check_file_exists(dbfile): raise FileNotFoundError(f"dbfile {dbfile} does not exist", dbfile) - logging.debug(f"dbfile = {dbfile}") + if _debug(): + logging.debug(f"dbfile = {dbfile}") self._dbfile = self._dbfile_actual = os.path.abspath(dbfile) @@ -126,7 +128,8 @@ class PhotosDB: # If Photos >= 5, actual data isn't in photos.db but in Photos.sqlite if int(self._db_version) >= int(_PHOTOS_5_VERSION): - logging.debug(f"version is {self._db_version}") + if _debug(): + logging.debug(f"version is {self._db_version}") dbpath = pathlib.Path(self._dbfile).parent dbfile = dbpath / "Photos.sqlite" if not _check_file_exists(dbfile): @@ -134,9 +137,10 @@ class PhotosDB: else: self._tmp_db = self._copy_db_file(dbfile) self._dbfile_actual = dbfile - logging.debug( - f"_dbfile = {self._dbfile}, _dbfile_actual = {self._dbfile_actual}" - ) + if _debug(): + logging.debug( + f"_dbfile = {self._dbfile}, _dbfile_actual = {self._dbfile_actual}" + ) library_path = os.path.dirname(os.path.abspath(dbfile)) (library_path, _) = os.path.split(library_path) # drop /database from path @@ -148,7 +152,8 @@ class PhotosDB: masters_path = os.path.join(library_path, "originals") self._masters_path = masters_path - logging.debug(f"library = {library_path}, masters = {masters_path}") + if _debug(): + logging.debug(f"library = {library_path}, masters = {masters_path}") if int(self._db_version) < int(_PHOTOS_5_VERSION): self._process_database4() @@ -162,12 +167,14 @@ class PhotosDB: # logging.debug(f"tmp files = {self._tmp_files}") for f in self._tmp_files: if os.path.exists(f): - logging.debug(f"cleaning up {f}") + if _debug(): + logging.debug(f"cleaning up {f}") try: os.remove(f) self._tmp_files.remove(f) except Exception as e: - logging.debug("exception %e removing %s" % (e, f)) + if _debug(): + logging.debug("exception %e removing %s" % (e, f)) else: self._tmp_files.remove(f) @@ -334,7 +341,8 @@ class PhotosDB: raise Exception self._tmp_files.extend(tmp_files) - logging.debug(self._tmp_files) + if _debug(): + logging.debug(self._tmp_files) return tmp @@ -437,10 +445,11 @@ class PhotosDB: "cloudownerhashedpersonid": None, # Photos 5 } - logging.debug(f"Finished walking through albums") - logging.debug(pformat(self._dbalbums_album)) - logging.debug(pformat(self._dbalbums_uuid)) - logging.debug(pformat(self._dbalbum_details)) + if _debug(): + logging.debug(f"Finished walking through albums") + logging.debug(pformat(self._dbalbums_album)) + logging.debug(pformat(self._dbalbums_uuid)) + logging.debug(pformat(self._dbalbum_details)) # Get info on keywords c.execute( @@ -504,7 +513,8 @@ class PhotosDB: for row in c: uuid = row[0] - logging.debug(f"uuid = '{uuid}, master = '{row[2]}") + if _debug(): + logging.debug(f"uuid = '{uuid}, master = '{row[2]}") self._dbphotos[uuid] = {} self._dbphotos[uuid]["_uuid"] = uuid # stored here for easier debugging self._dbphotos[uuid]["modelID"] = row[1] @@ -549,7 +559,8 @@ class PhotosDB: self._dbphotos[uuid]["type"] = _MOVIE_TYPE else: # unknown - logging.debug(f"WARNING: {uuid} found unknown type {row[21]}") + if _debug(): + logging.debug(f"WARNING: {uuid} found unknown type {row[21]}") self._dbphotos[uuid]["type"] = None self._dbphotos[uuid]["UTI"] = row[22] @@ -591,10 +602,11 @@ class PhotosDB: and row[6] == 2 ): if "edit_resource_id" in self._dbphotos[uuid]: - logging.debug( - f"WARNING: found more than one edit_resource_id for " - f"UUID {row[0]},adjustmentUUID {row[1]}, modelID {row[2]}" - ) + if _debug(): + logging.debug( + f"WARNING: found more than one edit_resource_id for " + f"UUID {row[0]},adjustmentUUID {row[1]}, modelID {row[2]}" + ) # TODO: I think there should never be more than one edit but # I've seen this once in my library # should we return all edits or just most recent one? @@ -656,32 +668,34 @@ class PhotosDB: # remove temporary files self._cleanup_tmp_files() - logging.debug("Faces:") - logging.debug(pformat(self._dbfaces_uuid)) + if _debug(): + logging.debug("Faces:") + logging.debug(pformat(self._dbfaces_uuid)) - logging.debug("Keywords by uuid:") - logging.debug(pformat(self._dbkeywords_uuid)) + logging.debug("Keywords by uuid:") + logging.debug(pformat(self._dbkeywords_uuid)) - logging.debug("Keywords by keyword:") - logging.debug(pformat(self._dbkeywords_keyword)) + logging.debug("Keywords by keyword:") + logging.debug(pformat(self._dbkeywords_keyword)) - logging.debug("Albums by uuid:") - logging.debug(pformat(self._dbalbums_uuid)) + logging.debug("Albums by uuid:") + logging.debug(pformat(self._dbalbums_uuid)) - logging.debug("Albums by album:") - logging.debug(pformat(self._dbalbums_album)) + logging.debug("Albums by album:") + logging.debug(pformat(self._dbalbums_album)) - logging.debug("Volumes:") - logging.debug(pformat(self._dbvolumes)) + logging.debug("Volumes:") + logging.debug(pformat(self._dbvolumes)) - logging.debug("Photos:") - logging.debug(pformat(self._dbphotos)) + logging.debug("Photos:") + logging.debug(pformat(self._dbphotos)) def _process_database5(self): """ process the Photos database to extract info """ """ works on Photos version >= 5.0 """ - logging.debug(f"_process_database5") + if _debug(): + logging.debug(f"_process_database5") # Epoch is Jan 1, 2001 td = (datetime(2001, 1, 1, 0, 0) - datetime(1970, 1, 1, 0, 0)).total_seconds() @@ -689,7 +703,8 @@ class PhotosDB: (conn, c) = self._open_sql_file(self._tmp_db) # Look for all combinations of persons and pictures - logging.debug(f"Getting information about persons") + if _debug(): + logging.debug(f"Getting information about persons") c.execute( "SELECT ZPERSON.ZFULLNAME, ZGENERICASSET.ZUUID " @@ -707,9 +722,11 @@ class PhotosDB: self._dbfaces_person[person_name] = [] self._dbfaces_uuid[person[1]].append(person_name) self._dbfaces_person[person_name].append(person[1]) - logging.debug(f"Finished walking through persons") - logging.debug(pformat(self._dbfaces_person)) - logging.debug(self._dbfaces_uuid) + + if _debug(): + logging.debug(f"Finished walking through persons") + logging.debug(pformat(self._dbfaces_person)) + logging.debug(self._dbfaces_uuid) c.execute( "SELECT ZGENERICALBUM.ZUUID, ZGENERICASSET.ZUUID " @@ -749,10 +766,11 @@ class PhotosDB: "cloudidentifier": None, # Photos4 } - logging.debug(f"Finished walking through albums") - logging.debug(pformat(self._dbalbums_album)) - logging.debug(pformat(self._dbalbums_uuid)) - logging.debug(pformat(self._dbalbum_details)) + if _debug(): + logging.debug(f"Finished walking through albums") + logging.debug(pformat(self._dbalbums_album)) + logging.debug(pformat(self._dbalbums_uuid)) + logging.debug(pformat(self._dbalbum_details)) # get details on keywords c.execute( @@ -770,16 +788,20 @@ class PhotosDB: self._dbkeywords_keyword[keyword[0]] = [] self._dbkeywords_uuid[keyword[1]].append(keyword[0]) self._dbkeywords_keyword[keyword[0]].append(keyword[1]) - logging.debug(f"Finished walking through keywords") - logging.debug(pformat(self._dbkeywords_keyword)) - logging.debug(pformat(self._dbkeywords_uuid)) + + if _debug(): + logging.debug(f"Finished walking through keywords") + logging.debug(pformat(self._dbkeywords_keyword)) + logging.debug(pformat(self._dbkeywords_uuid)) # get details on disk volumes c.execute("SELECT ZUUID, ZNAME from ZFILESYSTEMVOLUME") for vol in c: self._dbvolumes[vol[0]] = vol[1] - logging.debug(f"Finished walking through volumes") - logging.debug(self._dbvolumes) + + if _debug(): + logging.debug(f"Finished walking through volumes") + logging.debug(self._dbvolumes) # get details about photos logging.debug(f"Getting information about photos") @@ -800,7 +822,7 @@ class PhotosDB: "ZGENERICASSET.ZLATITUDE, " "ZGENERICASSET.ZLONGITUDE, " "ZGENERICASSET.ZHASADJUSTMENTS, " - "ZGENERICASSET.ZCLOUDOWNERHASHEDPERSONID, " + "ZGENERICASSET.ZCLOUDBATCHPUBLISHDATE, " "ZGENERICASSET.ZKIND, " "ZGENERICASSET.ZUNIFORMTYPEIDENTIFIER " "FROM ZGENERICASSET " @@ -825,7 +847,7 @@ class PhotosDB: # 13 "ZGENERICASSET.ZLATITUDE, " # 14 "ZGENERICASSET.ZLONGITUDE, " # 15 "ZGENERICASSET.ZHASADJUSTMENTS " - # 16 "ZCLOUDOWNERHASHEDPERSONID " -- If not null, indicates a shared photo + # 16 "ZCLOUDBATCHPUBLISHDATE " -- If not null, indicates a shared photo # 17 "ZKIND," -- 0 = photo, 1 = movie # 18 " ZUNIFORMTYPEIDENTIFIER " -- UTI @@ -865,7 +887,7 @@ class PhotosDB: self._dbphotos[uuid]["hasAdjustments"] = row[15] - self._dbphotos[uuid]["cloudOwnerHashedPersonID"] = row[16] + self._dbphotos[uuid]["cloudbatchpublishdate"] = row[16] self._dbphotos[uuid]["shared"] = True if row[16] is not None else False # these will get filled in later @@ -883,7 +905,8 @@ class PhotosDB: elif row[17] == 1: self._dbphotos[uuid]["type"] = _MOVIE_TYPE else: - logging.debug(f"WARNING: {uuid} found unknown type {row[17]}") + if _debug(): + logging.debug(f"WARNING: {uuid} found unknown type {row[17]}") self._dbphotos[uuid]["type"] = None self._dbphotos[uuid]["UTI"] = row[18] @@ -902,9 +925,10 @@ class PhotosDB: if uuid in self._dbphotos: self._dbphotos[uuid]["extendedDescription"] = row[1] else: - logging.debug( - f"WARNING: found description {row[1]} but no photo for {uuid}" - ) + if _debug(): + logging.debug( + f"WARNING: found description {row[1]} but no photo for {uuid}" + ) # get information about adjusted/edited photos c.execute( @@ -921,32 +945,18 @@ class PhotosDB: if uuid in self._dbphotos: self._dbphotos[uuid]["adjustmentFormatID"] = row[2] else: - logging.debug( - f"WARNING: found adjustmentformatidentifier {row[2]} but no photo for uuid {row[0]}" - ) + if _debug(): + logging.debug( + f"WARNING: found adjustmentformatidentifier {row[2]} but no photo for uuid {row[0]}" + ) - # get information on local/remote availability - c.execute( - "SELECT ZGENERICASSET.ZUUID, " - "ZINTERNALRESOURCE.ZLOCALAVAILABILITY, " - "ZINTERNALRESOURCE.ZREMOTEAVAILABILITY " - "FROM ZGENERICASSET " - "JOIN ZADDITIONALASSETATTRIBUTES ON ZADDITIONALASSETATTRIBUTES.ZASSET = ZGENERICASSET.Z_PK " - "JOIN ZINTERNALRESOURCE ON ZINTERNALRESOURCE.ZFINGERPRINT = ZADDITIONALASSETATTRIBUTES.ZMASTERFINGERPRINT " - ) - - for row in c: - uuid = row[0] - if uuid in self._dbphotos: - self._dbphotos[uuid]["localAvailability"] = row[1] - self._dbphotos[uuid]["remoteAvailability"] = row[2] - if row[1] != 1: - self._dbphotos[uuid]["isMissing"] = 1 - else: - self._dbphotos[uuid]["isMissing"] = 0 + # Find missing photos + # TODO: this code is very kludgy and I had to make lots of assumptions + # it's probably wrong and needs to be re-worked once I figure out how to reliably + # determine if a photo is missing in Photos 5 # Get info on remote/local availability for photos in shared albums - # Shared photos have a null fingerprint + # Shared photos have a null fingerprint (and some other photos do too) c.execute( """ SELECT ZGENERICASSET.ZUUID, @@ -955,7 +965,37 @@ class PhotosDB: FROM ZGENERICASSET JOIN ZADDITIONALASSETATTRIBUTES ON ZADDITIONALASSETATTRIBUTES.ZASSET = ZGENERICASSET.Z_PK JOIN ZINTERNALRESOURCE ON ZINTERNALRESOURCE.ZASSET = ZADDITIONALASSETATTRIBUTES.ZASSET - WHERE ZINTERNALRESOURCE.ZFINGERPRINT IS NULL AND ZINTERNALRESOURCE.ZDATASTORESUBTYPE = 3 """ + WHERE ZDATASTORESUBTYPE = 0 OR ZDATASTORESUBTYPE = 3 """ + # WHERE ZINTERNALRESOURCE.ZFINGERPRINT IS NULL AND ZINTERNALRESOURCE.ZDATASTORESUBTYPE = 3 """ + ) + + for row in c: + uuid = row[0] + if uuid in self._dbphotos: + # and self._dbphotos[uuid]["isMissing"] is None: + self._dbphotos[uuid]["localAvailability"] = row[1] + self._dbphotos[uuid]["remoteAvailability"] = row[2] + + # old = self._dbphotos[uuid]["isMissing"] + + if row[1] != 1: + self._dbphotos[uuid]["isMissing"] = 1 + else: + self._dbphotos[uuid]["isMissing"] = 0 + + # if old is not None and old != self._dbphotos[uuid]["isMissing"]: + # logging.warning( + # f"{uuid} isMissing changed: {old} {self._dbphotos[uuid]['isMissing']}" + # ) + + # get information on local/remote availability + c.execute( + """ SELECT ZGENERICASSET.ZUUID, + ZINTERNALRESOURCE.ZLOCALAVAILABILITY, + ZINTERNALRESOURCE.ZREMOTEAVAILABILITY + FROM ZGENERICASSET + JOIN ZADDITIONALASSETATTRIBUTES ON ZADDITIONALASSETATTRIBUTES.ZASSET = ZGENERICASSET.Z_PK + JOIN ZINTERNALRESOURCE ON ZINTERNALRESOURCE.ZFINGERPRINT = ZADDITIONALASSETATTRIBUTES.ZMASTERFINGERPRINT """ ) for row in c: @@ -963,12 +1003,21 @@ class PhotosDB: if uuid in self._dbphotos: self._dbphotos[uuid]["localAvailability"] = row[1] self._dbphotos[uuid]["remoteAvailability"] = row[2] + + # old = self._dbphotos[uuid]["isMissing"] + if row[1] != 1: self._dbphotos[uuid]["isMissing"] = 1 else: self._dbphotos[uuid]["isMissing"] = 0 - logging.debug(pformat(self._dbphotos)) + # if old is not None and old != self._dbphotos[uuid]["isMissing"]: + # logging.warning( + # f"{uuid} isMissing changed: {old} {self._dbphotos[uuid]['isMissing']}" + # ) + + if _debug(): + logging.debug(pformat(self._dbphotos)) # add faces and keywords to photo data for uuid in self._dbphotos: @@ -998,26 +1047,30 @@ class PhotosDB: conn.close() self._cleanup_tmp_files() - logging.debug("Faces:") - logging.debug(pformat(self._dbfaces_uuid)) + if _debug(): + logging.debug("Faces:") + logging.debug(pformat(self._dbfaces_uuid)) - logging.debug("Keywords by uuid:") - logging.debug(pformat(self._dbkeywords_uuid)) + logging.debug("Keywords by uuid:") + logging.debug(pformat(self._dbkeywords_uuid)) - logging.debug("Keywords by keyword:") - logging.debug(pformat(self._dbkeywords_keyword)) + logging.debug("Keywords by keyword:") + logging.debug(pformat(self._dbkeywords_keyword)) - logging.debug("Albums by uuid:") - logging.debug(pformat(self._dbalbums_uuid)) + logging.debug("Albums by uuid:") + logging.debug(pformat(self._dbalbums_uuid)) - logging.debug("Albums by album:") - logging.debug(pformat(self._dbalbums_album)) + logging.debug("Albums by album:") + logging.debug(pformat(self._dbalbums_album)) - logging.debug("Volumes:") - logging.debug(pformat(self._dbvolumes)) + logging.debug("Album details:") + logging.debug(pformat(self._dbalbum_details)) - logging.debug("Photos:") - logging.debug(pformat(self._dbphotos)) + logging.debug("Volumes:") + logging.debug(pformat(self._dbvolumes)) + + logging.debug("Photos:") + logging.debug(pformat(self._dbphotos)) # TODO: fix default values to None instead of [] def photos( diff --git a/osxphotos/utils.py b/osxphotos/utils.py index 35aa945a..20a587b4 100644 --- a/osxphotos/utils.py +++ b/osxphotos/utils.py @@ -11,6 +11,41 @@ import CoreFoundation import objc from Foundation import * +_DEBUG = False + + +logging.basicConfig( + level=logging.DEBUG, + format="%(asctime)s - %(levelname)s - %(filename)s - %(lineno)d - %(message)s", +) + +if not _DEBUG: + logging.disable(logging.DEBUG) + + +def _get_logger(): + """Used only for testing + + Returns: + logging.Logger object -- logging.Logger object for osxphotos + """ + return logging.Logger(__name__) + + +def _set_debug(debug): + """ Enable or disable debug logging """ + global _DEBUG + _DEBUG = debug + if debug: + logging.disable(logging.NOTSET) + else: + logging.disable(logging.DEBUG) + + +def _debug(): + """ returns True if debugging turned on (via _set_debug), otherwise, false """ + return _DEBUG + def _get_os_version(): # returns tuple containing OS version diff --git a/tests/Test-10.12.6.photoslibrary/database/photos.db b/tests/Test-10.12.6.photoslibrary/database/photos.db index 2398a566..287f0cfb 100644 Binary files a/tests/Test-10.12.6.photoslibrary/database/photos.db and b/tests/Test-10.12.6.photoslibrary/database/photos.db differ diff --git a/tests/Test-10.12.6.photoslibrary/private/com.apple.photoanalysisd/GraphService/PhotoAnalysisServicePreferences.plist b/tests/Test-10.12.6.photoslibrary/private/com.apple.photoanalysisd/GraphService/PhotoAnalysisServicePreferences.plist index 251ecd37..1a87cb32 100644 --- a/tests/Test-10.12.6.photoslibrary/private/com.apple.photoanalysisd/GraphService/PhotoAnalysisServicePreferences.plist +++ b/tests/Test-10.12.6.photoslibrary/private/com.apple.photoanalysisd/GraphService/PhotoAnalysisServicePreferences.plist @@ -3,8 +3,8 @@ PhotoAnalysisGraphLastBackgroundGraphRebuildJobDate - 2019-12-26T14:55:03Z + 2019-12-28T22:35:14Z PhotoAnalysisGraphLastBackgroundMemoryGenerationJobDate - 2019-12-26T14:55:03Z + 2019-12-29T08:28:13Z diff --git a/tests/Test-10.12.6.photoslibrary/private/com.apple.photoanalysisd/GraphService/PhotosGraph/photosgraph-tmp.graphdb-shm b/tests/Test-10.12.6.photoslibrary/private/com.apple.photoanalysisd/GraphService/PhotosGraph/photosgraph-tmp.graphdb-shm index ca5a3e01..fe9ac284 100644 Binary files a/tests/Test-10.12.6.photoslibrary/private/com.apple.photoanalysisd/GraphService/PhotosGraph/photosgraph-tmp.graphdb-shm and b/tests/Test-10.12.6.photoslibrary/private/com.apple.photoanalysisd/GraphService/PhotosGraph/photosgraph-tmp.graphdb-shm differ diff --git a/tests/Test-10.12.6.photoslibrary/private/com.apple.photoanalysisd/GraphService/PhotosGraph/photosgraph.graphdb b/tests/Test-10.12.6.photoslibrary/private/com.apple.photoanalysisd/GraphService/PhotosGraph/photosgraph.graphdb index 14e8a717..7d347ccf 100644 Binary files a/tests/Test-10.12.6.photoslibrary/private/com.apple.photoanalysisd/GraphService/PhotosGraph/photosgraph.graphdb and b/tests/Test-10.12.6.photoslibrary/private/com.apple.photoanalysisd/GraphService/PhotosGraph/photosgraph.graphdb differ diff --git a/tests/Test-10.12.6.photoslibrary/resources/moments/analysismetadata.plist b/tests/Test-10.12.6.photoslibrary/resources/moments/analysismetadata.plist index 902fde5a..dda8c479 100644 --- a/tests/Test-10.12.6.photoslibrary/resources/moments/analysismetadata.plist +++ b/tests/Test-10.12.6.photoslibrary/resources/moments/analysismetadata.plist @@ -11,6 +11,6 @@ PLLastRevGeoForcedProviderOutOfDateCheckVersionKey 1 PLLastRevGeoVerFileFetchDateKey - 2019-12-20T15:56:12Z + 2019-12-28T22:33:47Z diff --git a/tests/Test-10.15.1.photoslibrary/database/Photos.sqlite b/tests/Test-10.15.1.photoslibrary/database/Photos.sqlite index f8c985cd..9de2ca33 100644 Binary files a/tests/Test-10.15.1.photoslibrary/database/Photos.sqlite and b/tests/Test-10.15.1.photoslibrary/database/Photos.sqlite differ diff --git a/tests/Test-10.15.1.photoslibrary/database/Photos.sqlite-shm b/tests/Test-10.15.1.photoslibrary/database/Photos.sqlite-shm index 868ba269..0fec8b29 100644 Binary files a/tests/Test-10.15.1.photoslibrary/database/Photos.sqlite-shm and b/tests/Test-10.15.1.photoslibrary/database/Photos.sqlite-shm differ diff --git a/tests/Test-10.15.1.photoslibrary/database/Photos.sqlite-wal b/tests/Test-10.15.1.photoslibrary/database/Photos.sqlite-wal index 9990975c..383bdba3 100644 Binary files a/tests/Test-10.15.1.photoslibrary/database/Photos.sqlite-wal and b/tests/Test-10.15.1.photoslibrary/database/Photos.sqlite-wal differ diff --git a/tests/Test-10.15.1.photoslibrary/database/Photos.sqlite.lock b/tests/Test-10.15.1.photoslibrary/database/Photos.sqlite.lock index aa66b22c..2f9dad2a 100644 --- a/tests/Test-10.15.1.photoslibrary/database/Photos.sqlite.lock +++ b/tests/Test-10.15.1.photoslibrary/database/Photos.sqlite.lock @@ -7,7 +7,7 @@ hostuuid 9575E48B-8D5F-5654-ABAC-4431B1167324 pid - 1986 + 16385 processname photolibraryd uid diff --git a/tests/Test-10.15.1.photoslibrary/database/search/psi.sqlite b/tests/Test-10.15.1.photoslibrary/database/search/psi.sqlite index d45acbd4..33d086f0 100644 Binary files a/tests/Test-10.15.1.photoslibrary/database/search/psi.sqlite and b/tests/Test-10.15.1.photoslibrary/database/search/psi.sqlite differ diff --git a/tests/Test-10.15.1.photoslibrary/database/search/psi.sqlite-shm b/tests/Test-10.15.1.photoslibrary/database/search/psi.sqlite-shm index fe9ac284..c029a43f 100644 Binary files a/tests/Test-10.15.1.photoslibrary/database/search/psi.sqlite-shm and b/tests/Test-10.15.1.photoslibrary/database/search/psi.sqlite-shm differ diff --git a/tests/Test-10.15.1.photoslibrary/private/com.apple.mediaanalysisd/MediaAnalysis/mediaanalysis.db b/tests/Test-10.15.1.photoslibrary/private/com.apple.mediaanalysisd/MediaAnalysis/mediaanalysis.db index f0962f0e..0a4131ab 100644 Binary files a/tests/Test-10.15.1.photoslibrary/private/com.apple.mediaanalysisd/MediaAnalysis/mediaanalysis.db and b/tests/Test-10.15.1.photoslibrary/private/com.apple.mediaanalysisd/MediaAnalysis/mediaanalysis.db differ diff --git a/tests/Test-10.15.1.photoslibrary/private/com.apple.mediaanalysisd/MediaAnalysis/mediaanalysis.db-shm b/tests/Test-10.15.1.photoslibrary/private/com.apple.mediaanalysisd/MediaAnalysis/mediaanalysis.db-shm index 759ee6b8..078c7da7 100644 Binary files a/tests/Test-10.15.1.photoslibrary/private/com.apple.mediaanalysisd/MediaAnalysis/mediaanalysis.db-shm and b/tests/Test-10.15.1.photoslibrary/private/com.apple.mediaanalysisd/MediaAnalysis/mediaanalysis.db-shm differ diff --git a/tests/Test-10.15.1.photoslibrary/private/com.apple.photoanalysisd/caches/graph/CLSBusinessCategoryCache.AOI.sqlite-shm b/tests/Test-10.15.1.photoslibrary/private/com.apple.photoanalysisd/caches/graph/CLSBusinessCategoryCache.AOI.sqlite-shm index 873fa7a5..87ad1dd1 100644 Binary files a/tests/Test-10.15.1.photoslibrary/private/com.apple.photoanalysisd/caches/graph/CLSBusinessCategoryCache.AOI.sqlite-shm and b/tests/Test-10.15.1.photoslibrary/private/com.apple.photoanalysisd/caches/graph/CLSBusinessCategoryCache.AOI.sqlite-shm differ diff --git a/tests/Test-10.15.1.photoslibrary/private/com.apple.photoanalysisd/caches/graph/CLSBusinessCategoryCache.AOI.sqlite-wal b/tests/Test-10.15.1.photoslibrary/private/com.apple.photoanalysisd/caches/graph/CLSBusinessCategoryCache.AOI.sqlite-wal index ccdee39b..142592ee 100644 Binary files a/tests/Test-10.15.1.photoslibrary/private/com.apple.photoanalysisd/caches/graph/CLSBusinessCategoryCache.AOI.sqlite-wal and b/tests/Test-10.15.1.photoslibrary/private/com.apple.photoanalysisd/caches/graph/CLSBusinessCategoryCache.AOI.sqlite-wal differ diff --git a/tests/Test-10.15.1.photoslibrary/private/com.apple.photoanalysisd/caches/graph/CLSBusinessCategoryCache.Nature.sqlite-shm b/tests/Test-10.15.1.photoslibrary/private/com.apple.photoanalysisd/caches/graph/CLSBusinessCategoryCache.Nature.sqlite-shm index f0310323..a32e80c1 100644 Binary files a/tests/Test-10.15.1.photoslibrary/private/com.apple.photoanalysisd/caches/graph/CLSBusinessCategoryCache.Nature.sqlite-shm and b/tests/Test-10.15.1.photoslibrary/private/com.apple.photoanalysisd/caches/graph/CLSBusinessCategoryCache.Nature.sqlite-shm differ diff --git a/tests/Test-10.15.1.photoslibrary/private/com.apple.photoanalysisd/caches/graph/CLSBusinessCategoryCache.Nature.sqlite-wal b/tests/Test-10.15.1.photoslibrary/private/com.apple.photoanalysisd/caches/graph/CLSBusinessCategoryCache.Nature.sqlite-wal index bc98886f..21f0cef7 100644 Binary files a/tests/Test-10.15.1.photoslibrary/private/com.apple.photoanalysisd/caches/graph/CLSBusinessCategoryCache.Nature.sqlite-wal and b/tests/Test-10.15.1.photoslibrary/private/com.apple.photoanalysisd/caches/graph/CLSBusinessCategoryCache.Nature.sqlite-wal differ diff --git a/tests/Test-10.15.1.photoslibrary/private/com.apple.photoanalysisd/caches/graph/CLSBusinessCategoryCache.POI.sqlite-shm b/tests/Test-10.15.1.photoslibrary/private/com.apple.photoanalysisd/caches/graph/CLSBusinessCategoryCache.POI.sqlite-shm index 545b1398..2919f3ce 100644 Binary files a/tests/Test-10.15.1.photoslibrary/private/com.apple.photoanalysisd/caches/graph/CLSBusinessCategoryCache.POI.sqlite-shm and b/tests/Test-10.15.1.photoslibrary/private/com.apple.photoanalysisd/caches/graph/CLSBusinessCategoryCache.POI.sqlite-shm differ diff --git a/tests/Test-10.15.1.photoslibrary/private/com.apple.photoanalysisd/caches/graph/CLSBusinessCategoryCache.POI.sqlite-wal b/tests/Test-10.15.1.photoslibrary/private/com.apple.photoanalysisd/caches/graph/CLSBusinessCategoryCache.POI.sqlite-wal index 45087261..4fb26534 100644 Binary files a/tests/Test-10.15.1.photoslibrary/private/com.apple.photoanalysisd/caches/graph/CLSBusinessCategoryCache.POI.sqlite-wal and b/tests/Test-10.15.1.photoslibrary/private/com.apple.photoanalysisd/caches/graph/CLSBusinessCategoryCache.POI.sqlite-wal differ diff --git a/tests/Test-10.15.1.photoslibrary/private/com.apple.photoanalysisd/caches/graph/CLSBusinessCategoryCache.ROI.sqlite-shm b/tests/Test-10.15.1.photoslibrary/private/com.apple.photoanalysisd/caches/graph/CLSBusinessCategoryCache.ROI.sqlite-shm index 27e890d4..f3212eb1 100644 Binary files a/tests/Test-10.15.1.photoslibrary/private/com.apple.photoanalysisd/caches/graph/CLSBusinessCategoryCache.ROI.sqlite-shm and b/tests/Test-10.15.1.photoslibrary/private/com.apple.photoanalysisd/caches/graph/CLSBusinessCategoryCache.ROI.sqlite-shm differ diff --git a/tests/Test-10.15.1.photoslibrary/private/com.apple.photoanalysisd/caches/graph/CLSBusinessCategoryCache.ROI.sqlite-wal b/tests/Test-10.15.1.photoslibrary/private/com.apple.photoanalysisd/caches/graph/CLSBusinessCategoryCache.ROI.sqlite-wal index ef81228b..700f3c01 100644 Binary files a/tests/Test-10.15.1.photoslibrary/private/com.apple.photoanalysisd/caches/graph/CLSBusinessCategoryCache.ROI.sqlite-wal and b/tests/Test-10.15.1.photoslibrary/private/com.apple.photoanalysisd/caches/graph/CLSBusinessCategoryCache.ROI.sqlite-wal differ diff --git a/tests/Test-10.15.1.photoslibrary/private/com.apple.photoanalysisd/caches/graph/CLSContactCache.sqlite-shm b/tests/Test-10.15.1.photoslibrary/private/com.apple.photoanalysisd/caches/graph/CLSContactCache.sqlite-shm index fb17d899..4de45bb9 100644 Binary files a/tests/Test-10.15.1.photoslibrary/private/com.apple.photoanalysisd/caches/graph/CLSContactCache.sqlite-shm and b/tests/Test-10.15.1.photoslibrary/private/com.apple.photoanalysisd/caches/graph/CLSContactCache.sqlite-shm differ diff --git a/tests/Test-10.15.1.photoslibrary/private/com.apple.photoanalysisd/caches/graph/CLSContactCache.sqlite-wal b/tests/Test-10.15.1.photoslibrary/private/com.apple.photoanalysisd/caches/graph/CLSContactCache.sqlite-wal index 7350f6d5..f6b8c78e 100644 Binary files a/tests/Test-10.15.1.photoslibrary/private/com.apple.photoanalysisd/caches/graph/CLSContactCache.sqlite-wal and b/tests/Test-10.15.1.photoslibrary/private/com.apple.photoanalysisd/caches/graph/CLSContactCache.sqlite-wal differ diff --git a/tests/Test-10.15.1.photoslibrary/private/com.apple.photoanalysisd/caches/graph/CLSPublicEventCache.sqlite-shm b/tests/Test-10.15.1.photoslibrary/private/com.apple.photoanalysisd/caches/graph/CLSPublicEventCache.sqlite-shm index d94b1a29..44c14f17 100644 Binary files a/tests/Test-10.15.1.photoslibrary/private/com.apple.photoanalysisd/caches/graph/CLSPublicEventCache.sqlite-shm and b/tests/Test-10.15.1.photoslibrary/private/com.apple.photoanalysisd/caches/graph/CLSPublicEventCache.sqlite-shm differ diff --git a/tests/Test-10.15.1.photoslibrary/private/com.apple.photoanalysisd/caches/graph/CLSPublicEventCache.sqlite-wal b/tests/Test-10.15.1.photoslibrary/private/com.apple.photoanalysisd/caches/graph/CLSPublicEventCache.sqlite-wal index fab94997..3a29cf02 100644 Binary files a/tests/Test-10.15.1.photoslibrary/private/com.apple.photoanalysisd/caches/graph/CLSPublicEventCache.sqlite-wal and b/tests/Test-10.15.1.photoslibrary/private/com.apple.photoanalysisd/caches/graph/CLSPublicEventCache.sqlite-wal differ diff --git a/tests/Test-10.15.1.photoslibrary/private/com.apple.photoanalysisd/caches/graph/PGCurationCache.sqlite.sqlite-shm b/tests/Test-10.15.1.photoslibrary/private/com.apple.photoanalysisd/caches/graph/PGCurationCache.sqlite.sqlite-shm index b4d3395d..35e65fc1 100644 Binary files a/tests/Test-10.15.1.photoslibrary/private/com.apple.photoanalysisd/caches/graph/PGCurationCache.sqlite.sqlite-shm and b/tests/Test-10.15.1.photoslibrary/private/com.apple.photoanalysisd/caches/graph/PGCurationCache.sqlite.sqlite-shm differ diff --git a/tests/Test-10.15.1.photoslibrary/private/com.apple.photoanalysisd/caches/graph/PGCurationCache.sqlite.sqlite-wal b/tests/Test-10.15.1.photoslibrary/private/com.apple.photoanalysisd/caches/graph/PGCurationCache.sqlite.sqlite-wal index 07aa5905..d3a77a77 100644 Binary files a/tests/Test-10.15.1.photoslibrary/private/com.apple.photoanalysisd/caches/graph/PGCurationCache.sqlite.sqlite-wal and b/tests/Test-10.15.1.photoslibrary/private/com.apple.photoanalysisd/caches/graph/PGCurationCache.sqlite.sqlite-wal differ diff --git a/tests/Test-10.15.1.photoslibrary/private/com.apple.photoanalysisd/caches/graph/PGSearchComputationCache.plist b/tests/Test-10.15.1.photoslibrary/private/com.apple.photoanalysisd/caches/graph/PGSearchComputationCache.plist index 17ec6a8e..5a74827a 100644 Binary files a/tests/Test-10.15.1.photoslibrary/private/com.apple.photoanalysisd/caches/graph/PGSearchComputationCache.plist and b/tests/Test-10.15.1.photoslibrary/private/com.apple.photoanalysisd/caches/graph/PGSearchComputationCache.plist differ diff --git a/tests/Test-10.15.1.photoslibrary/private/com.apple.photoanalysisd/caches/graph/PhotoAnalysisServicePreferences.plist b/tests/Test-10.15.1.photoslibrary/private/com.apple.photoanalysisd/caches/graph/PhotoAnalysisServicePreferences.plist index ea2e1150..3a80739c 100644 --- a/tests/Test-10.15.1.photoslibrary/private/com.apple.photoanalysisd/caches/graph/PhotoAnalysisServicePreferences.plist +++ b/tests/Test-10.15.1.photoslibrary/private/com.apple.photoanalysisd/caches/graph/PhotoAnalysisServicePreferences.plist @@ -3,24 +3,24 @@ BackgroundHighlightCollection - 2019-12-27T04:06:37Z + 2019-12-29T06:18:40Z BackgroundHighlightEnrichment - 2019-12-27T04:06:36Z + 2019-12-29T06:18:40Z BackgroundJobAssetRevGeocode - 2019-12-27T04:06:37Z + 2019-12-29T06:18:40Z BackgroundJobSearch - 2019-12-27T04:06:37Z + 2019-12-29T06:18:40Z BackgroundPeopleSuggestion - 2019-12-27T04:06:36Z + 2019-12-29T06:18:40Z BackgroundUserBehaviorProcessor - 2019-12-27T04:06:37Z + 2019-12-28T23:29:58Z PhotoAnalysisGraphLastBackgroundGraphConsistencyUpdateJobDateKey - 2019-12-27T04:06:44Z + 2019-12-29T06:18:45Z PhotoAnalysisGraphLastBackgroundGraphRebuildJobDate - 2019-12-27T04:06:36Z + 2019-12-28T23:29:57Z PhotoAnalysisGraphLastBackgroundMemoryGenerationJobDate - 2019-12-27T04:06:37Z + 2019-12-29T06:18:40Z SiriPortraitDonation - 2019-12-27T04:06:37Z + 2019-12-28T23:29:58Z diff --git a/tests/Test-10.15.1.photoslibrary/private/com.apple.photoanalysisd/caches/graph/PhotosGraph/photosgraph.kgdb b/tests/Test-10.15.1.photoslibrary/private/com.apple.photoanalysisd/caches/graph/PhotosGraph/photosgraph.kgdb index bbbcfeaa..22f25203 100644 Binary files a/tests/Test-10.15.1.photoslibrary/private/com.apple.photoanalysisd/caches/graph/PhotosGraph/photosgraph.kgdb and b/tests/Test-10.15.1.photoslibrary/private/com.apple.photoanalysisd/caches/graph/PhotosGraph/photosgraph.kgdb differ diff --git a/tests/Test-10.15.1.photoslibrary/private/com.apple.photoanalysisd/caches/vision/PhotoAnalysisServicePreferences.plist b/tests/Test-10.15.1.photoslibrary/private/com.apple.photoanalysisd/caches/vision/PhotoAnalysisServicePreferences.plist index 690cd68a..2d4d0959 100644 --- a/tests/Test-10.15.1.photoslibrary/private/com.apple.photoanalysisd/caches/vision/PhotoAnalysisServicePreferences.plist +++ b/tests/Test-10.15.1.photoslibrary/private/com.apple.photoanalysisd/caches/vision/PhotoAnalysisServicePreferences.plist @@ -3,8 +3,8 @@ FaceIDModelLastGenerationKey - 2019-12-27T04:06:38Z + 2019-12-28T23:29:59Z LastContactClassificationKey - 2019-12-27T04:06:40Z + 2019-12-28T23:30:01Z diff --git a/tests/Test-10.15.1.photoslibrary/private/com.apple.photoanalysisd/caches/vision/vnpersonsmodel.bin b/tests/Test-10.15.1.photoslibrary/private/com.apple.photoanalysisd/caches/vision/vnpersonsmodel.bin index 5e18aa81..0b6121e2 100644 Binary files a/tests/Test-10.15.1.photoslibrary/private/com.apple.photoanalysisd/caches/vision/vnpersonsmodel.bin and b/tests/Test-10.15.1.photoslibrary/private/com.apple.photoanalysisd/caches/vision/vnpersonsmodel.bin differ diff --git a/tests/Test-Movie-5_0.photoslibrary/database/DataModelVersion.plist b/tests/Test-Movie-5_0.photoslibrary/database/DataModelVersion.plist new file mode 100644 index 00000000..be9740fe --- /dev/null +++ b/tests/Test-Movie-5_0.photoslibrary/database/DataModelVersion.plist @@ -0,0 +1,10 @@ + + + + + LibrarySchemaVersion + 5001 + MetaSchemaVersion + 3 + + diff --git a/tests/Test-Movie-5_0.photoslibrary/database/Photos.sqlite b/tests/Test-Movie-5_0.photoslibrary/database/Photos.sqlite new file mode 100644 index 00000000..1b6e1530 Binary files /dev/null and b/tests/Test-Movie-5_0.photoslibrary/database/Photos.sqlite differ diff --git a/tests/Test-Movie-5_0.photoslibrary/database/Photos.sqlite-shm b/tests/Test-Movie-5_0.photoslibrary/database/Photos.sqlite-shm new file mode 100644 index 00000000..57aedf04 Binary files /dev/null and b/tests/Test-Movie-5_0.photoslibrary/database/Photos.sqlite-shm differ diff --git a/tests/Test-Movie-5_0.photoslibrary/database/Photos.sqlite-wal b/tests/Test-Movie-5_0.photoslibrary/database/Photos.sqlite-wal new file mode 100644 index 00000000..c32b73f2 Binary files /dev/null and b/tests/Test-Movie-5_0.photoslibrary/database/Photos.sqlite-wal differ diff --git a/tests/Test-Movie-5_0.photoslibrary/database/Photos.sqlite.lock b/tests/Test-Movie-5_0.photoslibrary/database/Photos.sqlite.lock new file mode 100644 index 00000000..8adbb74b --- /dev/null +++ b/tests/Test-Movie-5_0.photoslibrary/database/Photos.sqlite.lock @@ -0,0 +1,16 @@ + + + + + hostname + Rhets-MacBook-Pro.local + hostuuid + 9575E48B-8D5F-5654-ABAC-4431B1167324 + pid + 433 + processname + photolibraryd + uid + 501 + + diff --git a/tests/Test-Movie-5_0.photoslibrary/database/metaSchema.db b/tests/Test-Movie-5_0.photoslibrary/database/metaSchema.db new file mode 100644 index 00000000..2d75bd40 Binary files /dev/null and b/tests/Test-Movie-5_0.photoslibrary/database/metaSchema.db differ diff --git a/tests/Test-Movie-5_0.photoslibrary/database/photos.db b/tests/Test-Movie-5_0.photoslibrary/database/photos.db new file mode 100644 index 00000000..2d75bd40 Binary files /dev/null and b/tests/Test-Movie-5_0.photoslibrary/database/photos.db differ diff --git a/tests/Test-Movie-5_0.photoslibrary/database/protection b/tests/Test-Movie-5_0.photoslibrary/database/protection new file mode 100644 index 00000000..e69de29b diff --git a/tests/Test-Movie-5_0.photoslibrary/database/search/graphDataProgress.plist b/tests/Test-Movie-5_0.photoslibrary/database/search/graphDataProgress.plist new file mode 100644 index 00000000..c4e5e427 Binary files /dev/null and b/tests/Test-Movie-5_0.photoslibrary/database/search/graphDataProgress.plist differ diff --git a/tests/Test-Movie-5_0.photoslibrary/database/search/psi.sqlite b/tests/Test-Movie-5_0.photoslibrary/database/search/psi.sqlite new file mode 100644 index 00000000..4ab71e6c Binary files /dev/null and b/tests/Test-Movie-5_0.photoslibrary/database/search/psi.sqlite differ diff --git a/tests/Test-Movie-5_0.photoslibrary/database/search/psi.sqlite-shm b/tests/Test-Movie-5_0.photoslibrary/database/search/psi.sqlite-shm new file mode 100644 index 00000000..4b67f917 Binary files /dev/null and b/tests/Test-Movie-5_0.photoslibrary/database/search/psi.sqlite-shm differ diff --git a/tests/Test-Movie-5_0.photoslibrary/database/search/psi.sqlite-wal b/tests/Test-Movie-5_0.photoslibrary/database/search/psi.sqlite-wal new file mode 100644 index 00000000..77d1d7e1 Binary files /dev/null and b/tests/Test-Movie-5_0.photoslibrary/database/search/psi.sqlite-wal differ diff --git a/tests/Test-Movie-5_0.photoslibrary/database/search/searchProgress.plist b/tests/Test-Movie-5_0.photoslibrary/database/search/searchProgress.plist new file mode 100644 index 00000000..ad779080 --- /dev/null +++ b/tests/Test-Movie-5_0.photoslibrary/database/search/searchProgress.plist @@ -0,0 +1,26 @@ + + + + + insertAlbum + + insertAsset + + insertHighlight + + insertMemory + + insertMoment + + removeAlbum + + removeAsset + + removeHighlight + + removeMemory + + removeMoment + + + diff --git a/tests/Test-Movie-5_0.photoslibrary/database/search/searchSystemInfo.plist b/tests/Test-Movie-5_0.photoslibrary/database/search/searchSystemInfo.plist new file mode 100644 index 00000000..f6d69ef7 --- /dev/null +++ b/tests/Test-Movie-5_0.photoslibrary/database/search/searchSystemInfo.plist @@ -0,0 +1,14 @@ + + + + + embeddingVersion + 1 + localeIdentifier + en_US + sceneTaxonomySHA + 87914a047c69fbe8013fad2c70fa70c6c03b08b56190fe4054c880e6b9f57cc3 + searchIndexVersion + 10 + + diff --git a/tests/Test-Movie-5_0.photoslibrary/database/search/synonymsProcess.plist b/tests/Test-Movie-5_0.photoslibrary/database/search/synonymsProcess.plist new file mode 100644 index 00000000..c4e5e427 Binary files /dev/null and b/tests/Test-Movie-5_0.photoslibrary/database/search/synonymsProcess.plist differ diff --git a/tests/Test-Movie-5_0.photoslibrary/originals/4/423C0683-672D-4DDD-979C-23A6A53D7256.mov b/tests/Test-Movie-5_0.photoslibrary/originals/4/423C0683-672D-4DDD-979C-23A6A53D7256.mov new file mode 100644 index 00000000..65ba0db9 Binary files /dev/null and b/tests/Test-Movie-5_0.photoslibrary/originals/4/423C0683-672D-4DDD-979C-23A6A53D7256.mov differ diff --git a/tests/Test-Movie-5_0.photoslibrary/originals/5/58A275E5-D9B7-41C3-AA66-0DF46E7CC835.jpeg b/tests/Test-Movie-5_0.photoslibrary/originals/5/58A275E5-D9B7-41C3-AA66-0DF46E7CC835.jpeg new file mode 100644 index 00000000..494d60de Binary files /dev/null and b/tests/Test-Movie-5_0.photoslibrary/originals/5/58A275E5-D9B7-41C3-AA66-0DF46E7CC835.jpeg differ diff --git a/tests/Test-Movie-5_0.photoslibrary/originals/7/7588C4AF-AAAB-40C7-A828-A8B7B75834B4.jpeg b/tests/Test-Movie-5_0.photoslibrary/originals/7/7588C4AF-AAAB-40C7-A828-A8B7B75834B4.jpeg new file mode 100644 index 00000000..3748a6b4 Binary files /dev/null and b/tests/Test-Movie-5_0.photoslibrary/originals/7/7588C4AF-AAAB-40C7-A828-A8B7B75834B4.jpeg differ diff --git a/tests/Test-Movie-5_0.photoslibrary/originals/8/8503655A-1A18-4306-8350-D9A557F39061.jpeg b/tests/Test-Movie-5_0.photoslibrary/originals/8/8503655A-1A18-4306-8350-D9A557F39061.jpeg new file mode 100644 index 00000000..775207c8 Binary files /dev/null and b/tests/Test-Movie-5_0.photoslibrary/originals/8/8503655A-1A18-4306-8350-D9A557F39061.jpeg differ diff --git a/tests/Test-Movie-5_0.photoslibrary/originals/A/AB67E513-0BF5-4729-AA80-7E50F470F354.jpeg b/tests/Test-Movie-5_0.photoslibrary/originals/A/AB67E513-0BF5-4729-AA80-7E50F470F354.jpeg new file mode 100644 index 00000000..5f29bd3f Binary files /dev/null and b/tests/Test-Movie-5_0.photoslibrary/originals/A/AB67E513-0BF5-4729-AA80-7E50F470F354.jpeg differ diff --git a/tests/Test-Movie-5_0.photoslibrary/originals/B/B18047D8-FDAA-403E-B201-079A06EB39ED.jpeg b/tests/Test-Movie-5_0.photoslibrary/originals/B/B18047D8-FDAA-403E-B201-079A06EB39ED.jpeg new file mode 100644 index 00000000..4d88368a Binary files /dev/null and b/tests/Test-Movie-5_0.photoslibrary/originals/B/B18047D8-FDAA-403E-B201-079A06EB39ED.jpeg differ diff --git a/tests/Test-Movie-5_0.photoslibrary/originals/F/FF158787-3EA0-4B06-8D93-4E7E362495DE.jpeg b/tests/Test-Movie-5_0.photoslibrary/originals/F/FF158787-3EA0-4B06-8D93-4E7E362495DE.jpeg new file mode 100644 index 00000000..3f09e25b Binary files /dev/null and b/tests/Test-Movie-5_0.photoslibrary/originals/F/FF158787-3EA0-4B06-8D93-4E7E362495DE.jpeg differ diff --git a/tests/Test-Movie-5_0.photoslibrary/private/com.apple.Photos/appPrivateData.plist b/tests/Test-Movie-5_0.photoslibrary/private/com.apple.Photos/appPrivateData.plist new file mode 100644 index 00000000..08370bf1 --- /dev/null +++ b/tests/Test-Movie-5_0.photoslibrary/private/com.apple.Photos/appPrivateData.plist @@ -0,0 +1,8 @@ + + + + + CollapsedSidebarSectionIdentifiers + + + diff --git a/tests/Test-Movie-5_0.photoslibrary/private/com.apple.photoanalysisd/caches/graph/CLSBusinessCategoryCache.AOI.sqlite b/tests/Test-Movie-5_0.photoslibrary/private/com.apple.photoanalysisd/caches/graph/CLSBusinessCategoryCache.AOI.sqlite new file mode 100644 index 00000000..9ef86961 Binary files /dev/null and b/tests/Test-Movie-5_0.photoslibrary/private/com.apple.photoanalysisd/caches/graph/CLSBusinessCategoryCache.AOI.sqlite differ diff --git a/tests/Test-Movie-5_0.photoslibrary/private/com.apple.photoanalysisd/caches/graph/CLSBusinessCategoryCache.AOI.sqlite-shm b/tests/Test-Movie-5_0.photoslibrary/private/com.apple.photoanalysisd/caches/graph/CLSBusinessCategoryCache.AOI.sqlite-shm new file mode 100644 index 00000000..fe9ac284 Binary files /dev/null and b/tests/Test-Movie-5_0.photoslibrary/private/com.apple.photoanalysisd/caches/graph/CLSBusinessCategoryCache.AOI.sqlite-shm differ diff --git a/tests/Test-Movie-5_0.photoslibrary/private/com.apple.photoanalysisd/caches/graph/CLSBusinessCategoryCache.AOI.sqlite-wal b/tests/Test-Movie-5_0.photoslibrary/private/com.apple.photoanalysisd/caches/graph/CLSBusinessCategoryCache.AOI.sqlite-wal new file mode 100644 index 00000000..e69de29b diff --git a/tests/Test-Movie-5_0.photoslibrary/private/com.apple.photoanalysisd/caches/graph/CLSBusinessCategoryCache.Nature.sqlite b/tests/Test-Movie-5_0.photoslibrary/private/com.apple.photoanalysisd/caches/graph/CLSBusinessCategoryCache.Nature.sqlite new file mode 100644 index 00000000..7cdd5535 Binary files /dev/null and b/tests/Test-Movie-5_0.photoslibrary/private/com.apple.photoanalysisd/caches/graph/CLSBusinessCategoryCache.Nature.sqlite differ diff --git a/tests/Test-Movie-5_0.photoslibrary/private/com.apple.photoanalysisd/caches/graph/CLSBusinessCategoryCache.Nature.sqlite-shm b/tests/Test-Movie-5_0.photoslibrary/private/com.apple.photoanalysisd/caches/graph/CLSBusinessCategoryCache.Nature.sqlite-shm new file mode 100644 index 00000000..fe9ac284 Binary files /dev/null and b/tests/Test-Movie-5_0.photoslibrary/private/com.apple.photoanalysisd/caches/graph/CLSBusinessCategoryCache.Nature.sqlite-shm differ diff --git a/tests/Test-Movie-5_0.photoslibrary/private/com.apple.photoanalysisd/caches/graph/CLSBusinessCategoryCache.Nature.sqlite-wal b/tests/Test-Movie-5_0.photoslibrary/private/com.apple.photoanalysisd/caches/graph/CLSBusinessCategoryCache.Nature.sqlite-wal new file mode 100644 index 00000000..e69de29b diff --git a/tests/Test-Movie-5_0.photoslibrary/private/com.apple.photoanalysisd/caches/graph/CLSBusinessCategoryCache.POI.sqlite b/tests/Test-Movie-5_0.photoslibrary/private/com.apple.photoanalysisd/caches/graph/CLSBusinessCategoryCache.POI.sqlite new file mode 100644 index 00000000..e44ac0b8 Binary files /dev/null and b/tests/Test-Movie-5_0.photoslibrary/private/com.apple.photoanalysisd/caches/graph/CLSBusinessCategoryCache.POI.sqlite differ diff --git a/tests/Test-Movie-5_0.photoslibrary/private/com.apple.photoanalysisd/caches/graph/CLSBusinessCategoryCache.POI.sqlite-shm b/tests/Test-Movie-5_0.photoslibrary/private/com.apple.photoanalysisd/caches/graph/CLSBusinessCategoryCache.POI.sqlite-shm new file mode 100644 index 00000000..fe9ac284 Binary files /dev/null and b/tests/Test-Movie-5_0.photoslibrary/private/com.apple.photoanalysisd/caches/graph/CLSBusinessCategoryCache.POI.sqlite-shm differ diff --git a/tests/Test-Movie-5_0.photoslibrary/private/com.apple.photoanalysisd/caches/graph/CLSBusinessCategoryCache.POI.sqlite-wal b/tests/Test-Movie-5_0.photoslibrary/private/com.apple.photoanalysisd/caches/graph/CLSBusinessCategoryCache.POI.sqlite-wal new file mode 100644 index 00000000..e69de29b diff --git a/tests/Test-Movie-5_0.photoslibrary/private/com.apple.photoanalysisd/caches/graph/CLSBusinessCategoryCache.ROI.sqlite b/tests/Test-Movie-5_0.photoslibrary/private/com.apple.photoanalysisd/caches/graph/CLSBusinessCategoryCache.ROI.sqlite new file mode 100644 index 00000000..a32c72aa Binary files /dev/null and b/tests/Test-Movie-5_0.photoslibrary/private/com.apple.photoanalysisd/caches/graph/CLSBusinessCategoryCache.ROI.sqlite differ diff --git a/tests/Test-Movie-5_0.photoslibrary/private/com.apple.photoanalysisd/caches/graph/CLSBusinessCategoryCache.ROI.sqlite-shm b/tests/Test-Movie-5_0.photoslibrary/private/com.apple.photoanalysisd/caches/graph/CLSBusinessCategoryCache.ROI.sqlite-shm new file mode 100644 index 00000000..fe9ac284 Binary files /dev/null and b/tests/Test-Movie-5_0.photoslibrary/private/com.apple.photoanalysisd/caches/graph/CLSBusinessCategoryCache.ROI.sqlite-shm differ diff --git a/tests/Test-Movie-5_0.photoslibrary/private/com.apple.photoanalysisd/caches/graph/CLSBusinessCategoryCache.ROI.sqlite-wal b/tests/Test-Movie-5_0.photoslibrary/private/com.apple.photoanalysisd/caches/graph/CLSBusinessCategoryCache.ROI.sqlite-wal new file mode 100644 index 00000000..e69de29b diff --git a/tests/Test-Movie-5_0.photoslibrary/private/com.apple.photoanalysisd/caches/graph/CLSLocationCache.sqlite b/tests/Test-Movie-5_0.photoslibrary/private/com.apple.photoanalysisd/caches/graph/CLSLocationCache.sqlite new file mode 100644 index 00000000..caf4304f Binary files /dev/null and b/tests/Test-Movie-5_0.photoslibrary/private/com.apple.photoanalysisd/caches/graph/CLSLocationCache.sqlite differ diff --git a/tests/Test-Movie-5_0.photoslibrary/private/com.apple.photoanalysisd/caches/graph/CLSLocationCache.sqlite-shm b/tests/Test-Movie-5_0.photoslibrary/private/com.apple.photoanalysisd/caches/graph/CLSLocationCache.sqlite-shm new file mode 100644 index 00000000..fe9ac284 Binary files /dev/null and b/tests/Test-Movie-5_0.photoslibrary/private/com.apple.photoanalysisd/caches/graph/CLSLocationCache.sqlite-shm differ diff --git a/tests/Test-Movie-5_0.photoslibrary/private/com.apple.photoanalysisd/caches/graph/CLSLocationCache.sqlite-wal b/tests/Test-Movie-5_0.photoslibrary/private/com.apple.photoanalysisd/caches/graph/CLSLocationCache.sqlite-wal new file mode 100644 index 00000000..e69de29b diff --git a/tests/Test-Movie-5_0.photoslibrary/private/com.apple.photoanalysisd/caches/graph/CLSPublicEventCache.sqlite b/tests/Test-Movie-5_0.photoslibrary/private/com.apple.photoanalysisd/caches/graph/CLSPublicEventCache.sqlite new file mode 100644 index 00000000..e07a7100 Binary files /dev/null and b/tests/Test-Movie-5_0.photoslibrary/private/com.apple.photoanalysisd/caches/graph/CLSPublicEventCache.sqlite differ diff --git a/tests/Test-Movie-5_0.photoslibrary/private/com.apple.photoanalysisd/caches/graph/CLSPublicEventCache.sqlite-shm b/tests/Test-Movie-5_0.photoslibrary/private/com.apple.photoanalysisd/caches/graph/CLSPublicEventCache.sqlite-shm new file mode 100644 index 00000000..fe9ac284 Binary files /dev/null and b/tests/Test-Movie-5_0.photoslibrary/private/com.apple.photoanalysisd/caches/graph/CLSPublicEventCache.sqlite-shm differ diff --git a/tests/Test-Movie-5_0.photoslibrary/private/com.apple.photoanalysisd/caches/graph/CLSPublicEventCache.sqlite-wal b/tests/Test-Movie-5_0.photoslibrary/private/com.apple.photoanalysisd/caches/graph/CLSPublicEventCache.sqlite-wal new file mode 100644 index 00000000..e69de29b diff --git a/tests/Test-Movie-5_0.photoslibrary/private/com.apple.photoanalysisd/caches/graph/PGCurationCache.sqlite.sqlite b/tests/Test-Movie-5_0.photoslibrary/private/com.apple.photoanalysisd/caches/graph/PGCurationCache.sqlite.sqlite new file mode 100644 index 00000000..b6666cee Binary files /dev/null and b/tests/Test-Movie-5_0.photoslibrary/private/com.apple.photoanalysisd/caches/graph/PGCurationCache.sqlite.sqlite differ diff --git a/tests/Test-Movie-5_0.photoslibrary/private/com.apple.photoanalysisd/caches/graph/PGCurationCache.sqlite.sqlite-shm b/tests/Test-Movie-5_0.photoslibrary/private/com.apple.photoanalysisd/caches/graph/PGCurationCache.sqlite.sqlite-shm new file mode 100644 index 00000000..fe9ac284 Binary files /dev/null and b/tests/Test-Movie-5_0.photoslibrary/private/com.apple.photoanalysisd/caches/graph/PGCurationCache.sqlite.sqlite-shm differ diff --git a/tests/Test-Movie-5_0.photoslibrary/private/com.apple.photoanalysisd/caches/graph/PGCurationCache.sqlite.sqlite-wal b/tests/Test-Movie-5_0.photoslibrary/private/com.apple.photoanalysisd/caches/graph/PGCurationCache.sqlite.sqlite-wal new file mode 100644 index 00000000..e69de29b diff --git a/tests/Test-Movie-5_0.photoslibrary/private/com.apple.photolibraryd/appPrivateData.plist b/tests/Test-Movie-5_0.photoslibrary/private/com.apple.photolibraryd/appPrivateData.plist new file mode 100644 index 00000000..2120d8ee --- /dev/null +++ b/tests/Test-Movie-5_0.photoslibrary/private/com.apple.photolibraryd/appPrivateData.plist @@ -0,0 +1,8 @@ + + + + + PLLibraryServicesManager.LocaleIdentifier + en_US + + diff --git a/tests/Test-Movie-5_0.photoslibrary/private/com.apple.photolibraryd/caches/CreateDatabase_20191228-135447-08:00 b/tests/Test-Movie-5_0.photoslibrary/private/com.apple.photolibraryd/caches/CreateDatabase_20191228-135447-08:00 new file mode 100644 index 00000000..e69de29b diff --git a/tests/Test-Movie-5_0.photoslibrary/resources/derivatives/4/423C0683-672D-4DDD-979C-23A6A53D7256.THM b/tests/Test-Movie-5_0.photoslibrary/resources/derivatives/4/423C0683-672D-4DDD-979C-23A6A53D7256.THM new file mode 100644 index 00000000..5bc312b8 Binary files /dev/null and b/tests/Test-Movie-5_0.photoslibrary/resources/derivatives/4/423C0683-672D-4DDD-979C-23A6A53D7256.THM differ diff --git a/tests/Test-Movie-5_0.photoslibrary/resources/derivatives/4/423C0683-672D-4DDD-979C-23A6A53D7256_1_102_a.jpeg b/tests/Test-Movie-5_0.photoslibrary/resources/derivatives/4/423C0683-672D-4DDD-979C-23A6A53D7256_1_102_a.jpeg new file mode 100644 index 00000000..0cbe1420 Binary files /dev/null and b/tests/Test-Movie-5_0.photoslibrary/resources/derivatives/4/423C0683-672D-4DDD-979C-23A6A53D7256_1_102_a.jpeg differ diff --git a/tests/Test-Movie-5_0.photoslibrary/resources/derivatives/4/423C0683-672D-4DDD-979C-23A6A53D7256_1_102_o.jpeg b/tests/Test-Movie-5_0.photoslibrary/resources/derivatives/4/423C0683-672D-4DDD-979C-23A6A53D7256_1_102_o.jpeg new file mode 100644 index 00000000..a50809fd Binary files /dev/null and b/tests/Test-Movie-5_0.photoslibrary/resources/derivatives/4/423C0683-672D-4DDD-979C-23A6A53D7256_1_102_o.jpeg differ diff --git a/tests/Test-Movie-5_0.photoslibrary/resources/derivatives/4/423C0683-672D-4DDD-979C-23A6A53D7256_1_105_c.jpeg b/tests/Test-Movie-5_0.photoslibrary/resources/derivatives/4/423C0683-672D-4DDD-979C-23A6A53D7256_1_105_c.jpeg new file mode 100644 index 00000000..137bbf88 Binary files /dev/null and b/tests/Test-Movie-5_0.photoslibrary/resources/derivatives/4/423C0683-672D-4DDD-979C-23A6A53D7256_1_105_c.jpeg differ diff --git a/tests/Test-Movie-5_0.photoslibrary/resources/derivatives/5/58A275E5-D9B7-41C3-AA66-0DF46E7CC835_1_105_c.jpeg b/tests/Test-Movie-5_0.photoslibrary/resources/derivatives/5/58A275E5-D9B7-41C3-AA66-0DF46E7CC835_1_105_c.jpeg new file mode 100644 index 00000000..565aa830 Binary files /dev/null and b/tests/Test-Movie-5_0.photoslibrary/resources/derivatives/5/58A275E5-D9B7-41C3-AA66-0DF46E7CC835_1_105_c.jpeg differ diff --git a/tests/Test-Movie-5_0.photoslibrary/resources/derivatives/7/7588C4AF-AAAB-40C7-A828-A8B7B75834B4_1_105_c.jpeg b/tests/Test-Movie-5_0.photoslibrary/resources/derivatives/7/7588C4AF-AAAB-40C7-A828-A8B7B75834B4_1_105_c.jpeg new file mode 100644 index 00000000..4ec77b11 Binary files /dev/null and b/tests/Test-Movie-5_0.photoslibrary/resources/derivatives/7/7588C4AF-AAAB-40C7-A828-A8B7B75834B4_1_105_c.jpeg differ diff --git a/tests/Test-Movie-5_0.photoslibrary/resources/derivatives/8/8503655A-1A18-4306-8350-D9A557F39061_1_105_c.jpeg b/tests/Test-Movie-5_0.photoslibrary/resources/derivatives/8/8503655A-1A18-4306-8350-D9A557F39061_1_105_c.jpeg new file mode 100644 index 00000000..ac959631 Binary files /dev/null and b/tests/Test-Movie-5_0.photoslibrary/resources/derivatives/8/8503655A-1A18-4306-8350-D9A557F39061_1_105_c.jpeg differ diff --git a/tests/Test-Movie-5_0.photoslibrary/resources/derivatives/A/AB67E513-0BF5-4729-AA80-7E50F470F354_1_105_c.jpeg b/tests/Test-Movie-5_0.photoslibrary/resources/derivatives/A/AB67E513-0BF5-4729-AA80-7E50F470F354_1_105_c.jpeg new file mode 100644 index 00000000..baf15d30 Binary files /dev/null and b/tests/Test-Movie-5_0.photoslibrary/resources/derivatives/A/AB67E513-0BF5-4729-AA80-7E50F470F354_1_105_c.jpeg differ diff --git a/tests/Test-Movie-5_0.photoslibrary/resources/derivatives/B/B18047D8-FDAA-403E-B201-079A06EB39ED_1_105_c.jpeg b/tests/Test-Movie-5_0.photoslibrary/resources/derivatives/B/B18047D8-FDAA-403E-B201-079A06EB39ED_1_105_c.jpeg new file mode 100644 index 00000000..9cc96d7f Binary files /dev/null and b/tests/Test-Movie-5_0.photoslibrary/resources/derivatives/B/B18047D8-FDAA-403E-B201-079A06EB39ED_1_105_c.jpeg differ diff --git a/tests/Test-Movie-5_0.photoslibrary/resources/derivatives/F/FF158787-3EA0-4B06-8D93-4E7E362495DE_1_105_c.jpeg b/tests/Test-Movie-5_0.photoslibrary/resources/derivatives/F/FF158787-3EA0-4B06-8D93-4E7E362495DE_1_105_c.jpeg new file mode 100644 index 00000000..029ed60a Binary files /dev/null and b/tests/Test-Movie-5_0.photoslibrary/resources/derivatives/F/FF158787-3EA0-4B06-8D93-4E7E362495DE_1_105_c.jpeg differ diff --git a/tests/Test-Movie-5_0.photoslibrary/resources/derivatives/masters/4/423C0683-672D-4DDD-979C-23A6A53D7256_4_5005_c.jpeg b/tests/Test-Movie-5_0.photoslibrary/resources/derivatives/masters/4/423C0683-672D-4DDD-979C-23A6A53D7256_4_5005_c.jpeg new file mode 100644 index 00000000..e2bdf124 Binary files /dev/null and b/tests/Test-Movie-5_0.photoslibrary/resources/derivatives/masters/4/423C0683-672D-4DDD-979C-23A6A53D7256_4_5005_c.jpeg differ diff --git a/tests/Test-Movie-5_0.photoslibrary/resources/derivatives/masters/5/58A275E5-D9B7-41C3-AA66-0DF46E7CC835_4_5005_c.jpeg b/tests/Test-Movie-5_0.photoslibrary/resources/derivatives/masters/5/58A275E5-D9B7-41C3-AA66-0DF46E7CC835_4_5005_c.jpeg new file mode 100644 index 00000000..fdb2992a Binary files /dev/null and b/tests/Test-Movie-5_0.photoslibrary/resources/derivatives/masters/5/58A275E5-D9B7-41C3-AA66-0DF46E7CC835_4_5005_c.jpeg differ diff --git a/tests/Test-Movie-5_0.photoslibrary/resources/derivatives/masters/7/7588C4AF-AAAB-40C7-A828-A8B7B75834B4_4_5005_c.jpeg b/tests/Test-Movie-5_0.photoslibrary/resources/derivatives/masters/7/7588C4AF-AAAB-40C7-A828-A8B7B75834B4_4_5005_c.jpeg new file mode 100644 index 00000000..6dab5a79 Binary files /dev/null and b/tests/Test-Movie-5_0.photoslibrary/resources/derivatives/masters/7/7588C4AF-AAAB-40C7-A828-A8B7B75834B4_4_5005_c.jpeg differ diff --git a/tests/Test-Movie-5_0.photoslibrary/resources/derivatives/masters/8/8503655A-1A18-4306-8350-D9A557F39061_4_5005_c.jpeg b/tests/Test-Movie-5_0.photoslibrary/resources/derivatives/masters/8/8503655A-1A18-4306-8350-D9A557F39061_4_5005_c.jpeg new file mode 100644 index 00000000..9056e6ec Binary files /dev/null and b/tests/Test-Movie-5_0.photoslibrary/resources/derivatives/masters/8/8503655A-1A18-4306-8350-D9A557F39061_4_5005_c.jpeg differ diff --git a/tests/Test-Movie-5_0.photoslibrary/resources/derivatives/masters/A/AB67E513-0BF5-4729-AA80-7E50F470F354_4_5005_c.jpeg b/tests/Test-Movie-5_0.photoslibrary/resources/derivatives/masters/A/AB67E513-0BF5-4729-AA80-7E50F470F354_4_5005_c.jpeg new file mode 100644 index 00000000..97f42659 Binary files /dev/null and b/tests/Test-Movie-5_0.photoslibrary/resources/derivatives/masters/A/AB67E513-0BF5-4729-AA80-7E50F470F354_4_5005_c.jpeg differ diff --git a/tests/Test-Movie-5_0.photoslibrary/resources/derivatives/masters/B/B18047D8-FDAA-403E-B201-079A06EB39ED_4_5005_c.jpeg b/tests/Test-Movie-5_0.photoslibrary/resources/derivatives/masters/B/B18047D8-FDAA-403E-B201-079A06EB39ED_4_5005_c.jpeg new file mode 100644 index 00000000..d726f328 Binary files /dev/null and b/tests/Test-Movie-5_0.photoslibrary/resources/derivatives/masters/B/B18047D8-FDAA-403E-B201-079A06EB39ED_4_5005_c.jpeg differ diff --git a/tests/Test-Movie-5_0.photoslibrary/resources/derivatives/masters/F/FF158787-3EA0-4B06-8D93-4E7E362495DE_4_5005_c.jpeg b/tests/Test-Movie-5_0.photoslibrary/resources/derivatives/masters/F/FF158787-3EA0-4B06-8D93-4E7E362495DE_4_5005_c.jpeg new file mode 100644 index 00000000..2bdc938a Binary files /dev/null and b/tests/Test-Movie-5_0.photoslibrary/resources/derivatives/masters/F/FF158787-3EA0-4B06-8D93-4E7E362495DE_4_5005_c.jpeg differ diff --git a/tests/Test-Movie-5_0.photoslibrary/resources/derivatives/thumbs/3305.ithmb b/tests/Test-Movie-5_0.photoslibrary/resources/derivatives/thumbs/3305.ithmb new file mode 100644 index 00000000..a22de034 Binary files /dev/null and b/tests/Test-Movie-5_0.photoslibrary/resources/derivatives/thumbs/3305.ithmb differ diff --git a/tests/Test-Movie-5_0.photoslibrary/resources/derivatives/thumbs/4031.ithmb b/tests/Test-Movie-5_0.photoslibrary/resources/derivatives/thumbs/4031.ithmb new file mode 100644 index 00000000..f5bbb3bc Binary files /dev/null and b/tests/Test-Movie-5_0.photoslibrary/resources/derivatives/thumbs/4031.ithmb differ diff --git a/tests/Test-Movie-5_0.photoslibrary/resources/derivatives/thumbs/4132.ithmb b/tests/Test-Movie-5_0.photoslibrary/resources/derivatives/thumbs/4132.ithmb new file mode 100644 index 00000000..b5dec93f Binary files /dev/null and b/tests/Test-Movie-5_0.photoslibrary/resources/derivatives/thumbs/4132.ithmb differ diff --git a/tests/Test-Movie-5_0.photoslibrary/resources/derivatives/thumbs/thumbnailConfiguration b/tests/Test-Movie-5_0.photoslibrary/resources/derivatives/thumbs/thumbnailConfiguration new file mode 100644 index 00000000..8c122be1 --- /dev/null +++ b/tests/Test-Movie-5_0.photoslibrary/resources/derivatives/thumbs/thumbnailConfiguration @@ -0,0 +1,10 @@ + + + + + PLThumbnailManagerThumbnailFormatKey + 5005 + PLThumbnailManagerVersionKey + 28 + + diff --git a/tests/Test-Movie-5_0.photoslibrary/resources/journals/Album-snapshot.plj b/tests/Test-Movie-5_0.photoslibrary/resources/journals/Album-snapshot.plj new file mode 100644 index 00000000..e69de29b diff --git a/tests/Test-Movie-5_0.photoslibrary/resources/journals/Album.plist b/tests/Test-Movie-5_0.photoslibrary/resources/journals/Album.plist new file mode 100644 index 00000000..61f2dbc8 --- /dev/null +++ b/tests/Test-Movie-5_0.photoslibrary/resources/journals/Album.plist @@ -0,0 +1,12 @@ + + + + + currentPayloadVersion + 1 + snapshotDate + 2019-12-28T21:54:48Z + snapshotPayloadVersion + 1 + + diff --git a/tests/Test-Movie-5_0.photoslibrary/resources/journals/Asset-change.plj b/tests/Test-Movie-5_0.photoslibrary/resources/journals/Asset-change.plj new file mode 100644 index 00000000..cc6f70ea Binary files /dev/null and b/tests/Test-Movie-5_0.photoslibrary/resources/journals/Asset-change.plj differ diff --git a/tests/Test-Movie-5_0.photoslibrary/resources/journals/Asset-snapshot.plj b/tests/Test-Movie-5_0.photoslibrary/resources/journals/Asset-snapshot.plj new file mode 100644 index 00000000..e69de29b diff --git a/tests/Test-Movie-5_0.photoslibrary/resources/journals/Asset.plist b/tests/Test-Movie-5_0.photoslibrary/resources/journals/Asset.plist new file mode 100644 index 00000000..9d08275a --- /dev/null +++ b/tests/Test-Movie-5_0.photoslibrary/resources/journals/Asset.plist @@ -0,0 +1,12 @@ + + + + + currentPayloadVersion + 10 + snapshotDate + 2019-12-28T21:54:48Z + snapshotPayloadVersion + 10 + + diff --git a/tests/Test-Movie-5_0.photoslibrary/resources/journals/DeferredRebuildFace-snapshot.plj b/tests/Test-Movie-5_0.photoslibrary/resources/journals/DeferredRebuildFace-snapshot.plj new file mode 100644 index 00000000..e69de29b diff --git a/tests/Test-Movie-5_0.photoslibrary/resources/journals/DeferredRebuildFace.plist b/tests/Test-Movie-5_0.photoslibrary/resources/journals/DeferredRebuildFace.plist new file mode 100644 index 00000000..61f2dbc8 --- /dev/null +++ b/tests/Test-Movie-5_0.photoslibrary/resources/journals/DeferredRebuildFace.plist @@ -0,0 +1,12 @@ + + + + + currentPayloadVersion + 1 + snapshotDate + 2019-12-28T21:54:48Z + snapshotPayloadVersion + 1 + + diff --git a/tests/Test-Movie-5_0.photoslibrary/resources/journals/DetectedFace-snapshot.plj b/tests/Test-Movie-5_0.photoslibrary/resources/journals/DetectedFace-snapshot.plj new file mode 100644 index 00000000..e69de29b diff --git a/tests/Test-Movie-5_0.photoslibrary/resources/journals/DetectedFace.plist b/tests/Test-Movie-5_0.photoslibrary/resources/journals/DetectedFace.plist new file mode 100644 index 00000000..61f2dbc8 --- /dev/null +++ b/tests/Test-Movie-5_0.photoslibrary/resources/journals/DetectedFace.plist @@ -0,0 +1,12 @@ + + + + + currentPayloadVersion + 1 + snapshotDate + 2019-12-28T21:54:48Z + snapshotPayloadVersion + 1 + + diff --git a/tests/Test-Movie-5_0.photoslibrary/resources/journals/FetchingAlbum-snapshot.plj b/tests/Test-Movie-5_0.photoslibrary/resources/journals/FetchingAlbum-snapshot.plj new file mode 100644 index 00000000..e69de29b diff --git a/tests/Test-Movie-5_0.photoslibrary/resources/journals/FetchingAlbum.plist b/tests/Test-Movie-5_0.photoslibrary/resources/journals/FetchingAlbum.plist new file mode 100644 index 00000000..6855e79a --- /dev/null +++ b/tests/Test-Movie-5_0.photoslibrary/resources/journals/FetchingAlbum.plist @@ -0,0 +1,12 @@ + + + + + currentPayloadVersion + 2 + snapshotDate + 2019-12-28T21:54:48Z + snapshotPayloadVersion + 2 + + diff --git a/tests/Test-Movie-5_0.photoslibrary/resources/journals/FileSystemVolume-snapshot.plj b/tests/Test-Movie-5_0.photoslibrary/resources/journals/FileSystemVolume-snapshot.plj new file mode 100644 index 00000000..e69de29b diff --git a/tests/Test-Movie-5_0.photoslibrary/resources/journals/FileSystemVolume.plist b/tests/Test-Movie-5_0.photoslibrary/resources/journals/FileSystemVolume.plist new file mode 100644 index 00000000..61f2dbc8 --- /dev/null +++ b/tests/Test-Movie-5_0.photoslibrary/resources/journals/FileSystemVolume.plist @@ -0,0 +1,12 @@ + + + + + currentPayloadVersion + 1 + snapshotDate + 2019-12-28T21:54:48Z + snapshotPayloadVersion + 1 + + diff --git a/tests/Test-Movie-5_0.photoslibrary/resources/journals/Folder-snapshot.plj b/tests/Test-Movie-5_0.photoslibrary/resources/journals/Folder-snapshot.plj new file mode 100644 index 00000000..093a5986 Binary files /dev/null and b/tests/Test-Movie-5_0.photoslibrary/resources/journals/Folder-snapshot.plj differ diff --git a/tests/Test-Movie-5_0.photoslibrary/resources/journals/Folder.plist b/tests/Test-Movie-5_0.photoslibrary/resources/journals/Folder.plist new file mode 100644 index 00000000..61f2dbc8 --- /dev/null +++ b/tests/Test-Movie-5_0.photoslibrary/resources/journals/Folder.plist @@ -0,0 +1,12 @@ + + + + + currentPayloadVersion + 1 + snapshotDate + 2019-12-28T21:54:48Z + snapshotPayloadVersion + 1 + + diff --git a/tests/Test-Movie-5_0.photoslibrary/resources/journals/HistoryToken.plist b/tests/Test-Movie-5_0.photoslibrary/resources/journals/HistoryToken.plist new file mode 100644 index 00000000..536eb5e0 Binary files /dev/null and b/tests/Test-Movie-5_0.photoslibrary/resources/journals/HistoryToken.plist differ diff --git a/tests/Test-Movie-5_0.photoslibrary/resources/journals/ImportSession-change.plj b/tests/Test-Movie-5_0.photoslibrary/resources/journals/ImportSession-change.plj new file mode 100644 index 00000000..112440c2 Binary files /dev/null and b/tests/Test-Movie-5_0.photoslibrary/resources/journals/ImportSession-change.plj differ diff --git a/tests/Test-Movie-5_0.photoslibrary/resources/journals/ImportSession-snapshot.plj b/tests/Test-Movie-5_0.photoslibrary/resources/journals/ImportSession-snapshot.plj new file mode 100644 index 00000000..e69de29b diff --git a/tests/Test-Movie-5_0.photoslibrary/resources/journals/ImportSession.plist b/tests/Test-Movie-5_0.photoslibrary/resources/journals/ImportSession.plist new file mode 100644 index 00000000..61f2dbc8 --- /dev/null +++ b/tests/Test-Movie-5_0.photoslibrary/resources/journals/ImportSession.plist @@ -0,0 +1,12 @@ + + + + + currentPayloadVersion + 1 + snapshotDate + 2019-12-28T21:54:48Z + snapshotPayloadVersion + 1 + + diff --git a/tests/Test-Movie-5_0.photoslibrary/resources/journals/Keyword-change.plj b/tests/Test-Movie-5_0.photoslibrary/resources/journals/Keyword-change.plj new file mode 100644 index 00000000..199c5c17 Binary files /dev/null and b/tests/Test-Movie-5_0.photoslibrary/resources/journals/Keyword-change.plj differ diff --git a/tests/Test-Movie-5_0.photoslibrary/resources/journals/Keyword-snapshot.plj b/tests/Test-Movie-5_0.photoslibrary/resources/journals/Keyword-snapshot.plj new file mode 100644 index 00000000..e69de29b diff --git a/tests/Test-Movie-5_0.photoslibrary/resources/journals/Keyword.plist b/tests/Test-Movie-5_0.photoslibrary/resources/journals/Keyword.plist new file mode 100644 index 00000000..61f2dbc8 --- /dev/null +++ b/tests/Test-Movie-5_0.photoslibrary/resources/journals/Keyword.plist @@ -0,0 +1,12 @@ + + + + + currentPayloadVersion + 1 + snapshotDate + 2019-12-28T21:54:48Z + snapshotPayloadVersion + 1 + + diff --git a/tests/Test-Movie-5_0.photoslibrary/resources/journals/Memory-snapshot.plj b/tests/Test-Movie-5_0.photoslibrary/resources/journals/Memory-snapshot.plj new file mode 100644 index 00000000..e69de29b diff --git a/tests/Test-Movie-5_0.photoslibrary/resources/journals/Memory.plist b/tests/Test-Movie-5_0.photoslibrary/resources/journals/Memory.plist new file mode 100644 index 00000000..61f2dbc8 --- /dev/null +++ b/tests/Test-Movie-5_0.photoslibrary/resources/journals/Memory.plist @@ -0,0 +1,12 @@ + + + + + currentPayloadVersion + 1 + snapshotDate + 2019-12-28T21:54:48Z + snapshotPayloadVersion + 1 + + diff --git a/tests/Test-Movie-5_0.photoslibrary/resources/journals/Person-snapshot.plj b/tests/Test-Movie-5_0.photoslibrary/resources/journals/Person-snapshot.plj new file mode 100644 index 00000000..e69de29b diff --git a/tests/Test-Movie-5_0.photoslibrary/resources/journals/Person.plist b/tests/Test-Movie-5_0.photoslibrary/resources/journals/Person.plist new file mode 100644 index 00000000..61f2dbc8 --- /dev/null +++ b/tests/Test-Movie-5_0.photoslibrary/resources/journals/Person.plist @@ -0,0 +1,12 @@ + + + + + currentPayloadVersion + 1 + snapshotDate + 2019-12-28T21:54:48Z + snapshotPayloadVersion + 1 + + diff --git a/tests/Test-Movie-5_0.photoslibrary/resources/journals/ProjectAlbum-snapshot.plj b/tests/Test-Movie-5_0.photoslibrary/resources/journals/ProjectAlbum-snapshot.plj new file mode 100644 index 00000000..e69de29b diff --git a/tests/Test-Movie-5_0.photoslibrary/resources/journals/ProjectAlbum.plist b/tests/Test-Movie-5_0.photoslibrary/resources/journals/ProjectAlbum.plist new file mode 100644 index 00000000..61f2dbc8 --- /dev/null +++ b/tests/Test-Movie-5_0.photoslibrary/resources/journals/ProjectAlbum.plist @@ -0,0 +1,12 @@ + + + + + currentPayloadVersion + 1 + snapshotDate + 2019-12-28T21:54:48Z + snapshotPayloadVersion + 1 + + diff --git a/tests/Test-Movie-5_0.photoslibrary/resources/renders/4/423C0683-672D-4DDD-979C-23A6A53D7256.plist b/tests/Test-Movie-5_0.photoslibrary/resources/renders/4/423C0683-672D-4DDD-979C-23A6A53D7256.plist new file mode 100644 index 00000000..a3ad7784 --- /dev/null +++ b/tests/Test-Movie-5_0.photoslibrary/resources/renders/4/423C0683-672D-4DDD-979C-23A6A53D7256.plist @@ -0,0 +1,22 @@ + + + + + adjustmentBaseVersion + 0 + adjustmentData + + fY5BDoIwEEXv8tddoCCxPQdxY1g0MOiYtph2cEN6d4cD6Kx+3v95mR1+fm1FIiUpcPcd + y5qjlxvlwmuCOxkUEuH00HoHpXngSEdcgj9Ya/DxYVN07q627Q1EB2XyQZFt9AzovU5P + uKaqTHyWn4quby72r0EVPOuzvDBlOAyZI+pYvw== + + adjustmentEditorBundleID + com.apple.Photos + adjustmentFormatIdentifier + com.apple.video + adjustmentFormatVersion + 1.0 + adjustmentTimestamp + 2019-12-28T21:56:23Z + + diff --git a/tests/Test-Movie-5_0.photoslibrary/resources/renders/4/423C0683-672D-4DDD-979C-23A6A53D7256_1_201_a.jpeg b/tests/Test-Movie-5_0.photoslibrary/resources/renders/4/423C0683-672D-4DDD-979C-23A6A53D7256_1_201_a.jpeg new file mode 100644 index 00000000..698a7169 Binary files /dev/null and b/tests/Test-Movie-5_0.photoslibrary/resources/renders/4/423C0683-672D-4DDD-979C-23A6A53D7256_1_201_a.jpeg differ diff --git a/tests/Test-Movie-5_0.photoslibrary/resources/renders/4/423C0683-672D-4DDD-979C-23A6A53D7256_2_0_a.mov b/tests/Test-Movie-5_0.photoslibrary/resources/renders/4/423C0683-672D-4DDD-979C-23A6A53D7256_2_0_a.mov new file mode 100644 index 00000000..d376b563 Binary files /dev/null and b/tests/Test-Movie-5_0.photoslibrary/resources/renders/4/423C0683-672D-4DDD-979C-23A6A53D7256_2_0_a.mov differ diff --git a/tests/test_movies_5_0.py b/tests/test_movies_5_0.py new file mode 100644 index 00000000..4c33425b --- /dev/null +++ b/tests/test_movies_5_0.py @@ -0,0 +1,189 @@ +import pytest + +PHOTOS_DB = "./tests/Test-Movie-5_0.photoslibrary/database/photos.db" +PHOTOS_DB_PATH = "/Test-Movie-5_0.photoslibrary/database/photos.db" +PHOTOS_LIBRARY_PATH = "/Test-Movie-5_0.photoslibrary" + +KEYWORDS = ["test"] +PERSONS = [] +ALBUMS = [] +KEYWORDS_DICT = {"test": 1} +PERSONS_DICT = {} +ALBUM_DICT = {} + +UUID_DICT = { + "movie": "423C0683-672D-4DDD-979C-23A6A53D7256", + "image": "FF158787-3EA0-4B06-8D93-4E7E362495DE", +} + + +def test_init(): + import osxphotos + + photosdb = osxphotos.PhotosDB(dbfile=PHOTOS_DB) + assert isinstance(photosdb, osxphotos.PhotosDB) + + +def test_db_version(): + import osxphotos + + photosdb = osxphotos.PhotosDB(dbfile=PHOTOS_DB) + assert photosdb.db_version in osxphotos._constants._TESTED_DB_VERSIONS + assert photosdb.db_version == "6000" + + +def test_keywords(): + import osxphotos + import collections + + photosdb = osxphotos.PhotosDB(dbfile=PHOTOS_DB) + assert "test" in photosdb.keywords + + +def test_attributes(): + import datetime + import osxphotos + + photosdb = osxphotos.PhotosDB(dbfile=PHOTOS_DB) + photos = photosdb.photos(uuid=[UUID_DICT["movie"]], movies=True) + assert len(photos) == 1 + p = photos[0] + assert p.keywords == ["test"] + assert p.original_filename == "IMG_0670B_NOGPS.MOV" + assert p.filename == "423C0683-672D-4DDD-979C-23A6A53D7256.mov" + assert p.date == datetime.datetime( + 2019, + 12, + 28, + 12, + 19, + 54, + 0, + datetime.timezone(datetime.timedelta(seconds=-28800)), + ) + assert p.title == "Flickering Flame" + assert p.description == "Movie of a fireplace" + assert p.path.endswith( + "tests/Test-Movie-5_0.photoslibrary/originals/4/423C0683-672D-4DDD-979C-23A6A53D7256.mov" + ) + assert p.ismissing == False + assert p.hasadjustments == True + assert p.path_edited.endswith( + "tests/Test-Movie-5_0.photoslibrary/resources/renders/4/423C0683-672D-4DDD-979C-23A6A53D7256_2_0_a.mov" + ) + + +def test_hasadjustments1(): + # test hasadjustments == True + import osxphotos + + photosdb = osxphotos.PhotosDB(dbfile=PHOTOS_DB) + photos = photosdb.photos(uuid=[UUID_DICT["movie"]], movies=True) + assert len(photos) == 1 + p = photos[0] + assert p.hasadjustments == True + + +def test_path_edited1(): + # test a valid edited path + import osxphotos + + photosdb = osxphotos.PhotosDB(dbfile=PHOTOS_DB) + photos = photosdb.photos(uuid=[UUID_DICT["movie"]], movies=True) + assert len(photos) == 1 + p = photos[0] + path = p.path_edited + assert path.endswith( + "tests/Test-Movie-5_0.photoslibrary/resources/renders/4/423C0683-672D-4DDD-979C-23A6A53D7256_2_0_a.mov" + ) + + +def test_count_photos(): + import osxphotos + + photosdb = osxphotos.PhotosDB(dbfile=PHOTOS_DB) + photos = photosdb.photos() + assert len(photos) == 6 + + +def test_count_movies(): + import osxphotos + + photosdb = osxphotos.PhotosDB(dbfile=PHOTOS_DB) + photos = photosdb.photos(movies=True, images=False) + assert len(photos) == 1 + + +def test_count_movies_2(): + import osxphotos + + # if don't ask for movies=True, won't get any + photosdb = osxphotos.PhotosDB(dbfile=PHOTOS_DB) + photos = photosdb.photos(uuid=[UUID_DICT["movie"]]) + assert len(photos) == 0 + + +def test_count_all(): + import osxphotos + + photosdb = osxphotos.PhotosDB(dbfile=PHOTOS_DB) + photos = photosdb.photos(images=True, movies=True) + assert len(photos) == 7 + + +def test_uti_movie(): + import osxphotos + + photosdb = osxphotos.PhotosDB(dbfile=PHOTOS_DB) + photos = photosdb.photos(uuid=[UUID_DICT["movie"]], movies=True) + + assert photos[0].uti == "com.apple.quicktime-movie" + + +def test_uti_photo(): + import osxphotos + + photosdb = osxphotos.PhotosDB(dbfile=PHOTOS_DB) + photos = photosdb.photos(uuid=[UUID_DICT["image"]]) + + assert photos[0].uti == "public.jpeg" + + +def test_ismovie(): + import osxphotos + + photosdb = osxphotos.PhotosDB(dbfile=PHOTOS_DB) + photos = photosdb.photos(uuid=[UUID_DICT["movie"]], movies=True) + + assert photos[0].ismovie + assert not photos[0].isphoto + + +def test_ismovie_not(): + import osxphotos + + photosdb = osxphotos.PhotosDB(dbfile=PHOTOS_DB) + photos = photosdb.photos(uuid=[UUID_DICT["image"]]) + + assert not photos[0].ismovie + assert photos[0].isphoto + + +def test_isphoto(): + import osxphotos + + photosdb = osxphotos.PhotosDB(dbfile=PHOTOS_DB) + photos = photosdb.photos(uuid=[UUID_DICT["image"]]) + + assert photos[0].isphoto + assert not photos[0].ismovie + + +def test_isphoto_false(): + import osxphotos + + photosdb = osxphotos.PhotosDB(dbfile=PHOTOS_DB) + photos = photosdb.photos(uuid=[UUID_DICT["movie"]], movies=True) + + assert not photos[0].isphoto + assert photos[0].ismovie diff --git a/tests/test_utils.py b/tests/test_utils.py index e3caa482..cad65cea 100644 --- a/tests/test_utils.py +++ b/tests/test_utils.py @@ -5,9 +5,8 @@ def test_debug_enable(): import osxphotos import logging - osxphotos._debug(True) + osxphotos._set_debug(True) logger = osxphotos._get_logger() - logging.warning(logger) assert logger.isEnabledFor(logging.DEBUG) @@ -15,9 +14,8 @@ def test_debug_disable(): import osxphotos import logging - osxphotos._debug(False) + osxphotos._set_debug(False) logger = osxphotos._get_logger() - logging.warning(logger) assert not logger.isEnabledFor(logging.DEBUG)