Fixed bug related to issue #222

This commit is contained in:
Rhet Turnbull
2020-09-28 21:23:47 -07:00
parent 432da7f139
commit c939df7171
2 changed files with 12 additions and 13 deletions

View File

@@ -683,9 +683,6 @@ def export2(
f"Error exporting photo {self.uuid} to {dest} with use_photos_export"
)
# export metadata
info = export_db.get_info_for_uuid(self.uuid)
if sidecar_json:
logging.debug("writing exiftool_json_sidecar")
sidecar_filename = dest.parent / pathlib.Path(f"{dest.stem}{dest.suffix}.json")
@@ -797,9 +794,9 @@ def export2(
if touch_file:
for exif_file in exif_files_updated:
touched_files.append(exported_file)
touched_files.append(exif_file)
ts = int(self.date.timestamp())
fileutil.utime(exported_file, (ts, ts))
fileutil.utime(exif_file, (ts, ts))
touched_files = list(set(touched_files))
@@ -1121,7 +1118,7 @@ def _xmp_sidecar(
use_persons_as_keywords=False,
keyword_template=None,
description_template=None,
extension=None
extension=None,
):
""" returns string for XMP sidecar
use_albums_as_keywords: treat album names as keywords
@@ -1134,7 +1131,7 @@ def _xmp_sidecar(
if extension is None:
extension = pathlib.Path(self.original_filename)
extension = extension.suffix[1:] if extension.suffix else None
if description_template is not None:
description = self.render_template(
description_template, expand_inplace=True, inplace_sep=", "

View File

@@ -183,9 +183,9 @@ CLI_EXPORTED_FILENAME_TEMPLATE_FILENAMES2 = [
]
CLI_EXPORTED_FILENAME_TEMPLATE_FILENAMES_PATHSEP = [
"2018-10 - Sponsion, Museum, Frühstück, Römermuseum/IMG_4547.jpg",
"Folder1/SubFolder2/AlbumInFolder/IMG_4547.jpg",
"2019-10:11 Paris Clermont/IMG_4547.jpg",
"2018-10 - Sponsion, Museum, Frühstück, Römermuseum/IMG_4547.jpg",
"Folder1/SubFolder2/AlbumInFolder/IMG_4547.jpg",
"2019-10:11 Paris Clermont/IMG_4547.jpg",
]
CLI_EXPORT_UUID = "D79B8D77-BFFC-460B-9312-034F2877D35B"
@@ -354,6 +354,7 @@ CLI_EXPORT_UUID_FROM_FILE_FILENAMES = [
"wedding_edited.jpeg",
]
# determine if exiftool installed so exiftool tests can be skipped
try:
exiftool = get_exiftool_path()
@@ -398,7 +399,6 @@ def setup_touch_tests():
CLI_EXPORT_BY_DATE_TOUCH_UUID
)
for photo in photos:
logging.warning(photo.path)
ts = int(photo.date.timestamp())
if photo.path is not None:
os.utime(photo.path, (ts, ts))
@@ -1826,6 +1826,7 @@ def test_export_filename_template_2():
files = glob.glob("*.*")
assert sorted(files) == sorted(CLI_EXPORTED_FILENAME_TEMPLATE_FILENAMES2)
def test_export_filename_template_pathsep_in_name():
""" export photos using filename template with folder_album and "/" in album name """
import locale
@@ -1850,7 +1851,7 @@ def test_export_filename_template_pathsep_in_name():
"--directory",
"{folder_album,None}",
"--uuid",
CLI_EXPORT_UUID_STATUE
CLI_EXPORT_UUID_STATUE,
],
)
assert result.exit_code == 0
@@ -1858,6 +1859,7 @@ def test_export_filename_template_pathsep_in_name():
# assert fname in result.output
assert pathlib.Path(fname).is_file()
def test_export_filename_template_3():
""" test --filename with invalid template """
import glob
@@ -2951,7 +2953,7 @@ def test_export_touch_files_update():
@pytest.mark.skipif(exiftool is None, reason="exiftool not installed")
def test_export_touch_files_exiftool_update():
""" test complex export scenario with --update, --exiftol, and --touch-files """
""" test complex export scenario with --update, --exiftool, and --touch-files """
import os
import pathlib
import time