Compare commits
7 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
857e3db6cc | ||
|
|
7ed3115f36 | ||
|
|
198addaa07 | ||
|
|
d91fc93737 | ||
|
|
5c3360f29d | ||
|
|
d4513832a6 | ||
|
|
f8616acf16 |
26
CHANGELOG.md
26
CHANGELOG.md
@@ -4,6 +4,32 @@ All notable changes to this project will be documented in this file. Dates are d
|
||||
|
||||
Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog).
|
||||
|
||||
#### [v0.40.11](https://github.com/RhetTbull/osxphotos/compare/v0.40.10...v0.40.11)
|
||||
|
||||
> 9 February 2021
|
||||
|
||||
- Fixed --exiftool-option, #369 [`198adda`](https://github.com/RhetTbull/osxphotos/commit/198addaa07a86ac5b0fd82787fdffff0a0fc19c6)
|
||||
|
||||
#### [v0.40.10](https://github.com/RhetTbull/osxphotos/compare/v0.40.9...v0.40.10)
|
||||
|
||||
> 7 February 2021
|
||||
|
||||
- Fix for issue #366 [`5c3360f`](https://github.com/RhetTbull/osxphotos/commit/5c3360f29d52df2f804c70f37a2ca9a3f102d93c)
|
||||
|
||||
#### [v0.40.9](https://github.com/RhetTbull/osxphotos/compare/v0.40.8...v0.40.9)
|
||||
|
||||
> 7 February 2021
|
||||
|
||||
- Fixed unnecessary warning for long keywords, issue #365 [`f8616ac`](https://github.com/RhetTbull/osxphotos/commit/f8616acf167b5e73ab3e4b68dcfbf578230c330d)
|
||||
|
||||
#### [v0.40.8](https://github.com/RhetTbull/osxphotos/compare/v0.40.7...v0.40.8)
|
||||
|
||||
> 4 February 2021
|
||||
|
||||
- Implemented --in-album, --not-in-album, issue #364 [`addd952`](https://github.com/RhetTbull/osxphotos/commit/addd952aa315007852945a352b2c7c451ba5f21a)
|
||||
- Updated docs [`7fa5fba`](https://github.com/RhetTbull/osxphotos/commit/7fa5fbaa5b7c9aa1412eceef56e068dc044c91e0)
|
||||
- Updated docs Makefile [skip ci] [`683dfe7`](https://github.com/RhetTbull/osxphotos/commit/683dfe7f3ffd235659b58f403562ce2d51123cfb)
|
||||
|
||||
#### [v0.40.7](https://github.com/RhetTbull/osxphotos/compare/v0.40.6...v0.40.7)
|
||||
|
||||
> 3 February 2021
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
""" version info """
|
||||
|
||||
__version__ = "0.40.8"
|
||||
__version__ = "0.40.12"
|
||||
|
||||
@@ -2381,13 +2381,16 @@ def export_photo(
|
||||
rendered_suffix = rendered_suffix[0]
|
||||
|
||||
original_filename = pathlib.Path(filename)
|
||||
file_ext = (
|
||||
"." + jpeg_ext
|
||||
if jpeg_ext and (photo.uti == "public.jpeg" or convert_to_jpeg)
|
||||
else ".jpeg"
|
||||
if convert_to_jpeg and photo.uti != "public.jpeg"
|
||||
else original_filename.suffix
|
||||
)
|
||||
file_ext = original_filename.suffix
|
||||
if photo.isphoto and (jpeg_ext or convert_to_jpeg):
|
||||
# change the file extension to correct jpeg extension if needed
|
||||
file_ext = (
|
||||
"." + jpeg_ext
|
||||
if jpeg_ext and (photo.uti == "public.jpeg" or convert_to_jpeg)
|
||||
else ".jpeg"
|
||||
if convert_to_jpeg and photo.uti != "public.jpeg"
|
||||
else original_filename.suffix
|
||||
)
|
||||
original_filename = (
|
||||
original_filename.parent
|
||||
/ f"{original_filename.stem}{rendered_suffix}{file_ext}"
|
||||
|
||||
@@ -254,7 +254,11 @@ class ExifTool:
|
||||
filename = os.fsencode(self.file) if not no_file else b""
|
||||
|
||||
if self.flags:
|
||||
command_str = b"\n".join([f.encode("utf-8") for f in self.flags])
|
||||
# need to split flags, e.g. so "--ext AVI" becomes ["--ext", "AVI"]
|
||||
flags = []
|
||||
for f in self.flags:
|
||||
flags.extend(f.split())
|
||||
command_str = b"\n".join([f.encode("utf-8") for f in flags])
|
||||
command_str += b"\n"
|
||||
else:
|
||||
command_str = b""
|
||||
@@ -311,7 +315,13 @@ class ExifTool:
|
||||
if not json_str:
|
||||
return dict()
|
||||
|
||||
exifdict = json.loads(json_str)
|
||||
try:
|
||||
exifdict = json.loads(json_str)
|
||||
except Exception as e:
|
||||
# will fail with some commands, e.g --ext AVI which produces
|
||||
# 'No file with specified extension' instead of json
|
||||
return dict()
|
||||
|
||||
exifdict = exifdict[0]
|
||||
if not tag_groups:
|
||||
# strip tag groups
|
||||
|
||||
@@ -562,11 +562,11 @@ def export2(
|
||||
if export_db is None:
|
||||
export_db = ExportDBNoOp()
|
||||
|
||||
if verbose is None:
|
||||
verbose = noop
|
||||
elif not callable(verbose):
|
||||
if verbose and not callable(verbose):
|
||||
raise TypeError("verbose must be callable")
|
||||
self._verbose = verbose
|
||||
|
||||
if verbose is None:
|
||||
verbose = self._verbose
|
||||
|
||||
# suffix to add to edited files
|
||||
# e.g. name will be filename_edited.jpg
|
||||
@@ -1501,8 +1501,8 @@ def _exiftool_dict(
|
||||
if len(long_str) > _MAX_IPTC_KEYWORD_LEN
|
||||
]
|
||||
if long_keywords:
|
||||
logging.warning(
|
||||
f"Some keywords exceed max IPTC Keyword length of {_MAX_IPTC_KEYWORD_LEN}: {long_keywords}"
|
||||
self._verbose(
|
||||
f"Warning: some keywords exceed max IPTC Keyword length of {_MAX_IPTC_KEYWORD_LEN} (exiftool will truncate these): {long_keywords}"
|
||||
)
|
||||
|
||||
keyword_list.extend(rendered_keywords)
|
||||
@@ -1781,17 +1781,6 @@ def _xmp_sidecar(
|
||||
if _OSXPHOTOS_NONE_SENTINEL not in keyword
|
||||
]
|
||||
|
||||
# check to see if any keywords too long
|
||||
long_keywords = [
|
||||
long_str
|
||||
for long_str in rendered_keywords
|
||||
if len(long_str) > _MAX_IPTC_KEYWORD_LEN
|
||||
]
|
||||
if long_keywords:
|
||||
logging.warning(
|
||||
f"Some keywords exceed max IPTC Keyword length of {_MAX_IPTC_KEYWORD_LEN}: {long_keywords}"
|
||||
)
|
||||
|
||||
keyword_list.extend(rendered_keywords)
|
||||
|
||||
# remove duplicates
|
||||
|
||||
@@ -70,6 +70,7 @@ class PhotoInfo:
|
||||
self._uuid = uuid
|
||||
self._info = info
|
||||
self._db = db
|
||||
self._verbose = self._db._verbose
|
||||
|
||||
@property
|
||||
def filename(self):
|
||||
|
||||
File diff suppressed because one or more lines are too long
@@ -429,7 +429,7 @@ def test_exiftool_json_sidecar_ignore_date_modified(photosdb):
|
||||
assert json_got == json_expected
|
||||
|
||||
|
||||
def test_exiftool_json_sidecar_keyword_template_long(caplog, photosdb):
|
||||
def test_exiftool_json_sidecar_keyword_template_long(capsys, photosdb):
|
||||
from osxphotos._constants import _MAX_IPTC_KEYWORD_LEN
|
||||
|
||||
photos = photosdb.photos(uuid=[EXIF_JSON_UUID])
|
||||
@@ -452,10 +452,13 @@ def test_exiftool_json_sidecar_keyword_template_long(caplog, photosdb):
|
||||
)[0]
|
||||
|
||||
long_str = "x" * (_MAX_IPTC_KEYWORD_LEN + 1)
|
||||
photos[0]._verbose = print
|
||||
json_got = photos[0]._exiftool_json_sidecar(keyword_template=[long_str])
|
||||
json_got = json.loads(json_got)[0]
|
||||
|
||||
assert "Some keywords exceed max IPTC Keyword length" in caplog.text
|
||||
captured = capsys.readouterr()
|
||||
assert "some keywords exceed max IPTC Keyword length" in captured.out
|
||||
|
||||
# some gymnastics to account for different sort order in different pythons
|
||||
for k, v in json_got.items():
|
||||
if type(v) in (list, tuple):
|
||||
|
||||
Reference in New Issue
Block a user