Register Guidelines E-Books Today's Posts Search

Go Back   MobileRead Forums > E-Book Formats > Kindle Formats

Notices

Reply
 
Thread Tools Search this Thread
Old 02-11-2012, 06:32 PM   #301
DiapDealer
Grand Sorcerer
DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.
 
DiapDealer's Avatar
 
Posts: 27,547
Karma: 193191846
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.
DiapDealer is offline   Reply With Quote
Old 02-12-2012, 02:15 PM   #302
KevinH
Sigil Developer
KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.
 
Posts: 7,643
Karma: 5433388
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.
KevinH is offline   Reply With Quote
Old 02-18-2012, 04:10 AM   #303
thomass
Wizard
thomass ought to be getting tired of karma fortunes by now.thomass ought to be getting tired of karma fortunes by now.thomass ought to be getting tired of karma fortunes by now.thomass ought to be getting tired of karma fortunes by now.thomass ought to be getting tired of karma fortunes by now.thomass ought to be getting tired of karma fortunes by now.thomass ought to be getting tired of karma fortunes by now.thomass ought to be getting tired of karma fortunes by now.thomass ought to be getting tired of karma fortunes by now.thomass ought to be getting tired of karma fortunes by now.thomass ought to be getting tired of karma fortunes by now.
 
Posts: 1,669
Karma: 2300001
Join Date: Mar 2011
Location: Türkiye
Device: Kindle 5.3.7
Quote:
Originally Posted by DiapDealer View Post
For anybody who's interested... I made an experimental calibre plugin version of mobi_unpack.
Thanks for the plugin. works great
thomass is offline   Reply With Quote
Old 02-20-2012, 11:03 AM   #304
KevinH
Sigil Developer
KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.
 
Posts: 7,643
Karma: 5433388
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.
KevinH is offline   Reply With Quote
Old 02-29-2012, 12:05 PM   #305
KevinH
Sigil Developer
KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.
 
Posts: 7,643
Karma: 5433388
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.
KevinH is offline   Reply With Quote
Old 02-29-2012, 12:18 PM   #306
frostschutz
Linux User
frostschutz ought to be getting tired of karma fortunes by now.frostschutz ought to be getting tired of karma fortunes by now.frostschutz ought to be getting tired of karma fortunes by now.frostschutz ought to be getting tired of karma fortunes by now.frostschutz ought to be getting tired of karma fortunes by now.frostschutz ought to be getting tired of karma fortunes by now.frostschutz ought to be getting tired of karma fortunes by now.frostschutz ought to be getting tired of karma fortunes by now.frostschutz ought to be getting tired of karma fortunes by now.frostschutz ought to be getting tired of karma fortunes by now.frostschutz ought to be getting tired of karma fortunes by now.
 
frostschutz's Avatar
 
Posts: 2,279
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.
frostschutz is offline   Reply With Quote
Old 02-29-2012, 12:29 PM   #307
DiapDealer
Grand Sorcerer
DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.
 
DiapDealer's Avatar
 
Posts: 27,547
Karma: 193191846
Join Date: Jan 2010
Device: Nexus 7, Kindle Fire HD
Just dos2unix Mobi_Unpack.pyw. It'll fix it right up.
DiapDealer is offline   Reply With Quote
Old 02-29-2012, 12:31 PM   #308
KevinH
Sigil Developer
KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.
 
Posts: 7,643
Karma: 5433388
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:
Originally Posted by frostschutz View Post
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.
KevinH is offline   Reply With Quote
Old 02-29-2012, 12:44 PM   #309
frostschutz
Linux User
frostschutz ought to be getting tired of karma fortunes by now.frostschutz ought to be getting tired of karma fortunes by now.frostschutz ought to be getting tired of karma fortunes by now.frostschutz ought to be getting tired of karma fortunes by now.frostschutz ought to be getting tired of karma fortunes by now.frostschutz ought to be getting tired of karma fortunes by now.frostschutz ought to be getting tired of karma fortunes by now.frostschutz ought to be getting tired of karma fortunes by now.frostschutz ought to be getting tired of karma fortunes by now.frostschutz ought to be getting tired of karma fortunes by now.frostschutz ought to be getting tired of karma fortunes by now.
 
