smarnach / pyexiftool

a Python library to communicate with an instance of Phil Harvey's excellent ExifTool command-line application.
Other
270 stars 111 forks source link

'-CreateDate<filename' doesn't appear to work via et.execute #41

Closed djhanggi closed 1 year ago

djhanggi commented 1 year ago

You can use exiftool '-CreateDate<filename' to attempt to parse the file name as a date and set that to the CreateDate tag, on the command line. However, I am running into difficulties with doing this via pyexiftool.

with exiftool.ExifToolHelper(config_file="./exiftool.config", logger = logging.getLogger()) as et:
     et.execute("-CreateDate<filename", f)

I'm seeing 1 image files updated when I print the return state but after running exiftool -time:all on that file, the date has not been updated. There are also no warnings/errors in the debug log.

INFO 2022-09-04 17:31:21,743 - Method 'run': Exiftool version '12.42' (pid 42558) launched with args '['/usr/local/bin/exiftool', '-config', './exiftool.config', '-stay_open', 'True', '-@', '-', '-common_args', '-G', '-n']'
INFO 2022-09-04 17:31:21,743 - Method 'execute': Command sent = [b'-CreateDate<filename', b'redacted/20090506121211.png', b'-echo4', b'=${status}=post694948']
DEBUG 2022-09-04 17:31:21,928 - ExifToolHelper.execute: IN  params = ('-CreateDate<filename', 'redacted/20090506121211.png')
DEBUG 2022-09-04 17:31:21,928 - ExifToolHelper.execute: OUT stdout = "1 image files updated

Could you assist? Thanks

sylikc commented 1 year ago

Hi @djhanggi I'm assuming you're using the 0.4 version or above. Would you mind reposting this issue into my fork https://github.com/sylikc/pyexiftool if that's the case. I can support you there. (I don't have any privileges in this abandoned repository) Thanks!