alpha version of filenames/paths
This commit is contained in:
@@ -90,9 +90,9 @@ class PhotosDB:
|
|||||||
# logger.debug(system, major)
|
# logger.debug(system, major)
|
||||||
if system != "Darwin" or (major not in _TESTED_OS_VERSIONS):
|
if system != "Darwin" or (major not in _TESTED_OS_VERSIONS):
|
||||||
print(
|
print(
|
||||||
"WARNING: This module has only been tested with MacOS 10."
|
f"WARNING: This module has only been tested with MacOS 10."
|
||||||
+ f"[{', '.join(_TESTED_OS_VERSIONS)}]: "
|
f"[{', '.join(_TESTED_OS_VERSIONS)}]: "
|
||||||
+ f"you have {system}, OS version: {major}",
|
f"you have {system}, OS version: {major}",
|
||||||
file=sys.stderr,
|
file=sys.stderr,
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -536,6 +536,10 @@ class PhotosDB:
|
|||||||
self._dbphotos[uuid]["modelID"] = row[1]
|
self._dbphotos[uuid]["modelID"] = row[1]
|
||||||
self._dbphotos[uuid]["masterUuid"] = row[2]
|
self._dbphotos[uuid]["masterUuid"] = row[2]
|
||||||
self._dbphotos[uuid]["filename"] = row[3]
|
self._dbphotos[uuid]["filename"] = row[3]
|
||||||
|
|
||||||
|
# TODO: Photos 5 has filename and originalFilename, is there equiv for older database formats?
|
||||||
|
self._dbphotos[uuid]["originalFilename"] = row[3]
|
||||||
|
|
||||||
try:
|
try:
|
||||||
self._dbphotos[uuid]["lastmodifieddate"] = datetime.fromtimestamp(
|
self._dbphotos[uuid]["lastmodifieddate"] = datetime.fromtimestamp(
|
||||||
row[4] + td
|
row[4] + td
|
||||||
@@ -1075,8 +1079,14 @@ class PhotoInfo:
|
|||||||
self.__db = db
|
self.__db = db
|
||||||
|
|
||||||
def filename(self):
|
def filename(self):
|
||||||
|
""" return filename of the picture """
|
||||||
return self.__info["filename"]
|
return self.__info["filename"]
|
||||||
|
|
||||||
|
def original_filename(self):
|
||||||
|
""" return original filename of the picture """
|
||||||
|
""" Photos 5 mangles filenames upon import """
|
||||||
|
return self.__info["originalFilename"]
|
||||||
|
|
||||||
def date(self):
|
def date(self):
|
||||||
""" image creation date as timezone aware datetime object """
|
""" image creation date as timezone aware datetime object """
|
||||||
imagedate = self.__info["imageDate"]
|
imagedate = self.__info["imageDate"]
|
||||||
@@ -1109,8 +1119,23 @@ class PhotoInfo:
|
|||||||
photopath = None # path would be meaningless until downloaded
|
photopath = None # path would be meaningless until downloaded
|
||||||
# TODO: Is there a way to use applescript to force the download in this
|
# TODO: Is there a way to use applescript to force the download in this
|
||||||
else:
|
else:
|
||||||
return "NOT YET IMPLEMENTED"
|
if self.__info["masterFingerprint"]:
|
||||||
# Photos 5
|
# 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"],
|
||||||
|
)
|
||||||
|
else:
|
||||||
|
logging.debug("WARNING: masterFingerprint null",pformat(self.__info))
|
||||||
|
|
||||||
|
logging.debug(photopath)
|
||||||
|
return photopath
|
||||||
# ZZZ
|
# ZZZ
|
||||||
|
|
||||||
return photopath
|
return photopath
|
||||||
@@ -1169,9 +1194,11 @@ class PhotoInfo:
|
|||||||
|
|
||||||
def to_json(self):
|
def to_json(self):
|
||||||
""" return JSON representation """
|
""" return JSON representation """
|
||||||
|
#TODO: Add additional details here
|
||||||
pic = {
|
pic = {
|
||||||
"uuid": self.uuid(),
|
"uuid": self.uuid(),
|
||||||
"filename": self.filename(),
|
"filename": self.filename(),
|
||||||
|
"original_filename": self.original_filename(),
|
||||||
"date": str(self.date()),
|
"date": str(self.date()),
|
||||||
"description": self.description(),
|
"description": self.description(),
|
||||||
"name": self.name(),
|
"name": self.name(),
|
||||||
|
|||||||
@@ -168,6 +168,7 @@ def print_photo_info(photos, json=False):
|
|||||||
[
|
[
|
||||||
"uuid",
|
"uuid",
|
||||||
"filename",
|
"filename",
|
||||||
|
"original_filename",
|
||||||
"date",
|
"date",
|
||||||
"description",
|
"description",
|
||||||
"name",
|
"name",
|
||||||
@@ -184,6 +185,7 @@ def print_photo_info(photos, json=False):
|
|||||||
[
|
[
|
||||||
p.uuid(),
|
p.uuid(),
|
||||||
p.filename(),
|
p.filename(),
|
||||||
|
p.original_filename(),
|
||||||
str(p.date()),
|
str(p.date()),
|
||||||
p.description(),
|
p.description(),
|
||||||
p.name(),
|
p.name(),
|
||||||
|
|||||||
Reference in New Issue
Block a user