frostschutz's Avatar
 
Posts: 2,279
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.
frostschutz is offline   Reply With Quote
Old 02-29-2012, 02:00 PM   #310
KevinH
Sigil Developer
KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.
 
Posts: 7,643
Karma: 5433388
Join Date: Nov 2009
Device: many
Hi,

Quote:
Originally Posted by frostschutz View Post
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.
Using unzip -a on Mobi_Unpack_vXXX.zip is perfectly safe as it is a pure python implementation (all text files) and includes no binary files. That is why unzip has the -a option to begin with. And that is why I suggested you to use it.

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
KevinH is offline   Reply With Quote
Old 03-01-2012, 06:31 AM   #311
frostschutz
Linux User
frostschutz ought to be getting tired of karma fortunes by now.frostschutz ought to be getting tired of karma fortunes by now.frostschutz ought to be getting tired of karma fortunes by now.frostschutz ought to be getting tired of karma fortunes by now.frostschutz ought to be getting tired of karma fortunes by now.frostschutz ought to be getting tired of karma fortunes by now.frostschutz ought to be getting tired of karma fortunes by now.frostschutz ought to be getting tired of karma fortunes by now.frostschutz ought to be getting tired of karma fortunes by now.frostschutz ought to be getting tired of karma fortunes by now.frostschutz ought to be getting tired of karma fortunes by now.
 
frostschutz's Avatar
 
Posts: 2,279
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.
frostschutz is offline   Reply With Quote
Old 03-01-2012, 10:17 AM   #312
KevinH
Sigil Developer
KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.KevinH ought to be getting tired of karma fortunes by now.
 
Posts: 7,643
Karma: 5433388
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.
KevinH is offline   Reply With Quote
Old 03-01-2012, 10:40 AM   #313
DiapDealer
Grand Sorcerer
DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.
 
DiapDealer's Avatar
 
Posts: 27,547
Karma: 193191846
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.
DiapDealer is offline   Reply With Quote
Old 03-01-2012, 10:43 AM   #314
frostschutz
Linux User
frostschutz ought to be getting tired of karma fortunes by now.frostschutz ought to be getting tired of karma fortunes by now.frostschutz ought to be getting tired of karma fortunes by now.frostschutz ought to be getting tired of karma fortunes by now.frostschutz ought to be getting tired of karma fortunes by now.frostschutz ought to be getting tired of karma fortunes by now.frostschutz ought to be getting tired of karma fortunes by now.frostschutz ought to be getting tired of karma fortunes by now.frostschutz ought to be getting tired of karma fortunes by now.frostschutz ought to be getting tired of karma fortunes by now.frostschutz ought to be getting tired of karma fortunes by now.
 
frostschutz's Avatar
 
Posts: 2,279
Karma: 6123806
Join Date: Sep 2010
Location: Heidelberg, Germany
Device: none
Quote:
Originally Posted by KevinH View Post
I said "unpack it properly" and you won't have issues.
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.
To show up as:

Code:
: No such file or directory.
instead, since the \r throws the cursor back to the beginning of the line and the following text overwrites the beginning of the message.

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
So the \r has been replaced with ^M which gives the user a more useful error message.


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.
frostschutz is offline   Reply With Quote
Old 03-08-2012, 12:14 PM   #315
DiapDealer
Grand Sorcerer
DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.DiapDealer ought to be getting tired of karma fortunes by now.
 
DiapDealer's Avatar
 
Posts: 27,547
Karma: 193191846
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.
DiapDealer is offline   Reply With Quote
Reply


Forum Jump

Similar Threads
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 PDF 2 06-22-2009 09:28 AM


All times are GMT -4. The time now is 01:22 AM.


MobileRead.com is a privately owned, operated and funded community.