Fixed download-missing to only download when actually missing
This commit is contained in:
@@ -1330,6 +1330,11 @@ def export_photo(
|
||||
if "xmp" in sidecar:
|
||||
sidecar_xmp = True
|
||||
|
||||
# if download_missing and the photo is missing or path doesn't exist,
|
||||
# try to download with Photos
|
||||
use_photos_export = download_missing and (
|
||||
photo.ismissing or not os.path.exists(photo.path)
|
||||
)
|
||||
photo_path = photo.export(
|
||||
dest,
|
||||
filename,
|
||||
@@ -1337,14 +1342,19 @@ def export_photo(
|
||||
sidecar_xmp=sidecar_xmp,
|
||||
live_photo=export_live,
|
||||
overwrite=overwrite,
|
||||
use_photos_export=download_missing,
|
||||
use_photos_export=use_photos_export,
|
||||
exiftool=exiftool,
|
||||
)
|
||||
|
||||
# if export-edited, also export the edited version
|
||||
# verify the photo has adjustments and valid path to avoid raising an exception
|
||||
if export_edited and photo.hasadjustments:
|
||||
if download_missing or photo.path_edited is not None:
|
||||
# if download_missing and the photo is missing or path doesn't exist,
|
||||
# try to download with Photos
|
||||
use_photos_export = download_missing and photo.path_edited is None
|
||||
if not download_missing and photo.path_edited is None:
|
||||
click.echo(f"Skipping missing edited photo for {filename}")
|
||||
else:
|
||||
edited_name = pathlib.Path(filename)
|
||||
edited_name = f"{edited_name.stem}_edited{edited_name.suffix}"
|
||||
if verbose:
|
||||
@@ -1356,11 +1366,9 @@ def export_photo(
|
||||
sidecar_xmp=sidecar_xmp,
|
||||
overwrite=overwrite,
|
||||
edited=True,
|
||||
use_photos_export=download_missing,
|
||||
use_photos_export=use_photos_export,
|
||||
exiftool=exiftool,
|
||||
)
|
||||
else:
|
||||
click.echo(f"Skipping missing edited photo for {filename}")
|
||||
|
||||
return photo_path
|
||||
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
""" version info """
|
||||
|
||||
__version__ = "0.22.17"
|
||||
__version__ = "0.22.19"
|
||||
|
||||
@@ -524,6 +524,8 @@ class PhotoInfo:
|
||||
# list of all files exported during this call to export
|
||||
exported_files = []
|
||||
|
||||
logging.debug(f"dest ={dest}.filename={filename}")
|
||||
|
||||
# check arguments and get destination path and filename (if provided)
|
||||
if filename and len(filename) > 2:
|
||||
raise TypeError(
|
||||
@@ -561,6 +563,7 @@ class PhotoInfo:
|
||||
# check destination path
|
||||
dest = pathlib.Path(dest)
|
||||
filename = pathlib.Path(filename)
|
||||
logging.debug(f"dest ={dest}.filename={filename}")
|
||||
dest = dest / filename
|
||||
|
||||
# check to see if file exists and if so, add (1), (2), etc until we find one that works
|
||||
|
||||
Reference in New Issue
Block a user