Removed debug statement in _photoinfo_export

This commit is contained in:
Rhet Turnbull
2020-11-18 22:03:23 -08:00
parent 2d9429c8ee
commit 8cb15d1555
4 changed files with 36 additions and 8 deletions

View File

@@ -1,4 +1,4 @@
""" version info """ """ version info """
__version__ = "0.36.18" __version__ = "0.36.19"

View File

@@ -1,8 +1,9 @@
""" utility functions for validating/sanitizing path components """ """ utility functions for validating/sanitizing path components """
from ._constants import MAX_DIRNAME_LEN, MAX_FILENAME_LEN
import pathvalidate import pathvalidate
from ._constants import MAX_DIRNAME_LEN, MAX_FILENAME_LEN
def sanitize_filepath(filepath): def sanitize_filepath(filepath):
""" sanitize a filepath """ """ sanitize a filepath """

View File

@@ -1194,7 +1194,6 @@ def _exiftool_dict(
timeoriginal = date.strftime(f"%H:%M:%S{offsettime}") timeoriginal = date.strftime(f"%H:%M:%S{offsettime}")
exif["IPTC:TimeCreated"] = timeoriginal exif["IPTC:TimeCreated"] = timeoriginal
print(f"time = {timeoriginal}")
if self.date_modified is not None and not ignore_date_modified: if self.date_modified is not None and not ignore_date_modified:
exif["EXIF:ModifyDate"] = self.date_modified.strftime("%Y:%m:%d %H:%M:%S") exif["EXIF:ModifyDate"] = self.date_modified.strftime("%Y:%m:%d %H:%M:%S")

View File

@@ -57,10 +57,12 @@ def _debug():
""" returns True if debugging turned on (via _set_debug), otherwise, false """ """ returns True if debugging turned on (via _set_debug), otherwise, false """
return _DEBUG return _DEBUG
def noop(*args, **kwargs): def noop(*args, **kwargs):
""" do nothing (no operation) """ """ do nothing (no operation) """
pass pass
def _get_os_version(): def _get_os_version():
# returns tuple containing OS version # returns tuple containing OS version
# e.g. 10.13.6 = (10, 13, 6) # e.g. 10.13.6 = (10, 13, 6)
@@ -361,9 +363,35 @@ def _db_is_locked(dbname):
def normalize_unicode(value): def normalize_unicode(value):
""" normalize unicode data """ """ normalize unicode data """
if value is not None: if value is None:
if not isinstance(value, str):
raise ValueError("value must be str")
return unicodedata.normalize(UNICODE_FORMAT, value)
else:
return None return None
if not isinstance(value, str):
raise ValueError("value must be str")
return unicodedata.normalize(UNICODE_FORMAT, value)
def increment_filename(filepath):
""" Return filename (1).ext, etc if filename.ext exists
If file exists in filename's parent folder with same stem as filename,
add (1), (2), etc. until a non-existing filename is found.
Args:
filepath: str; full path, including file name
Returns:
new filepath (or same if not incremented)
Note: This obviously is subject to race condition so using with caution.
"""
dest = pathlib.Path(str(filepath))
count = 1
dest_files = findfiles(f"{dest.stem}*", str(dest.parent))
dest_files = [pathlib.Path(f).stem.lower() for f in dest_files]
dest_new = dest.stem
while dest_new.lower() in dest_files:
dest_new = f"{dest.stem} ({count})"
count += 1
dest = dest.parent / f"{dest_new}{dest.suffix}"
return str(dest)