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

StarDict -> Mobipocket: extract css file #401

Open
ww00xx opened this issue Nov 16, 2022 · 5 comments
Open

StarDict -> Mobipocket: extract css file #401

ww00xx opened this issue Nov 16, 2022 · 5 comments

Comments

@ww00xx
Copy link

ww00xx commented Nov 16, 2022

How can I set permanent KindleGen path in pyglossary (latest main branch) running on Win10, Python 3.11?
kindlegen.exe is located in C:\Users\X\AppData\Local\Amazon\Kindle Previewer 3\lib\fc\bin\

[WARNING] Not running kindlegen, the raw files are located in C:\Users\X\Desktop\pyglossary-master\OLAD9
[WARNING] Provide KindleGen path with: --write-options 'kindlegen_path=...'
@ilius
Copy link
Owner

ilius commented Nov 16, 2022

I pushed a commit.
Please make sure the directory containing kindlegen.exe is in PATH environment variable and try again with latest code.

@ww00xx
Copy link
Author

ww00xx commented Nov 19, 2022

Thanks. Path worked, but got KindleGen error and no .mobi file created (just .opf and bunch of .xhtml).

There is no style.css created during conversion from StarDict (.ifo) to Mobipocket (.mobi), thus KindleGen can not access the file. Any solution?

Console:
[INFO] Automatically switching to SQLite mode for writing Mobi
[INFO] Using sortKeyName = 'ebook'
[INFO] Detected sourceLang='English', targetLang='English' from glossary name "Oxford Advanced Learner's Dictionary | 9th ed (En-En)"
[INFO] Writing to Mobi file 'C:\\Users\\X\\Desktop\\pyglossary-master\\OALD9'
[INFO] Sorting took 0.2 seconds
[INFO] Creating .mobi file with kindlegen, using 'C:\\Users\\X\\AppData\\Local\\Amazon\\Kindle Previewer 3\\lib\\fc\\bin\\kindlegen.EXE'
[INFO] 

*************************************************************
 Amazon kindlegen(Windows) V2.9 build 0000-kdevbld 
 A command line e-book compiler 
 Copyright Amazon.com and its Affiliates 2015 
*************************************************************

Info:I9021:option: (hidden) creates mobi for older devices.
Info(prcgen):I1047: Added metadata dc:Title        "Oxford Advanced Learner's Dictionary | 9th ed (En-En)"
Info(prcgen):I1047: Added metadata dc:Creator      "pocketbookdic.pl"
Info(prcgen):I1047: Added metadata BASICCode       "REF008000"
Info(prcgen):I1047: Added metadata dc:Subject      "Dictionaries"
Info(prcgen):I1047: Added metadata dc:Description  "lang_from="" lang_to="" format="visual""
Error(core):E1005: Could not access file.

in file: C:\Users\X\Desktop\pyglossary-master\OALD9\OEBPS\style.css

Info(prcgen):I1002: Parsing files  0000548

[INFO] Created .mobi file with kindlegen: C:\Users\X\Desktop\pyglossary-master\OALD9\OEBPS\content.mobi
[INFO] Writing file 'C:\\Users\\X\\Desktop\\pyglossary-master\\OALD9' done.
[INFO] Running time of convert: 30.2 seconds

@ilius
Copy link
Owner

ilius commented Nov 19, 2022

Can you upload your StarDict glossary?

@ww00xx
Copy link
Author

ww00xx commented Nov 19, 2022

Got it from here: https://e.pcloud.link/publink/show?code=kZDhJ7ZBRkwNE50R4hz731AWB2RAb2Gmg3X#folder=4278386439&tpl=publicfoldergrid

These files are examples of dictionaries converted with PocketbookDic, a perl-script published on Github.
Typically there are three formats:
- Stardict optimized for Koreader is a zip-file containing the 3 Stardict files (dict.dz-, idx- and ifo-extensions) and 2 files for Koreader (a css-file as a cascading stylesheet and a lua-file for on-the-fly modifications done to the content of the dictionary entry as it is displayed in Koreader).
- Pocketbook's binary dic-files.
- Text-files in the XDXF-format compressed to a zip-file. 

Direct Oxford Advanced Learners Dictionary 9th Ed._Nov22th2020.zip link: https://edef3.pcloud.com/cBZUP8SOZmQNDz7ZZZVpxnc7Z2ZZHORZkZNFXm7ZuZikZ17ZbkZ97Z27ZF7ZsZu7ZP7ZGZcZl7ZDZDhJ7ZCFoTTiIRg8f3n0wCqo73Mhpr61RV/Oxford%20Advanced%20Learners%20Dictionary%209th%20Ed._Nov22th2020.zip

Archive has OALD9_reconstructed.css file, so during conversion from StarDict (.ifo) to Mobipocket (.mobi) it should be (maybe) moved to OEBPS folder and renamed to style.css for KindleGen to use it.

@ilius ilius changed the title Permanent KindleGen path in pyglossary Problem with Mobipocket and KindleGen Nov 25, 2022
@ilius
Copy link
Owner

ilius commented Nov 25, 2022

Please try adding --write-options=css=OALD9_reconstructed.css flag to your pyglosssary command.

@ilius ilius changed the title Problem with Mobipocket and KindleGen StarDict -> Mobipocket: extract css file Nov 25, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants