diff --git a/README.md b/README.md
index 4ffcdca3..c168ba23 100644
--- a/README.md
+++ b/README.md
@@ -1702,7 +1702,7 @@ Substitution Description
{lf} A line feed: '\n', alias for {newline}
{cr} A carriage return: '\r'
{crlf} a carriage return + line feed: '\r\n'
-{osxphotos_version} The osxphotos version, e.g. '0.42.83'
+{osxphotos_version} The osxphotos version, e.g. '0.42.84'
{osxphotos_cmd_line} The full command line used to run osxphotos
The following substitutions may result in multiple values. Thus if specified for
@@ -3561,7 +3561,7 @@ The following template field substitutions are availabe for use the templating s
|{lf}|A line feed: '\n', alias for {newline}|
|{cr}|A carriage return: '\r'|
|{crlf}|a carriage return + line feed: '\r\n'|
-|{osxphotos_version}|The osxphotos version, e.g. '0.42.83'|
+|{osxphotos_version}|The osxphotos version, e.g. '0.42.84'|
|{osxphotos_cmd_line}|The full command line used to run osxphotos|
|{album}|Album(s) photo is contained in|
|{folder_album}|Folder path + album photo is contained in. e.g. 'Folder/Subfolder/Album' or just 'Album' if no enclosing folder|
diff --git a/docs/.buildinfo b/docs/.buildinfo
index 670cc057..afa3d392 100644
--- a/docs/.buildinfo
+++ b/docs/.buildinfo
@@ -1,4 +1,4 @@
# Sphinx build info version 1
# This file hashes the configuration used when building these files. When it is not found, a full rebuild will be done.
-config: c9edb56c4efc3c4dd60be49110417224
+config: c8c78e92de35f8ff4cf0b9d6bd35d796
tags: 645f666f9bcd5a90fca523b33c5a78b7
diff --git a/docs/_modules/index.html b/docs/_modules/index.html
index b6780fe3..4ba9de9c 100644
--- a/docs/_modules/index.html
+++ b/docs/_modules/index.html
@@ -5,7 +5,7 @@
- Overview: module code — osxphotos 0.42.83 documentation
+ Overview: module code — osxphotos 0.42.84 documentation
diff --git a/docs/_modules/osxphotos/photoinfo/_photoinfo_export.html b/docs/_modules/osxphotos/photoinfo/_photoinfo_export.html
index 62b1f0f5..e51a10e4 100644
--- a/docs/_modules/osxphotos/photoinfo/_photoinfo_export.html
+++ b/docs/_modules/osxphotos/photoinfo/_photoinfo_export.html
@@ -5,7 +5,7 @@
- osxphotos.photoinfo._photoinfo_export — osxphotos 0.42.82 documentation
+ osxphotos.photoinfo._photoinfo_export — osxphotos 0.42.84 documentation
@@ -89,7 +89,7 @@
)from..phototemplateimportRenderOptionsfrom..utiimportget_preferred_uti_extension
-from..utilsimportfindfiles,lineno,noop,normalize_fs_path
+from..utilsimportincrement_filename,increment_filename_with_count,lineno# retry if use_photos_export fails the first time (which sometimes it does)MAX_PHOTOSCRIPT_RETRIES=3
@@ -716,18 +716,12 @@
# e.g. exporting sidecar for file1.png and file1.jpeg# if file1.png exists and exporting file1.jpeg,# dest will be file1 (1).jpeg even though file1.jpeg doesn't exist to prevent sidecar collision
- count=0
- ifnotupdateandincrementandnotoverwrite:
- dest_files=findfiles(f"{dest_original.stem}*",str(dest_original.parent))
- # paths need to be normalized for unicode as filesystem returns unicode in NFD form
- dest_files=[
- normalize_fs_path(pathlib.Path(f).stem.lower())forfindest_files
- ]
- dest_new=dest_original.stem
- whilenormalize_fs_path(dest_new.lower())indest_files:
- count+=1
- dest_new=f"{dest_original.stem} ({count})"
- dest_original=dest_original.parent/f"{dest_new}{dest_original.suffix}"
+ increment_file_count=0
+ ifincrementandnotupdateandnotoverwrite:
+ dest_original,increment_file_count=increment_filename_with_count(
+ dest_original
+ )
+ dest_original=pathlib.Path(dest_original)# if overwrite==False and #increment==False, export should fail if file existsif(
@@ -742,20 +736,11 @@
)ifexport_edited:
- ifnotupdateandincrementandnotoverwrite:
- dest_files=findfiles(f"{dest_edited.stem}*",str(dest_edited.parent))
- # paths need to be normalized for unicode as filesystem returns unicode in NFD form
- dest_files=[
- normalize_fs_path(pathlib.Path(f).stem.lower())forfindest_files
- ]
- dest_new=dest_edited.stem
- ifcount:
- # incremented above when checking original destination
- dest_new=f"{dest_new} ({count})"
- whilenormalize_fs_path(dest_new.lower())indest_files:
- count+=1
- dest_new=f"{dest.stem} ({count})"
- dest_edited=dest_edited.parent/f"{dest_new}{dest_edited.suffix}"
+ ifincrementandnotupdateandnotoverwrite:
+ dest_edited,increment_file_count=increment_filename_with_count(
+ dest_edited,increment_file_count
+ )
+ dest_edited=pathlib.Path(dest_edited)# if overwrite==False and #increment==False, export should fail if file existsifdest_edited.exists()andnotupdateandnotoverwriteandnotincrement:
@@ -839,20 +824,16 @@
)ifdest_uuid!=self.uuid:# not the right file, find the right one
- count=1glob_str=str(dest.parent/f"{dest.stem} (*{dest.suffix}")dest_files=glob.glob(glob_str)
- found_match=Falseforfile_indest_files:dest_uuid=export_db.get_uuid_for_file(file_)ifdest_uuid==self.uuid:dest=pathlib.Path(file_)
- found_match=Truebreakelifdest_uuidisNoneandfileutil.cmp(src,file_):# files match, update the UUIDdest=pathlib.Path(file_)
- found_match=Trueexport_db.set_data(filename=dest,uuid=self.uuid,
@@ -864,18 +845,9 @@
exif_json=None,)break
-
- ifnotfound_match:
+ else:# increment the destination file
- count=1
- glob_str=str(dest.parent/f"{dest.stem}*")
- dest_files=glob.glob(glob_str)
- dest_files=[normalize_fs_path(pathlib.Path(f).stem)forfindest_files]
- dest_new=dest.stem
- whilenormalize_fs_path(dest_new)indest_files:
- dest_new=f"{dest.stem} ({count})"
- count+=1
- dest=dest.parent/f"{dest_new}{dest.suffix}"
+ dest=pathlib.Path(increment_filename(dest))ifexport_original:dest_original=dest
@@ -973,6 +945,7 @@
preview_path=pathlib.Path(self.path_derivatives[0])preview_ext=preview_path.suffixpreview_name=dest.parent/f"{dest.stem}{preview_suffix}{preview_ext}"
+ preview_name=pathlib.Path(increment_filename(preview_name))ifpreview_pathisnotNone:results=self._export_photo(preview_path,
diff --git a/docs/_static/documentation_options.js b/docs/_static/documentation_options.js
index f5239cb0..cdea9219 100644
--- a/docs/_static/documentation_options.js
+++ b/docs/_static/documentation_options.js
@@ -1,6 +1,6 @@
var DOCUMENTATION_OPTIONS = {
URL_ROOT: document.getElementById("documentation_options").getAttribute('data-url_root'),
- VERSION: '0.42.83',
+ VERSION: '0.42.84',
LANGUAGE: 'None',
COLLAPSE_INDEX: false,
BUILDER: 'html',
diff --git a/docs/cli.html b/docs/cli.html
index 5787ddad..bba0a8bb 100644
--- a/docs/cli.html
+++ b/docs/cli.html
@@ -5,7 +5,7 @@
- osxphotos command line interface (CLI) — osxphotos 0.42.83 documentation
+ osxphotos command line interface (CLI) — osxphotos 0.42.84 documentation
diff --git a/docs/genindex.html b/docs/genindex.html
index 820ea9a0..c94d957b 100644
--- a/docs/genindex.html
+++ b/docs/genindex.html
@@ -5,7 +5,7 @@
- Index — osxphotos 0.42.83 documentation
+ Index — osxphotos 0.42.84 documentation
diff --git a/docs/index.html b/docs/index.html
index 0de7a44e..3998e9d3 100644
--- a/docs/index.html
+++ b/docs/index.html
@@ -5,7 +5,7 @@
- Welcome to osxphotos’s documentation! — osxphotos 0.42.83 documentation
+ Welcome to osxphotos’s documentation! — osxphotos 0.42.84 documentation
diff --git a/docs/modules.html b/docs/modules.html
index 2493069d..224d32db 100644
--- a/docs/modules.html
+++ b/docs/modules.html
@@ -5,7 +5,7 @@
- osxphotos — osxphotos 0.42.83 documentation
+ osxphotos — osxphotos 0.42.84 documentation
diff --git a/docs/reference.html b/docs/reference.html
index 85510be1..f12830f5 100644
--- a/docs/reference.html
+++ b/docs/reference.html
@@ -5,7 +5,7 @@
- osxphotos package — osxphotos 0.42.83 documentation
+ osxphotos package — osxphotos 0.42.84 documentation
diff --git a/docs/search.html b/docs/search.html
index 569e6ac3..a5c95758 100644
--- a/docs/search.html
+++ b/docs/search.html
@@ -5,7 +5,7 @@
- Search — osxphotos 0.42.83 documentation
+ Search — osxphotos 0.42.84 documentation