Temporary fix to filter out unselected burst photos
This commit is contained in:
@@ -806,7 +806,7 @@ class PhotosDB:
|
|||||||
# get details about photos
|
# get details about photos
|
||||||
logging.debug(f"Getting information about photos")
|
logging.debug(f"Getting information about photos")
|
||||||
c.execute(
|
c.execute(
|
||||||
""" SELECT ZGENERICASSET.ZUUID,
|
"""SELECT ZGENERICASSET.ZUUID,
|
||||||
ZADDITIONALASSETATTRIBUTES.ZMASTERFINGERPRINT,
|
ZADDITIONALASSETATTRIBUTES.ZMASTERFINGERPRINT,
|
||||||
ZADDITIONALASSETATTRIBUTES.ZTITLE,
|
ZADDITIONALASSETATTRIBUTES.ZTITLE,
|
||||||
ZADDITIONALASSETATTRIBUTES.ZORIGINALFILENAME,
|
ZADDITIONALASSETATTRIBUTES.ZORIGINALFILENAME,
|
||||||
@@ -824,92 +824,102 @@ class PhotosDB:
|
|||||||
ZGENERICASSET.ZHASADJUSTMENTS,
|
ZGENERICASSET.ZHASADJUSTMENTS,
|
||||||
ZGENERICASSET.ZCLOUDBATCHPUBLISHDATE,
|
ZGENERICASSET.ZCLOUDBATCHPUBLISHDATE,
|
||||||
ZGENERICASSET.ZKIND,
|
ZGENERICASSET.ZKIND,
|
||||||
ZGENERICASSET.ZUNIFORMTYPEIDENTIFIER
|
ZGENERICASSET.ZUNIFORMTYPEIDENTIFIER,
|
||||||
|
ZGENERICASSET.ZAVALANCHEUUID,
|
||||||
|
ZGENERICASSET.ZAVALANCHEPICKTYPE
|
||||||
FROM ZGENERICASSET
|
FROM ZGENERICASSET
|
||||||
JOIN ZADDITIONALASSETATTRIBUTES ON ZADDITIONALASSETATTRIBUTES.ZASSET = ZGENERICASSET.Z_PK
|
JOIN ZADDITIONALASSETATTRIBUTES ON ZADDITIONALASSETATTRIBUTES.ZASSET = ZGENERICASSET.Z_PK
|
||||||
WHERE ZGENERICASSET.ZTRASHEDSTATE = 0
|
WHERE ZGENERICASSET.ZTRASHEDSTATE = 0
|
||||||
ORDER BY ZGENERICASSET.ZUUID """
|
ORDER BY ZGENERICASSET.ZUUID """
|
||||||
)
|
)
|
||||||
# Order of results
|
# Order of results
|
||||||
# 0 "SELECT ZGENERICASSET.ZUUID, "
|
# 0 SELECT ZGENERICASSET.ZUUID,
|
||||||
# 1 "ZADDITIONALASSETATTRIBUTES.ZMASTERFINGERPRINT, "
|
# 1 ZADDITIONALASSETATTRIBUTES.ZMASTERFINGERPRINT,
|
||||||
# 2 "ZADDITIONALASSETATTRIBUTES.ZTITLE, "
|
# 2 ZADDITIONALASSETATTRIBUTES.ZTITLE,
|
||||||
# 3 "ZADDITIONALASSETATTRIBUTES.ZORIGINALFILENAME, "
|
# 3 ZADDITIONALASSETATTRIBUTES.ZORIGINALFILENAME,
|
||||||
# 4 "ZGENERICASSET.ZMODIFICATIONDATE, "
|
# 4 ZGENERICASSET.ZMODIFICATIONDATE,
|
||||||
# 5 "ZGENERICASSET.ZDATECREATED, "
|
# 5 ZGENERICASSET.ZDATECREATED,
|
||||||
# 6 "ZADDITIONALASSETATTRIBUTES.ZTIMEZONEOFFSET, "
|
# 6 ZADDITIONALASSETATTRIBUTES.ZTIMEZONEOFFSET,
|
||||||
# 7 "ZADDITIONALASSETATTRIBUTES.ZINFERREDTIMEZONEOFFSET, "
|
# 7 ZADDITIONALASSETATTRIBUTES.ZINFERREDTIMEZONEOFFSET,
|
||||||
# 8 "ZADDITIONALASSETATTRIBUTES.ZTIMEZONENAME, "
|
# 8 ZADDITIONALASSETATTRIBUTES.ZTIMEZONENAME,
|
||||||
# 9 "ZGENERICASSET.ZHIDDEN, "
|
# 9 ZGENERICASSET.ZHIDDEN,
|
||||||
# 10 "ZGENERICASSET.ZFAVORITE, "
|
# 10 ZGENERICASSET.ZFAVORITE,
|
||||||
# 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 "
|
# 15 ZGENERICASSET.ZHASADJUSTMENTS
|
||||||
# 16 "ZCLOUDBATCHPUBLISHDATE " -- If not null, indicates a shared photo
|
# 16 ZCLOUDBATCHPUBLISHDATE -- If not null, indicates a shared photo
|
||||||
# 17 "ZKIND," -- 0 = photo, 1 = movie
|
# 17 ZKIND, -- 0 = photo, 1 = movie
|
||||||
# 18 " ZUNIFORMTYPEIDENTIFIER " -- UTI
|
# 18 ZUNIFORMTYPEIDENTIFIER -- UTI
|
||||||
|
# 19 ZGENERICASSET.ZAVALANCHEUUID, -- if not NULL, is burst photo
|
||||||
|
# 20 ZGENERICASSET.ZAVALANCHEPICKTYPE -- if not 2, is a selected burst photo
|
||||||
|
|
||||||
for row in c:
|
for row in c:
|
||||||
uuid = row[0]
|
uuid = row[0]
|
||||||
self._dbphotos[uuid] = {}
|
info = {}
|
||||||
self._dbphotos[uuid]["_uuid"] = uuid # stored here for easier debugging
|
info["_uuid"] = uuid # stored here for easier debugging
|
||||||
self._dbphotos[uuid]["modelID"] = None
|
info["modelID"] = None
|
||||||
self._dbphotos[uuid]["masterUuid"] = None
|
info["masterUuid"] = None
|
||||||
self._dbphotos[uuid]["masterFingerprint"] = row[1]
|
info["masterFingerprint"] = row[1]
|
||||||
self._dbphotos[uuid]["name"] = row[2]
|
info["name"] = row[2]
|
||||||
try:
|
try:
|
||||||
self._dbphotos[uuid]["lastmodifieddate"] = datetime.fromtimestamp(
|
info["lastmodifieddate"] = datetime.fromtimestamp(
|
||||||
row[4] + td
|
row[4] + td
|
||||||
)
|
)
|
||||||
except:
|
except:
|
||||||
self._dbphotos[uuid]["lastmodifieddate"] = datetime.fromtimestamp(
|
info["lastmodifieddate"] = datetime.fromtimestamp(
|
||||||
row[5] + td
|
row[5] + td
|
||||||
)
|
)
|
||||||
|
|
||||||
self._dbphotos[uuid]["imageDate"] = datetime.fromtimestamp(row[5] + td)
|
info["imageDate"] = datetime.fromtimestamp(row[5] + td)
|
||||||
self._dbphotos[uuid]["imageTimeZoneOffsetSeconds"] = row[6]
|
info["imageTimeZoneOffsetSeconds"] = row[6]
|
||||||
self._dbphotos[uuid]["hidden"] = row[9]
|
info["hidden"] = row[9]
|
||||||
self._dbphotos[uuid]["favorite"] = row[10]
|
info["favorite"] = row[10]
|
||||||
self._dbphotos[uuid]["originalFilename"] = row[3]
|
info["originalFilename"] = row[3]
|
||||||
self._dbphotos[uuid]["filename"] = row[12]
|
info["filename"] = row[12]
|
||||||
self._dbphotos[uuid]["directory"] = row[11]
|
info["directory"] = row[11]
|
||||||
|
|
||||||
# set latitude and longitude
|
# set latitude and longitude
|
||||||
# if both latitude and longitude = -180.0, then they are NULL
|
# if both latitude and longitude = -180.0, then they are NULL
|
||||||
if row[13] == -180.0 and row[14] == -180.0:
|
if row[13] == -180.0 and row[14] == -180.0:
|
||||||
self._dbphotos[uuid]["latitude"] = None
|
info["latitude"] = None
|
||||||
self._dbphotos[uuid]["longitude"] = None
|
info["longitude"] = None
|
||||||
else:
|
else:
|
||||||
self._dbphotos[uuid]["latitude"] = row[13]
|
info["latitude"] = row[13]
|
||||||
self._dbphotos[uuid]["longitude"] = row[14]
|
info["longitude"] = row[14]
|
||||||
|
|
||||||
self._dbphotos[uuid]["hasAdjustments"] = row[15]
|
info["hasAdjustments"] = row[15]
|
||||||
|
|
||||||
self._dbphotos[uuid]["cloudbatchpublishdate"] = row[16]
|
info["cloudbatchpublishdate"] = row[16]
|
||||||
self._dbphotos[uuid]["shared"] = True if row[16] is not None else False
|
info["shared"] = True if row[16] is not None else False
|
||||||
|
|
||||||
# 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
|
info["extendedDescription"] = None # fill this in later
|
||||||
self._dbphotos[uuid]["localAvailability"] = None
|
info["localAvailability"] = None
|
||||||
self._dbphotos[uuid]["remoteAvailability"] = None
|
info["remoteAvailability"] = None
|
||||||
self._dbphotos[uuid]["isMissing"] = None
|
info["isMissing"] = None
|
||||||
self._dbphotos[uuid]["adjustmentUuid"] = None
|
info["adjustmentUuid"] = None
|
||||||
self._dbphotos[uuid]["adjustmentFormatID"] = None
|
info["adjustmentFormatID"] = None
|
||||||
|
|
||||||
# find type
|
# find type
|
||||||
if row[17] == 0:
|
if row[17] == 0:
|
||||||
self._dbphotos[uuid]["type"] = _PHOTO_TYPE
|
info["type"] = _PHOTO_TYPE
|
||||||
elif row[17] == 1:
|
elif row[17] == 1:
|
||||||
self._dbphotos[uuid]["type"] = _MOVIE_TYPE
|
info["type"] = _MOVIE_TYPE
|
||||||
else:
|
else:
|
||||||
if _debug():
|
if _debug():
|
||||||
logging.debug(f"WARNING: {uuid} found unknown type {row[17]}")
|
logging.debug(f"WARNING: {uuid} found unknown type {row[17]}")
|
||||||
self._dbphotos[uuid]["type"] = None
|
info["type"] = None
|
||||||
|
|
||||||
self._dbphotos[uuid]["UTI"] = row[18]
|
info["UTI"] = row[18]
|
||||||
|
|
||||||
|
# TODO: fixme temp fix to filter unselected burst photos
|
||||||
|
if row[19] is not None and ((row[20] == 2) or (row[20] == 4)):
|
||||||
|
# burst photo
|
||||||
|
continue
|
||||||
|
self._dbphotos[uuid] = info
|
||||||
|
|
||||||
# Get extended description
|
# Get extended description
|
||||||
c.execute(
|
c.execute(
|
||||||
|
|||||||
Reference in New Issue
Block a user