Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feature Request] Ability to choose where the date of the score is taken from during OCR #9

Closed
JustVldKsh opened this issue May 30, 2024 · 7 comments
Assignees

Comments

@JustVldKsh
Copy link

Would be nice to have the ability to pick between file creation and modification time, especially considering how file creation date works on common Linux filesystems (idk about other operating systems). On ext4 and others, creation date is when the file was created on the filesystem and cannot be edited, unlike modification time that is changed only on data modification and is generally accurate in my case (and even if it wasn't, it is possible to fix with a script)

Probably kind of a niche thing, but would save a good amount of time for someone who cares about timestamps and stuff, like me

@283375
Copy link
Collaborator

283375 commented May 30, 2024

Do you mean those file choosers? I'm using the Qt QFileDialog for FileSelector, so I think it should open the system's native file dialog, and there should be some options to toggle the columns you like? Or if this isn't the case?

Oops, seems like I haven't read your question well, sorry!

Quite fair request, I'll try working on this :)

@JustVldKsh
Copy link
Author

Yeah, I'm about where the OCR itself pulls the date/time from and adds to the scores, not file dialog

@283375
Copy link
Collaborator

283375 commented Jun 16, 2024

I'm planning to add a new settings entry for this, but I can't really understand what I wrote before... so I'm temporarily delaying this issue until I'm fully available

However, you may change this function (Specifically L71):

def getImageDate(imagePath: str) -> QDateTime:
datetime = None
with contextlib.suppress(Exception):
with open(imagePath, "rb") as imgf:
exifImage = exif.Image(imgf.read())
if exifImage.has_exif and exifImage.get("datetime_original"):
datetimeStr = exifImage.get("datetime_original")
datetime = QDateTime.fromString(datetimeStr, "yyyy:MM:dd hh:mm:ss")
if not isinstance(datetime, QDateTime):
datetime = QFileInfo(imagePath).birthTime()
return datetime

Like this:

- datetime = QFileInfo(imagePath).birthTime()
+ datetime = QFileInfo(imagePath).lastModified()

Then the date should be extracted from the file modification date. You may refer to https://doc.qt.io/qt-6.5/qfileinfo.html for more choices.

@JustVldKsh
Copy link
Author

Thanks for telling where to look for a quick temporary fix/edit

Will note it down and probably process my scores tomorrow, will report back if any more issues arise along the way

283375 added a commit that referenced this issue Jun 19, 2024
* New settings entries

* Choose `birthTime`/`lastModified` for OCR score date source if the image EXIF fails
@283375
Copy link
Collaborator

283375 commented Jun 19, 2024

The new v0.3.9 adds a settings button in the OCR tab. I've tested it on Windows, and you may check if it works.

Also I've noticed the packaging library (nuitka) has a linux option now, and I've tried building it using GitHub Actions. The output is a single .bin file, I'm not sure if it's an "executable" or whatever😕Could you give it a try?

@JustVldKsh
Copy link
Author

Sure, will try tomorrow!

@JustVldKsh
Copy link
Author

JustVldKsh commented Jun 20, 2024

LGTM! A simple chmod +x (or even just a single confirmation that I do want to run it in the desktop I use) and it works! I think all the issues I opened can be closed after the actual 0.3.9 release

@283375 283375 closed this as completed Jun 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants