added hasadjustments and tests for Photo5
This commit is contained in:
@@ -736,7 +736,8 @@ class PhotosDB:
|
|||||||
"ZGENERICASSET.ZDIRECTORY, "
|
"ZGENERICASSET.ZDIRECTORY, "
|
||||||
"ZGENERICASSET.ZFILENAME, "
|
"ZGENERICASSET.ZFILENAME, "
|
||||||
"ZGENERICASSET.ZLATITUDE, "
|
"ZGENERICASSET.ZLATITUDE, "
|
||||||
"ZGENERICASSET.ZLONGITUDE "
|
"ZGENERICASSET.ZLONGITUDE, "
|
||||||
|
"ZGENERICASSET.ZHASADJUSTMENTS "
|
||||||
"FROM ZGENERICASSET "
|
"FROM ZGENERICASSET "
|
||||||
"JOIN ZADDITIONALASSETATTRIBUTES ON ZADDITIONALASSETATTRIBUTES.ZASSET = ZGENERICASSET.Z_PK "
|
"JOIN ZADDITIONALASSETATTRIBUTES ON ZADDITIONALASSETATTRIBUTES.ZASSET = ZGENERICASSET.Z_PK "
|
||||||
"WHERE ZGENERICASSET.ZTRASHEDSTATE = 0 AND ZGENERICASSET.ZKIND = 0 "
|
"WHERE ZGENERICASSET.ZTRASHEDSTATE = 0 AND ZGENERICASSET.ZKIND = 0 "
|
||||||
@@ -764,7 +765,8 @@ class PhotosDB:
|
|||||||
# 11 "ZGENERICASSET.ZDIRECTORY, "
|
# 11 "ZGENERICASSET.ZDIRECTORY, "
|
||||||
# 12 "ZGENERICASSET.ZFILENAME, "
|
# 12 "ZGENERICASSET.ZFILENAME, "
|
||||||
# 13 "ZGENERICASSET.ZLATITUDE, "
|
# 13 "ZGENERICASSET.ZLATITUDE, "
|
||||||
# 14 "ZGENERICASSET.ZLONGITUDE "
|
# 14 "ZGENERICASSET.ZLONGITUDE, "
|
||||||
|
# 15 "ZGENERICASSET.ZHASADJUSTMENTS "
|
||||||
|
|
||||||
i = 0
|
i = 0
|
||||||
for row in c:
|
for row in c:
|
||||||
@@ -811,13 +813,14 @@ class PhotosDB:
|
|||||||
self._dbphotos[uuid]["latitude"] = row[13]
|
self._dbphotos[uuid]["latitude"] = row[13]
|
||||||
self._dbphotos[uuid]["longitude"] = row[14]
|
self._dbphotos[uuid]["longitude"] = row[14]
|
||||||
|
|
||||||
|
self._dbphotos[uuid]["hasAdjustments"] = row[15]
|
||||||
|
|
||||||
# these will get filled in later
|
# these will get filled in later
|
||||||
# init to avoid key errors
|
# init to avoid key errors
|
||||||
self._dbphotos[uuid]["extendedDescription"] = None # fill this in later
|
self._dbphotos[uuid]["extendedDescription"] = None # fill this in later
|
||||||
self._dbphotos[uuid]["localAvailability"] = None
|
self._dbphotos[uuid]["localAvailability"] = None
|
||||||
self._dbphotos[uuid]["remoteAvailability"] = None
|
self._dbphotos[uuid]["remoteAvailability"] = None
|
||||||
self._dbphotos[uuid]["isMissing"] = None
|
self._dbphotos[uuid]["isMissing"] = None
|
||||||
self._dbphotos[uuid]["hasAdjustments"] = None
|
|
||||||
|
|
||||||
# self._dbphotos[uuid]["isMissing"] = row[14]
|
# self._dbphotos[uuid]["isMissing"] = row[14]
|
||||||
|
|
||||||
|
|||||||
@@ -208,6 +208,28 @@ def test_location_2():
|
|||||||
assert lon is None
|
assert lon is None
|
||||||
|
|
||||||
|
|
||||||
|
def test_hasadjustments1():
|
||||||
|
# test hasadjustments == True
|
||||||
|
import osxphotos
|
||||||
|
|
||||||
|
photosdb = osxphotos.PhotosDB(dbfile=PHOTOS_DB)
|
||||||
|
photos = photosdb.photos(uuid=["E9BC5C36-7CD1-40A1-A72B-8B8FAC227D51"])
|
||||||
|
assert len(photos) == 1
|
||||||
|
p = photos[0]
|
||||||
|
assert p.hasadjustments() == True
|
||||||
|
|
||||||
|
|
||||||
|
def test_hasadjustments2():
|
||||||
|
# test hasadjustments == False
|
||||||
|
import osxphotos
|
||||||
|
|
||||||
|
photosdb = osxphotos.PhotosDB(dbfile=PHOTOS_DB)
|
||||||
|
photos = photosdb.photos(uuid=["6191423D-8DB8-4D4C-92BE-9BBBA308AAC4"])
|
||||||
|
assert len(photos) == 1
|
||||||
|
p = photos[0]
|
||||||
|
assert p.hasadjustments() == False
|
||||||
|
|
||||||
|
|
||||||
def test_count():
|
def test_count():
|
||||||
import osxphotos
|
import osxphotos
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user