Fix for large files and exiftool, #722 (#723)

This commit is contained in:
Rhet Turnbull
2022-07-01 08:03:21 -07:00
committed by GitHub
parent c20a3994c0
commit 292fdf3c74
3 changed files with 76 additions and 18 deletions

View File

@@ -557,3 +557,49 @@ def test_unescape_str():
assert quoted_str == QUOTED_JSON_STRING_UNESCAPED
quoted_json = json.loads(quoted_str)
assert quoted_json == QUOTED_JSON_LOADED
def test_large_file_support():
"""test large file support flag"""
# doesn't actually test against a large file, just that exiftool runs correctly
# See #722
import os.path
import tempfile
import osxphotos.exiftool
from osxphotos.fileutil import FileUtil
tempdir = tempfile.TemporaryDirectory(prefix="osxphotos_")
tempfile = os.path.join(tempdir.name, os.path.basename(TEST_FILE_ONE_KEYWORD))
FileUtil.copy(TEST_FILE_ONE_KEYWORD, tempfile)
exif = osxphotos.exiftool.ExifTool(tempfile, large_file_support=True)
exif.setvalue("IPTC:Keywords", "test")
assert not exif.error
exif._read_exif()
assert exif.data["IPTC:Keywords"] == "test"
def test_large_file_support_disabled():
"""test large file support flag disabled"""
# doesn't actually test against a large file, just that exiftool runs correctly
# See #722
import os.path
import tempfile
import osxphotos.exiftool
from osxphotos.fileutil import FileUtil
tempdir = tempfile.TemporaryDirectory(prefix="osxphotos_")
tempfile = os.path.join(tempdir.name, os.path.basename(TEST_FILE_ONE_KEYWORD))
FileUtil.copy(TEST_FILE_ONE_KEYWORD, tempfile)
exif = osxphotos.exiftool.ExifTool(tempfile, large_file_support=False)
exif.setvalue("IPTC:Keywords", "test")
assert not exif.error
exif._read_exif()
assert exif.data["IPTC:Keywords"] == "test"