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