Added tests for hidden and favorite to both 14.6 and 15.1
@@ -378,6 +378,7 @@ class PhotosDB:
|
||||
""" process the Photos database to extract info """
|
||||
""" works on Photos version <= 4.0 """
|
||||
|
||||
#TODO: Update strings to remove + (not needed)
|
||||
# Epoch is Jan 1, 2001
|
||||
td = (datetime(2001, 1, 1, 0, 0) - datetime(1970, 1, 1, 0, 0)).total_seconds()
|
||||
|
||||
@@ -489,7 +490,8 @@ class PhotosDB:
|
||||
+ "RKVersion.lastmodifieddate, RKVersion.imageDate, RKVersion.mainRating, "
|
||||
+ "RKVersion.hasAdjustments, RKVersion.hasKeywords, RKVersion.imageTimeZoneOffsetSeconds, "
|
||||
+ "RKMaster.volumeId, RKMaster.imagePath, RKVersion.extendedDescription, RKVersion.name, "
|
||||
+ "RKMaster.isMissing, RKMaster.originalFileName, RKVersion.isFavorite, RKVersion.isHidden "
|
||||
+ "RKMaster.isMissing, RKMaster.originalFileName, RKVersion.isFavorite, RKVersion.isHidden, "
|
||||
+ "RKVersion.longitude, RKVersion.latitude "
|
||||
+ "from RKVersion, RKMaster where RKVersion.isInTrash = 0 and RKVersion.type = 2 and "
|
||||
+ "RKVersion.masterUuid = RKMaster.uuid and RKVersion.filename not like '%.pdf'"
|
||||
)
|
||||
@@ -527,6 +529,9 @@ class PhotosDB:
|
||||
self._dbphotos[uuid]["originalFilename"] = row[15]
|
||||
self._dbphotos[uuid]["favorite"] = row[16]
|
||||
self._dbphotos[uuid]["hidden"] = row[17]
|
||||
self._dbphotos[uuid]["longitude"] = row[18]
|
||||
self._dbphotos[uuid]["latitude"] = row[19]
|
||||
|
||||
|
||||
conn.close()
|
||||
|
||||
@@ -1082,6 +1087,14 @@ class PhotoInfo:
|
||||
""" True if picture is hidden """
|
||||
return True if self.__info["hidden"] == 1 else False
|
||||
|
||||
def longitude(self):
|
||||
""" Returns longitude, in degrees """
|
||||
return self.__info["longitude"]
|
||||
|
||||
def latitude(self):
|
||||
""" Returns latitude, in degrees """
|
||||
return self.__info["latitude"]
|
||||
|
||||
def __repr__(self):
|
||||
return f"osxphotos.PhotoInfo(db={self.__db}, uuid='{self.__uuid}', info={self.__info})"
|
||||
|
||||
|
||||
|
Before Width: | Height: | Size: 541 KiB After Width: | Height: | Size: 545 KiB |
|
After Width: | Height: | Size: 545 KiB |
|
Before Width: | Height: | Size: 528 KiB After Width: | Height: | Size: 532 KiB |
|
After Width: | Height: | Size: 532 KiB |
|
Before Width: | Height: | Size: 574 KiB After Width: | Height: | Size: 578 KiB |
|
After Width: | Height: | Size: 578 KiB |
|
Before Width: | Height: | Size: 1.2 MiB After Width: | Height: | Size: 1.2 MiB |
|
After Width: | Height: | Size: 1.2 MiB |
|
Before Width: | Height: | Size: 500 KiB After Width: | Height: | Size: 504 KiB |
|
After Width: | Height: | Size: 504 KiB |
|
Before Width: | Height: | Size: 450 KiB After Width: | Height: | Size: 453 KiB |
|
After Width: | Height: | Size: 453 KiB |
@@ -14,7 +14,7 @@
|
||||
<key>IPXWorkspaceControllerZoomLevelsKey</key>
|
||||
<dict>
|
||||
<key>kZoomLevelIdentifierAlbums</key>
|
||||
<integer>7</integer>
|
||||
<integer>10</integer>
|
||||
<key>kZoomLevelIdentifierVersions</key>
|
||||
<integer>7</integer>
|
||||
</dict>
|
||||
@@ -34,7 +34,7 @@
|
||||
<key>other</key>
|
||||
<integer>0</integer>
|
||||
<key>photos</key>
|
||||
<integer>7</integer>
|
||||
<integer>6</integer>
|
||||
<key>videos</key>
|
||||
<integer>0</integer>
|
||||
</dict>
|
||||
|
||||
@@ -3,8 +3,8 @@
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>PhotoAnalysisGraphLastBackgroundGraphRebuildJobDate</key>
|
||||
<date>2019-08-07T02:26:15Z</date>
|
||||
<date>2019-11-18T01:38:02Z</date>
|
||||
<key>PhotoAnalysisGraphLastBackgroundMemoryGenerationJobDate</key>
|
||||
<date>2019-08-17T14:26:34Z</date>
|
||||
<date>2019-11-27T05:30:14Z</date>
|
||||
</dict>
|
||||
</plist>
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
<key>LithiumMessageTracer</key>
|
||||
<dict>
|
||||
<key>LastReportedDate</key>
|
||||
<date>2019-08-04T13:32:55Z</date>
|
||||
<date>2019-11-18T04:50:50Z</date>
|
||||
</dict>
|
||||
</dict>
|
||||
</plist>
|
||||
|
||||
@@ -11,6 +11,6 @@
|
||||
<key>PLLastRevGeoForcedProviderOutOfDateCheckVersionKey</key>
|
||||
<integer>1</integer>
|
||||
<key>PLLastRevGeoVerFileFetchDateKey</key>
|
||||
<date>2019-08-16T02:08:50Z</date>
|
||||
<date>2019-11-27T05:30:19Z</date>
|
||||
</dict>
|
||||
</plist>
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>LastHistoryRowId</key>
|
||||
<integer>508</integer>
|
||||
<integer>522</integer>
|
||||
<key>LibraryBuildTag</key>
|
||||
<string>D8C4AAA1-3AB6-4A65-BEBD-99CC3E5D433E</string>
|
||||
<key>LibrarySchemaVersion</key>
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
<key>HistoricalMarker</key>
|
||||
<dict>
|
||||
<key>LastHistoryRowId</key>
|
||||
<integer>508</integer>
|
||||
<integer>522</integer>
|
||||
<key>LibraryBuildTag</key>
|
||||
<string>D8C4AAA1-3AB6-4A65-BEBD-99CC3E5D433E</string>
|
||||
<key>LibrarySchemaVersion</key>
|
||||
@@ -24,7 +24,7 @@
|
||||
<key>SnapshotCompletedDate</key>
|
||||
<date>2019-07-27T13:16:43Z</date>
|
||||
<key>SnapshotLastValidated</key>
|
||||
<date>2019-08-16T02:08:49Z</date>
|
||||
<date>2019-11-27T05:30:11Z</date>
|
||||
<key>SnapshotTables</key>
|
||||
<dict/>
|
||||
</dict>
|
||||
|
||||
@@ -152,6 +152,16 @@ def test_favorite():
|
||||
assert p.favorite() == True
|
||||
|
||||
|
||||
def test_not_favorite():
|
||||
import osxphotos
|
||||
|
||||
photosdb = osxphotos.PhotosDB(dbfile=PHOTOS_DB)
|
||||
photos = photosdb.photos(uuid=["A1DD1F98-2ECD-431F-9AC9-5AFEFE2D3A5C"])
|
||||
assert len(photos) == 1
|
||||
p = photos[0]
|
||||
assert p.favorite() == False
|
||||
|
||||
|
||||
def test_hidden():
|
||||
import osxphotos
|
||||
|
||||
@@ -162,6 +172,16 @@ def test_hidden():
|
||||
assert p.hidden() == True
|
||||
|
||||
|
||||
def test_not_hidden():
|
||||
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.hidden() == False
|
||||
|
||||
|
||||
def test_count():
|
||||
import osxphotos
|
||||
|
||||
|
||||
@@ -141,6 +141,46 @@ def test_missing():
|
||||
assert p.ismissing() == True
|
||||
|
||||
|
||||
def test_favorite():
|
||||
import osxphotos
|
||||
|
||||
photosdb = osxphotos.PhotosDB(dbfile=PHOTOS_DB)
|
||||
photos = photosdb.photos(uuid=["6bxcNnzRQKGnK4uPrCJ9UQ"])
|
||||
assert len(photos) == 1
|
||||
p = photos[0]
|
||||
assert p.favorite() == True
|
||||
|
||||
|
||||
def test_not_favorite():
|
||||
import osxphotos
|
||||
|
||||
photosdb = osxphotos.PhotosDB(dbfile=PHOTOS_DB)
|
||||
photos = photosdb.photos(uuid=["od0fmC7NQx+ayVr+%i06XA"])
|
||||
assert len(photos) == 1
|
||||
p = photos[0]
|
||||
assert p.favorite() == False
|
||||
|
||||
|
||||
def test_hidden():
|
||||
import osxphotos
|
||||
|
||||
photosdb = osxphotos.PhotosDB(dbfile=PHOTOS_DB)
|
||||
photos = photosdb.photos(uuid=["od0fmC7NQx+ayVr+%i06XA"])
|
||||
assert len(photos) == 1
|
||||
p = photos[0]
|
||||
assert p.hidden() == True
|
||||
|
||||
|
||||
def test_not_hidden():
|
||||
import osxphotos
|
||||
|
||||
photosdb = osxphotos.PhotosDB(dbfile=PHOTOS_DB)
|
||||
photos = photosdb.photos(uuid=["6bxcNnzRQKGnK4uPrCJ9UQ"])
|
||||
assert len(photos) == 1
|
||||
p = photos[0]
|
||||
assert p.hidden() == False
|
||||
|
||||
|
||||
def test_count():
|
||||
import osxphotos
|
||||
|
||||
|
||||