Added height, width, orientation, filesize, closes #163

This commit is contained in:
Rhet Turnbull
2020-07-03 11:24:59 -07:00
parent 6ab0ad7e86
commit 541c390b7b
6 changed files with 192 additions and 4 deletions

View File

@@ -1,3 +1,3 @@
""" version info """
__version__ = "0.30.4"
__version__ = "0.30.5"

View File

@@ -642,6 +642,41 @@ class PhotoInfo:
otherwise returns False """
return self._info["raw_is_original"]
@property
def height(self):
""" returns height of the current photo version in pixels """
return self._info["height"]
@property
def width(self):
""" returns width of the current photo version in pixels """
return self._info["width"]
@property
def orientation(self):
""" returns EXIF orientation of the current photo version as int """
return self._info["orientation"]
@property
def original_height(self):
""" returns height of the original photo version in pixels """
return self._info["original_height"]
@property
def original_width(self):
""" returns width of the original photo version in pixels """
return self._info["original_width"]
@property
def original_orientation(self):
""" returns EXIF orientation of the original photo version as int """
return self._info["original_orientation"]
@property
def original_filesize(self):
""" returns filesize of original photo in bytes as int """
return self._info["original_filesize"]
def render_template(
self,
template_str,

View File

@@ -716,7 +716,14 @@ class PhotosDB:
RKVersion.rawMasterUuid,
RKVersion.nonRawMasterUuid,
RKMaster.alternateMasterUuid,
RKVersion.isInTrash
RKVersion.isInTrash,
RKVersion.processedHeight,
RKVersion.processedWidth,
RKVersion.orientation,
RKMaster.height,
RKMaster.width,
RKMaster.orientation,
RKMaster.fileSize
FROM RKVersion, RKMaster
WHERE RKVersion.masterUuid = RKMaster.uuid"""
)
@@ -736,7 +743,14 @@ class PhotosDB:
RKVersion.rawMasterUuid,
RKVersion.nonRawMasterUuid,
RKMaster.alternateMasterUuid,
RKVersion.isInTrash
RKVersion.isInTrash,
RKVersion.processedHeight,
RKVersion.processedWidth,
RKVersion.orientation,
RKMaster.height,
RKMaster.width,
RKMaster.orientation,
RKMaster.originalFileSize
FROM RKVersion, RKMaster
WHERE RKVersion.masterUuid = RKMaster.uuid"""
)
@@ -775,6 +789,13 @@ class PhotosDB:
# 30 RKVersion.nonRawMasterUuid, -- UUID of non-RAW master
# 31 RKMaster.alternateMasterUuid -- UUID of alternate master (will be RAW master for JPEG and JPEG master for RAW)
# 32 RKVersion.isInTrash
# 33 RKVersion.processedHeight,
# 34 RKVersion.processedWidth,
# 35 RKVersion.orientation,
# 36 RKMaster.height,
# 37 RKMaster.width,
# 38 RKMaster.orientation,
# 39 RKMaster.originalFileSize
for row in c:
uuid = row[0]
@@ -920,6 +941,15 @@ class PhotosDB:
# recently deleted items
self._dbphotos[uuid]["intrash"] = True if row[32] == 1 else False
# height/width/orientation
self._dbphotos[uuid]["height"] = row[33]
self._dbphotos[uuid]["width"] = row[34]
self._dbphotos[uuid]["orientation"] = row[35]
self._dbphotos[uuid]["original_height"] = row[36]
self._dbphotos[uuid]["original_width"] = row[37]
self._dbphotos[uuid]["original_orientation"] = row[38]
self._dbphotos[uuid]["original_filesize"] = row[39]
# get additional details from RKMaster, needed for RAW processing
c.execute(
""" SELECT
@@ -1457,7 +1487,14 @@ class PhotosDB:
ZADDITIONALASSETATTRIBUTES.ZREVERSELOCATIONDATA,
ZGENERICASSET.ZMOMENT,
ZADDITIONALASSETATTRIBUTES.ZORIGINALRESOURCECHOICE,
ZGENERICASSET.ZTRASHEDSTATE
ZGENERICASSET.ZTRASHEDSTATE,
ZGENERICASSET.ZHEIGHT,
ZGENERICASSET.ZWIDTH,
ZGENERICASSET.ZORIENTATION,
ZADDITIONALASSETATTRIBUTES.ZORIGINALHEIGHT,
ZADDITIONALASSETATTRIBUTES.ZORIGINALWIDTH,
ZADDITIONALASSETATTRIBUTES.ZORIGINALORIENTATION,
ZADDITIONALASSETATTRIBUTES.ZORIGINALFILESIZE
FROM ZGENERICASSET
JOIN ZADDITIONALASSETATTRIBUTES ON ZADDITIONALASSETATTRIBUTES.ZASSET = ZGENERICASSET.Z_PK
ORDER BY ZGENERICASSET.ZUUID """
@@ -1493,6 +1530,13 @@ class PhotosDB:
# 26 ZGENERICASSET.ZMOMENT -- FK for ZMOMENT.Z_PK
# 27 ZADDITIONALASSETATTRIBUTES.ZORIGINALRESOURCECHOICE -- 1 if associated RAW image is original else 0
# 28 ZGENERICASSET.ZTRASHEDSTATE -- 0 if not in trash, 1 if in trash
# 29 ZGENERICASSET.ZHEIGHT,
# 30 ZGENERICASSET.ZWIDTH,
# 31 ZGENERICASSET.ZORIENTATION,
# 32 ZADDITIONALASSETATTRIBUTES.ZORIGINALHEIGHT,
# 33 ZADDITIONALASSETATTRIBUTES.ZORIGINALWIDTH,
# 34 ZADDITIONALASSETATTRIBUTES.ZORIGINALORIENTATION,
# 35 ZADDITIONALASSETATTRIBUTES.ZORIGINALFILESIZE
for row in c:
uuid = row[0]
@@ -1644,6 +1688,15 @@ class PhotosDB:
# recently deleted items
info["intrash"] = True if row[28] == 1 else False
# height/width/orientation
info["height"] = row[29]
info["width"] = row[30]
info["orientation"] = row[31]
info["original_height"] = row[32]
info["original_width"] = row[33]
info["original_orientation"] = row[34]
info["original_filesize"] = row[35]
# associated RAW image info
# will be filled in later
info["has_raw"] = False