Skip to content

Instantly share code, notes, and snippets.

@hexandcube
Created July 6, 2021 20:46
Show Gist options
  • Save hexandcube/8e2c8aab22f64541f2966ca556d84daf to your computer and use it in GitHub Desktop.
Save hexandcube/8e2c8aab22f64541f2966ca556d84daf to your computer and use it in GitHub Desktop.
rules:
- folders: 'C:\'
filters:
- extension:
- .jpg
- .jpeg
- .png
- .mp4
- .mkv
- .avi
- .gif
- .wmv
- exif
- python: |
import PIL.Image
from datetime import datetime
img = PIL.Image.open(path)
exif_data = img._getexif()
year = datetime.strptime(exif_data[36867], "%Y:%m:%d %H:%M:%S").year
month = datetime.strptime(exif_data[36867], "%Y:%m:%d %H:%M:%S").month
day = datetime.strptime(exif_data[36867], "%Y:%m:%d %H:%M:%S").day
return {"year": year, "month": month, "day": day}
actions:
- echo: 'Date: {python.year}-{python.month}-{python.day}'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment