From 64c226b85529581e393a2d0604b41c37a8dc2eaf Mon Sep 17 00:00:00 2001 From: Rhet Turnbull Date: Sat, 25 Sep 2021 08:54:16 -0700 Subject: [PATCH] Updated docs [skip ci] --- README.md | 4 +- docs/.buildinfo | 2 +- docs/_modules/index.html | 2 +- .../photoinfo/_photoinfo_export.html | 59 +++++-------------- docs/_static/documentation_options.js | 2 +- docs/cli.html | 2 +- docs/genindex.html | 2 +- docs/index.html | 2 +- docs/modules.html | 2 +- docs/reference.html | 2 +- docs/search.html | 2 +- 11 files changed, 27 insertions(+), 54 deletions(-) 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 ..phototemplate import RenderOptions from ..uti import get_preferred_uti_extension -from ..utils import findfiles, lineno, noop, normalize_fs_path +from ..utils import increment_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 - if not update and increment and not overwrite: - 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()) for f in dest_files - ] - dest_new = dest_original.stem - while normalize_fs_path(dest_new.lower()) in dest_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 + if increment and not update and not overwrite: + 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 exists if ( @@ -742,20 +736,11 @@ ) if export_edited: - if not update and increment and not overwrite: - 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()) for f in dest_files - ] - dest_new = dest_edited.stem - if count: - # incremented above when checking original destination - dest_new = f"{dest_new} ({count})" - while normalize_fs_path(dest_new.lower()) in dest_files: - count += 1 - dest_new = f"{dest.stem} ({count})" - dest_edited = dest_edited.parent / f"{dest_new}{dest_edited.suffix}" + if increment and not update and not overwrite: + 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 exists if dest_edited.exists() and not update and not overwrite and not increment: @@ -839,20 +824,16 @@ ) if dest_uuid != self.uuid: # not the right file, find the right one - count = 1 glob_str = str(dest.parent / f"{dest.stem} (*{dest.suffix}") dest_files = glob.glob(glob_str) - found_match = False for file_ in dest_files: dest_uuid = export_db.get_uuid_for_file(file_) if dest_uuid == self.uuid: dest = pathlib.Path(file_) - found_match = True break elif dest_uuid is None and fileutil.cmp(src, file_): # files match, update the UUID dest = pathlib.Path(file_) - found_match = True export_db.set_data( filename=dest, uuid=self.uuid, @@ -864,18 +845,9 @@ exif_json=None, ) break - - if not found_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) for f in dest_files] - dest_new = dest.stem - while normalize_fs_path(dest_new) in dest_files: - dest_new = f"{dest.stem} ({count})" - count += 1 - dest = dest.parent / f"{dest_new}{dest.suffix}" + dest = pathlib.Path(increment_filename(dest)) if export_original: dest_original = dest @@ -973,6 +945,7 @@ preview_path = pathlib.Path(self.path_derivatives[0]) preview_ext = preview_path.suffix preview_name = dest.parent / f"{dest.stem}{preview_suffix}{preview_ext}" + preview_name = pathlib.Path(increment_filename(preview_name)) if preview_path is not None: 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