fix match

This commit is contained in:
Antonio J. Delgado 2021-09-06 23:55:07 +03:00
parent 4d281c7190
commit e6bc6d903a

View file

@ -95,7 +95,7 @@ class image_classifier:
self._log.debug(f"New path: {new_path}") self._log.debug(f"New path: {new_path}")
os.makedirs(os.path.dirname(new_path), exist_ok=True) os.makedirs(os.path.dirname(new_path), exist_ok=True)
if not new_path: if not new_path:
match = re.search(r'(?P<year>2[0-9]{3})[\-/\._]?(?P<month>[0-9]{1,2})[\-/\._]?(?P<day>[0-9]{1,2})') match = re.search(r'(?P<year>2[0-9]{3})[\-/\._]?(?P<month>[0-9]{1,2})[\-/\._]?(?P<day>[0-9]{1,2})', filename)
if match: if match:
new_path = os.path.join(dirname, match.group('year'), match.group('month'), match.group('day'), filename) new_path = os.path.join(dirname, match.group('year'), match.group('month'), match.group('day'), filename)
if new_path: if new_path: