-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
~/.cache/yadt directory do not create,so the font is downloaded repeated and slow the translate speed #584
Comments
|
After careful consideration, I rolled back the changes to yadt. YADT requires calling the yadt.high_level.init function for initialization before running. This function will definitely create a cache path. Therefore, this path will definitely exist afterwards. If this path disappears later, it's considered undefined behavior. https://github.com/funstory-ai/yadt/blob/1fccbef00a75df30f87c84c0bcc6dec7287bbd8c/yadt/high_level.py#L449 You might notice that the current pdf2zh doesn't call this function, which is indeed a bug, as I didn't notice it because this path already exists on my computer. However, this will only cause the program to crash, and it only happens when you specify the yadt backend, without affecting pdf2zh's original translation path. I will submit a PR to pdf2zh later to fix this issue. high_level.init is a recently introduced change, so pdf2zh has not been synchronized with the modification yet. update: #589 will fix it. |
I haven't decided how the program should behave when ~/.cache/yadt is suddenly deleted during runtime. Feel free to discuss at funstory-ai/BabelDOC#70 |
in the yadt module,the ~/.cache/yadt directory do not create . I browser the code, I think the reason is, in the yadt/main.py file,code is like that:
if name == "main":
main()
since the program is start by run pdf2zh , the yadt/main.py is not called directly,so the main() function is not call actually, hereby the create_cache_folder() function is not called. so ~/.cache/yadt directory is not created. each time the pdf2zh program is started , the font file must be downloaded again, slow the run speed.
I modified some code, the my way is put ~/.cache/yadt directory detection code in get_cache_file_path(). just an advice
since code is simple,I dont paste it
The text was updated successfully, but these errors were encountered: