From 83ea4a509a10ca5888ba42bc9410d5838f7c1d21 Mon Sep 17 00:00:00 2001 From: Nico Jensen Date: Wed, 7 Feb 2024 14:42:12 +0100 Subject: [PATCH] Fix: System didnt get File Descripten for alt text correct New: Summary before post --- PixelfedImporter.py | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) diff --git a/PixelfedImporter.py b/PixelfedImporter.py index 82d6f24..297e8ec 100644 --- a/PixelfedImporter.py +++ b/PixelfedImporter.py @@ -45,8 +45,9 @@ def getItemDescription(filename): if exif_data: for tag, value in exif_data.items(): tag_name = TAGS.get(tag, tag) - if tag_name == "ImageDescription": - imageDescription = value + if str(tag_name) == "ImageDescription": + imageDescription = str(value) + break else: imageDescription = "This image has no description. Please let me know so that I can update it." else: @@ -76,7 +77,8 @@ def getPostText(filename): cam += "📸 " + value if cam != "" and tag_name == "Model": cam += " " + value - if tag_name == "Object Name": + if tag_name == "Object Name": + print(value) title = value else: raise ValueError("No EXIF data found.") @@ -167,7 +169,18 @@ def sendImages(Token, url, imagedir, uploadType, deleteFile): if uploadType == 0: postText = getPostText(f) newFileID = newFile.get("id") - createNewPost(Token, url, newFileID, postText) + print(f"----------------------------------------") + print(f"Post Summary: ") + print(f"ImageID: " + newFileID) + print(f"Image Description: " + newFile.get("description")) + print(f"Post Text: " + postText) + print(f"----------------------------------------") + print(f"Do you want to Publish this?") + if confirm(): + createNewPost(Token, url, newFileID, postText) + else: + deleteFile = False + print(f"File upload aborted.") else: if postText == "": postText = getPostText(f) -- 2.39.5