-
-
Notifications
You must be signed in to change notification settings - Fork 135
Open
Milestone
Description
Describe the bug
When invalid metadata is encountered, an exception is thrown and the entire scanning process crashes.
To Reproduce
Steps to reproduce the behavior:
- Have a photo with "invalid" metadata (in my case, a timezone in one of the date fields)
- Run Photonix
- Encounter
ValueError: unconverted data remains: +01:00, leading toexited: rescan_photos_periodically (exit status 1; not expected)
Expected behavior
Invalid metadata is ignored and scan continues.
Additional context
Logs:
photonix | 2019-10-19 13:54:00,463 INFO spawned: 'rescan_photos_periodically' with pid 239
photonix | Traceback (most recent call last):
photonix | File "/srv/photonix/manage.py", line 22, in <module>
photonix | execute_from_command_line(sys.argv)
photonix | File "/usr/local/lib/python3.6/site-packages/django/core/management/__init__.py", line 364, in execute_from_command_line
photonix | utility.execute()
photonix | File "/usr/local/lib/python3.6/site-packages/django/core/management/__init__.py", line 356, in execute
photonix | self.fetch_command(subcommand).run_from_argv(self.argv)
photonix | File "/usr/local/lib/python3.6/site-packages/django/core/management/base.py", line 283, in run_from_argv
photonix | self.execute(*args, **cmd_options)
photonix | File "/usr/local/lib/python3.6/site-packages/django/core/management/base.py", line 330, in execute
photonix | output = self.handle(*args, **options)
photonix | File "/srv/photonix/photos/management/commands/rescan_photos_periodically.py", line 27, in handle
photonix | self.rescan_photos(options['paths'])
photonix | File "/srv/photonix/photos/management/commands/rescan_photos_periodically.py", line 22, in rescan_photos
photonix | import_photos_in_place(path)
photonix | File "/srv/photonix/photos/utils/organise.py", line 175, in import_photos_in_place
photonix | modified = record_photo(filepath)
photonix | File "/srv/photonix/photos/utils/db.py", line 24, in record_photo
photonix | date_taken = parse_datetime(metadata.get('Date/Time Original'))
photonix | File "/srv/photonix/photos/utils/metadata.py", line 27, in parse_datetime
photonix | return datetime.strptime(date_str, '%Y:%m:%d %H:%M:%S').replace(tzinfo=utc)
photonix | File "/usr/local/lib/python3.6/_strptime.py", line 565, in _strptime_datetime
photonix | tt, fraction = _strptime(data_string, format)
photonix | File "/usr/local/lib/python3.6/_strptime.py", line 365, in _strptime
photonix | data_string[found.end():])
photonix | ValueError: unconverted data remains: +01:00
photonix | 2019-10-19 13:55:01,653 INFO exited: rescan_photos_periodically (exit status 1; not expected)
photonix | 2019-10-19 13:55:02,654 INFO gave up: rescan_photos_periodically entered FATAL state, too many start retries too quickly
I think there should be a catchall somewhere in this stack which should log the error instead of crashing.
dennorske and damianmoore
Metadata
Metadata
Assignees
Labels
No labels