Fixed path for photos actually missing off disk

This commit is contained in:
Rhet Turnbull
2020-11-12 06:18:28 -08:00
parent ea9b41bae4
commit 5d4d7d7db7
2 changed files with 9 additions and 3 deletions

View File

@@ -2341,10 +2341,10 @@ def export_photo(
space = " " if not verbose_ else ""
verbose(f"{space}Skipping missing photo {photo.original_filename}")
return ExportResults([], [], [], [], [], [])
elif not os.path.exists(photo.path):
elif photo.path is None:
space = " " if not verbose_ else ""
verbose(
f"{space}WARNING: file {photo.path} is missing but ismissing=False, "
f"{space}WARNING: photo {photo.original_filename} ({photo.uuid}) is missing but ismissing=False, "
f"skipping {photo.original_filename}"
)
return ExportResults([], [], [], [], [], [])
@@ -2396,7 +2396,7 @@ def export_photo(
download_missing
and (
photo.ismissing
or not os.path.exists(photo.path)
or photo.path is None
or (export_edited and photo.path_edited is None)
)
)

View File

@@ -164,6 +164,8 @@ class PhotoInfo:
photopath = os.path.join(
self._db._masters_path, self._info["imagePath"]
)
if not os.path.isfile(photopath):
photopath = None
self._path = photopath
return photopath
@@ -175,6 +177,8 @@ class PhotoInfo:
self._info["directory"],
self._info["filename"],
)
if not os.path.isfile(photopath):
photopath = None
self._path = photopath
return photopath
@@ -188,6 +192,8 @@ class PhotoInfo:
self._info["directory"],
self._info["filename"],
)
if not os.path.isfile(photopath):
photopath = None
self._path = photopath
return photopath