Fix set original name to EXIF metadata
This commit is contained in:
parent
f8ae11c57f
commit
b571ba6468
|
@ -519,7 +519,7 @@ class SortMedias:
|
|||
|
||||
# change media file_path to dest_path
|
||||
if not self.dry_run:
|
||||
updated = self.medias.update_exif_data(metadata)
|
||||
updated = self.medias.update_exif_data(metadata, imp)
|
||||
if updated:
|
||||
checksum = utils.checksum(dest_path)
|
||||
metadata['checksum'] = checksum
|
||||
|
|
|
@ -62,7 +62,7 @@ class ExifMetadata:
|
|||
]
|
||||
tags_keys['latitude_ref'] = ['EXIF:GPSLatitudeRef']
|
||||
tags_keys['longitude_ref'] = ['EXIF:GPSLongitudeRef']
|
||||
tags_keys['original_name'] = ['XMP:OriginalFileName']
|
||||
tags_keys['original_name'] = ['EXIF:OriginalFileName', 'XMP:OriginalFileName']
|
||||
|
||||
# Remove ignored tag from list
|
||||
for tag_regex in self.ignore_tags:
|
||||
|
@ -742,7 +742,7 @@ class Medias:
|
|||
|
||||
yield src_path, metadata
|
||||
|
||||
def update_exif_data(self, metadata):
|
||||
def update_exif_data(self, metadata, imp=False):
|
||||
|
||||
file_path = self.root / metadata['file_path']
|
||||
exif = WriteExif(
|
||||
|
@ -752,8 +752,8 @@ class Medias:
|
|||
)
|
||||
|
||||
updated = False
|
||||
if metadata['original_name'] in (None, ''):
|
||||
exif.set_value('original_name', metadata['filename'])
|
||||
if imp and metadata['original_name'] in (None, ''):
|
||||
exif.set_key_values('original_name', metadata['filename'])
|
||||
updated = True
|
||||
if self.exif_opt['album_from_folder']:
|
||||
exif.set_album_from_folder()
|
||||
|
|
|
@ -218,7 +218,8 @@ class TestCollection:
|
|||
)
|
||||
assert not summary.errors
|
||||
# Ensure files remain the same
|
||||
assert collection._checkcomp(dest_path, src_checksum)
|
||||
if not imp:
|
||||
assert collection._checkcomp(dest_path, src_checksum)
|
||||
|
||||
if imp == 'copy':
|
||||
assert src_path.exists()
|
||||
|
|
Loading…
Reference in New Issue