![]() |
#301 |
Grand Sorcerer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 28,358
Karma: 203720150
Join Date: Jan 2010
Device: Nexus 7, Kindle Fire HD
|
For anybody who's interested... I made an experimental calibre plugin version of mobi_unpack. You simply select a folder where you want to unpack to (or a permanent folder can be set in the configuration) and click "unpack". It also supports extracting PDFs from print replica ebooks and splitting KF8/MOBIs built by newer versions of Kindlegen.
Let me know if anyone runs into any trouble (and be sure to restart calibre after installing the plugin before configuring/using it). By all means, unzip the file to inspect the code if you're into that sort of thing, but otherwise the zip file is all ready to install as a plugin in calibre. You'll need a relatively new(ish) version of calibre to use it (>= 0.8.18) And unless there are massive structural changes to the current mobi_unpack code, it should be a matter of simply dropping the latest mobi_unpack files into the plugin (like I just did with v0.38). ![]() Have fun. P.S. - I'll start my own thread for this if there's an interest. EDIT: Plugin updated to incorporate the latest version of mobi_unpack EDIT: (2/20/2012) Plugin updated to incorporate mobi_unpack's v0.40 bug-fixes. EDIT: (2/29/2012) Plugin updated to incorporate mobi_unpack's v0.41 bug-fixes. EDIT: (3/8/2012) I've created a thread for the calibre plugin version of mobi_unpack in the appropriate calibre subforum. You can find it here. Last edited by DiapDealer; 03-08-2012 at 12:18 PM. |
![]() |
![]() |
![]() |
#302 |
Sigil Developer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 8,478
Karma: 5703586
Join Date: Nov 2009
Device: many
|
deleted since out of date
Deleted since out of date
Last edited by KevinH; 02-20-2012 at 11:05 AM. |
![]() |
![]() |
![]() |
#303 |
Wizard
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 1,669
Karma: 2300001
Join Date: Mar 2011
Location: Türkiye
Device: Kindle 5.3.7
|
|
![]() |
![]() |
![]() |
#304 |
Sigil Developer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 8,478
Karma: 5703586
Join Date: Nov 2009
Device: many
|
deleted since announced now out of date version
deleted since announced a now out of date version
Last edited by KevinH; 03-08-2012 at 12:18 PM. |
![]() |
![]() |
![]() |
#305 |
Sigil Developer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 8,478
Karma: 5703586
Join Date: Nov 2009
Device: many
|
New Version of Mobi_Unpack (now v0.45)
Hi All,
A new bug fix release is available: So we now have a Mobi_Unpack_v045.zip. See this post for the archive and usage information: https://www.mobileread.com/forums/sho...&postcount=297 Have Fun! Kevin Last edited by KevinH; 03-08-2012 at 12:18 PM. |
![]() |
![]() |
![]() |
#306 |
Linux User
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 2,282
Karma: 6123806
Join Date: Sep 2010
Location: Heidelberg, Germany
Device: none
|
Thanks.
Mobi_Unpack.pyw does not run natively in Linux (when trying to start it directly) because it uses DOS style \r\n line terminators, so it keeps looking for a "/usr/bin/python\r" which naturally does not exist. So it has to be started with "python Mobi_Unpack.pyw" or loaded and saved with Unix style \n newlines. I'll test this in more detail when I get my next mobi book. |
![]() |
![]() |
![]() |
#307 |
Grand Sorcerer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 28,358
Karma: 203720150
Join Date: Jan 2010
Device: Nexus 7, Kindle Fire HD
|
Just dos2unix Mobi_Unpack.pyw. It'll fix it right up.
![]() |
![]() |
![]() |
![]() |
#308 | |
Sigil Developer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 8,478
Karma: 5703586
Join Date: Nov 2009
Device: many
|
Hi,
Thanks for that info. Interestingly, a feature of most unzip programs is the ability to do automatic end of line conversions since there is no way for a cross-platform script file to have only one set of line ending across all platforms. On my command line version of unzip this is done using the -a option. So will you please try by grabbing the .zip again and unzipping it using the command line: unzip -a Mobi_Unpack_v041.zip and see if that same problem still happens. On my machine, unzip recognizes that python scripts are text files and converts the \r\n to just \n line endings automagically. Please let me know what you find out. KevinH Quote:
|
|
![]() |
![]() |
![]() |
#309 |
Linux User
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 2,282
Karma: 6123806
Join Date: Sep 2010
Location: Heidelberg, Germany
Device: none
|
I don't use unzip -a because it could be damaging. After all there could be a perfectly good reason why a particular file uses/needs this style of newlines.
In the lib folder most files use unix newlines, except for scrolltextwidget.py and subasyncio.py. I don't think there is any intentional reason for it, merely an oversight. Windows Python should be able to handle Unix \n newlines fine. |
![]() |
![]() |
![]() |
#310 | |
Sigil Developer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 8,478
Karma: 5703586
Join Date: Nov 2009
Device: many
|
Hi,
Quote:
Multiple people have developed these scripts on multiple platforms using multiple text editors and they will continue to do so. So some python files may end up as having \r\n at various points in time depending on what platform they were edited on last. So as I explained all you need do is unpack them properly using unzip -a and all will be well. Or use dos2unix as DiapDealer suggested. KevinH |
|
![]() |
![]() |
![]() |
#311 |
Linux User
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 2,282
Karma: 6123806
Join Date: Sep 2010
Location: Heidelberg, Germany
Device: none
|
In other words, it won't be fixed. That's all right, then. Sorry for bringing it up.
|
![]() |
![]() |
![]() |
#312 |
Sigil Developer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 8,478
Karma: 5703586
Join Date: Nov 2009
Device: many
|
Hi,
No, that is not what I said. I said "unpack it properly" and you won't have issues. The next version will convert to only newlines but I can't guarantee it will stay that way in the future because of the number of different people and editors used so unpacking it properly is the safest bet. |
![]() |
![]() |
![]() |
#313 |
Grand Sorcerer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 28,358
Karma: 203720150
Join Date: Jan 2010
Device: Nexus 7, Kindle Fire HD
|
That's the beauty of scripts: everyone's free to "fix" them in whatever way they see fit... even things that aren't truly broken.
![]() |
![]() |
![]() |
![]() |
#314 |
Linux User
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 2,282
Karma: 6123806
Join Date: Sep 2010
Location: Heidelberg, Germany
Device: none
|
We're talking at cross purpose then; if your purpose is to help me get it running, you don't need to - I know how to fix newlines, so you don't have to tell me about unzip, dos2unix, etc.
My purpose was to point out a minor problem in your software which has to be fixed on your end. I know how to fix it my self - others may not. And while unzip is able to convert newlines with an option, this just is not done usually. No one even thinks of it because files are supposed to be correct in the archive in the first place. It's unfortunate that Linux has problems with \r in the shebang line, as Python itself does not care either way about it. Part of the blame lies also with coreutils (/usr/bin/env) as it prints out the filename verbatim, causing the error message: Code:
/usr/bin/env: python\r: No such file or directory. Code:
: No such file or directory. Without /usr/bin/env you get an error message such as this: Code:
bash: ./Mobi_Unpack.pyw: /usr/bin/python^M: bad interpreter: No such file or directory As it is, Python source code just has to be using Unix newlines to be cross platform. Any one who works with or edits Python code should be aware of it (any proper coding editor would not turn \n into \r\n unasked anyway). Windows \r\n is Windows only, unfortunately. |
![]() |
![]() |
![]() |
#315 |
Grand Sorcerer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 28,358
Karma: 203720150
Join Date: Jan 2010
Device: Nexus 7, Kindle Fire HD
|
I've created a thread for the calibre plugin version of mobi_unpack in the appropriate calibre subforum. You can find it here. When mobi_unpack is updated, I'll try to update the plugin accordingly, as soon as possible.
Last edited by DiapDealer; 03-08-2012 at 12:18 PM. |
![]() |
![]() |
![]() |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
Can i rotate text and insert images in Mobi and EPUB? | JanGLi | Kindle Formats | 5 | 02-02-2013 04:16 PM |
PDF to Mobi with text and images | pocketsprocket | Kindle Formats | 7 | 05-21-2012 07:06 AM |
Mobi files - images | DWC | Introduce Yourself | 5 | 07-06-2011 01:43 AM |
pdf to mobi... creating images rather than text | Dumhed | Calibre | 5 | 11-06-2010 12:08 PM |
Transfer of images on text files | anirudh215 | 2 | 06-22-2009 09:28 AM |