Skip to content

autogen not working with my files #130

Open
@crypto512

Description

I've started using prosopopee today and I love the result but I've found some issues (this one and space in filename/dir issue).

autogen is generating random sequence so i've tried to understand why.
Regarding EXIF my issue was that the tag for the Date is DateTimeOriginal and not DateTime.
It also seems that exif[tag] is not a date when printed.

I've also used the new function getexif instead of _getexif.

Why using last modification instead of creation if there is no EXIF ? Maybe sometimes the filename is better in that case.

as I'm not a python programmer dont assume the code is done the right way but it works:

--- a/prosopopee/autogen.py
+++ b/prosopopee/autogen.py
@@ -36,14 +36,13 @@ types = ("*.JPG", "*.jpg", "*.JPEG", "*.jpeg", "*.png", "*.PNG")


 def get_exif(filename):
-    exif = Image.open(filename)._getexif()
+    exif = Image.open(filename).getexif()
     if exif is not None:
-        for tag in exif:
-            decoded = TAGS.get(tag, tag)
-            if decoded == "DateTime":
-                return exif[tag]
+        ctime = exif.get(36867)
+        if ctime is not None:
+            return ctime

-    return strftime("%Y:%m:%d %H:%M:00", gmtime(os.path.getmtime(filename)))
+    return strftime("%Y:%m:%d %H:%M:00", gmtime(os.path.getctime(filename)))


 def build_template(folder, force):

any advice ?

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions