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

Does anyone know if there's a way to change where the OCR txt is logged to? #37

Open
mellow-tnk opened this issue Jan 29, 2023 · 3 comments
Labels
feature request New feature or request

Comments

@mellow-tnk
Copy link

Currently, everything is being saved into log.txt. If I have several hundred images, everything is being logged into one txt file which makes it hard to manage and track. So currently, after every image, I rename the log file to the same filename as the image.

Is there a way for it to automatically save txt into individual txt files that have the same filename as the image by default? Or a better way to manage/track the OCR text being added to log.txt?

@blueaxis
Copy link
Owner

Text logging works on a per directory basis rather than per image, so the only way do to this is to rename each text file

@mellow-tnk
Copy link
Author

mellow-tnk commented Jan 29, 2023

in order to make it per each image file instead of directory, would it be a good idea to change default behavior? Instead of saving to "log.txt", change it to filename.txt?

in Poricom/app/components/views/ocr/base.py

def mouseReleaseEvent(self, event):
    logPath = join(self.explorerPath, "text-log.txt")
    text = self.canvasText.text()
    logText(text, isLogFile=self.logToFile, path=logPath)
    try:
        if not self.persistText:
            self.canvasText.hide()
    except AttributeError:
        pass
    super().mouseReleaseEvent(event)

so instead of
logPath = join(self.explorerPath, "text-log.txt")
it'll be something like
logPath = join(self.explorerPath, "text-"+os.path.splitext(file_name)[0]+".txt")
or maybe
logPath = join(self.explorerPath, "text-", os.path.splitext(file_name)[0], ".txt")

it's been like 10 years since I last coded, so I'm not sure if that'll work.
Edit: or not since how would you know what filename it is if you're using external view? or maybe default to log.txt for external. I don't know.

@blueaxis
Copy link
Owner

blueaxis commented Feb 3, 2023

The filename of the current image can be accessed using self.states.baseImage.filename. In split view mode, this defaults to the left image.
But as you've mentioned, external view captures must be handled as well. Also, I think this must be optional since some users might prefer logging in one file. Honestly, I think it isn't worth implementing since it would just clutter the manga directory. For now, I'll keep it open to pull request if anyone wants to implement this

@blueaxis blueaxis added the feature request New feature or request label Feb 3, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature request New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants