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 "" space = " " if not verbose_ else ""
verbose(f"{space}Skipping missing photo {photo.original_filename}") verbose(f"{space}Skipping missing photo {photo.original_filename}")
return ExportResults([], [], [], [], [], []) return ExportResults([], [], [], [], [], [])
elif not os.path.exists(photo.path): elif photo.path is None:
space = " " if not verbose_ else "" space = " " if not verbose_ else ""
verbose( 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}" f"skipping {photo.original_filename}"
) )
return ExportResults([], [], [], [], [], []) return ExportResults([], [], [], [], [], [])
@@ -2396,7 +2396,7 @@ def export_photo(
download_missing download_missing
and ( and (
photo.ismissing photo.ismissing
or not os.path.exists(photo.path) or photo.path is None
or (export_edited and photo.path_edited is None) or (export_edited and photo.path_edited is None)
) )
) )

View File

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