formatting, additional logging

This commit is contained in:
Xevion
2019-11-01 22:47:03 -05:00
parent a6bfd8daef
commit 30bb135216

View File

@@ -61,16 +61,17 @@ class FileProcessor(object):
# XMP sidecar file specified, write to it using XML module
if self.xmp_name:
print('\tWriting {} tags to output XMP...'.format(len(labels)))
logging.info('\tWriting {} tags to output XMP.'.format(len(labels)))
parser = XMPParser(os.path.join(INPUT_PATH, self.xmp_name))
parser.add_keywords(labels)
# Save the new XMP file
loggin.debug('Saving to new XMP file.')
parser.save(os.path.join(OUTPUT_PATH, self.xmp_name))
# Remove the old XMP file
logging.debug('Removing old XMP file.')
os.remove(os.path.join(INPUT_PATH, self.xmp_name))
# No XMP file is specified, using IPTC tagging
else:
print('\tWriting {} tags to output {}'.format(len(labels), self.ext[1:].upper()))
logging.info('\tWriting {} tags to image IPTC'.format(len(labels)))
info = iptcinfo3.IPTCInfo(os.path.join(INPUT_PATH, self.file_name))
info['keywords'].extend(labels)
info.save()