Register Guidelines E-Books Search Today's Posts Mark Forums Read

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

Notices

Reply
 
Thread Tools Search this Thread
Old 04-14-2011, 09:13 AM   #1
petercrowell
Connoisseur
petercrowell began at the beginning.
 
Posts: 61
Karma: 10
Join Date: Apr 2011
Device: Kindle
Kindlegen for mac neophyte needs some help

Hi,

I'm in the command line tool using Kindlegen for mac and I can't figure out how to write the path to get my .html file to convert to .mobi.

Can anyone give me the syntax?

Thanks!
petercrowell is offline   Reply With Quote
Old 04-14-2011, 11:32 AM   #2
st_albert
Guru
st_albert gives new meaning to the word 'superlative.'st_albert gives new meaning to the word 'superlative.'st_albert gives new meaning to the word 'superlative.'st_albert gives new meaning to the word 'superlative.'st_albert gives new meaning to the word 'superlative.'st_albert gives new meaning to the word 'superlative.'st_albert gives new meaning to the word 'superlative.'st_albert gives new meaning to the word 'superlative.'st_albert gives new meaning to the word 'superlative.'st_albert gives new meaning to the word 'superlative.'st_albert gives new meaning to the word 'superlative.'
 
Posts: 688
Karma: 150000
Join Date: Feb 2010
Device: none
from the kindlegen readme.txt file:

Quote:
5. To convert a file called book.html, go to the directory where the book is present, eg. 'cd Desktop' and all you have to do now is type '~/KindleGen/kindlegen book.html' and if successful, you will see a successful conversion and a new file on your Desktop called book.mobi.
If the above is not helpful, perhaps you could be more specific about what you have tried, and what the result is, and/or what you don't understand.
st_albert is offline   Reply With Quote
Advert
Old 04-14-2011, 11:36 AM   #3
petercrowell
Connoisseur
petercrowell began at the beginning.
 
Posts: 61
Karma: 10
Join Date: Apr 2011
Device: Kindle
Disregard this post. Not sure what happened.

Hi S

To convert a file called book.html, go to the directory where the book is present, eg. 'cd Desktop' and all you have to do now is type '~/KindleGen/kindlegen book.html' and if successful, you will see a successful conversion and a new file on your Desktop called book.mobi.

Last edited by petercrowell; 04-14-2011 at 11:46 AM.
petercrowell is offline   Reply With Quote
Old 04-14-2011, 11:40 AM   #4
petercrowell
Connoisseur
petercrowell began at the beginning.
 
Posts: 61
Karma: 10
Join Date: Apr 2011
Device: Kindle
That's exactly where I'm stuck

Hi St. Albert,

That place in the instructions is exactly where I'm stuck. Exactly what should I type in?

I've tried: foldername/KindleGen/kindlegen nameofbook.html

I get a "no such folder" response.

I think I just need the exact syntax for what to write. I'm not understanding what these instructions are asking...

To convert a file called book.html, go to the directory where the book is present, eg. 'cd Desktop' and all you have to do now is type '~/KindleGen/kindlegen book.html' and if successful, you will see a successful conversion and a new file on your Desktop called book.mobi.
petercrowell is offline   Reply With Quote
Old 04-14-2011, 11:44 AM   #5
petercrowell
Connoisseur
petercrowell began at the beginning.
 
Posts: 61
Karma: 10
Join Date: Apr 2011
Device: Kindle
Or maybe my problem is that I don't know what "go to the directory where the book is present" means.

Am I doing that inside the command line tool? Am I literally opening the folder? What does that step look like?
petercrowell is offline   Reply With Quote
Advert
Old 04-14-2011, 12:01 PM   #6
pdurrant
The Grand Mouse 高貴的老鼠
pdurrant ought to be getting tired of karma fortunes by now.pdurrant ought to be getting tired of karma fortunes by now.pdurrant ought to be getting tired of karma fortunes by now.pdurrant ought to be getting tired of karma fortunes by now.pdurrant ought to be getting tired of karma fortunes by now.pdurrant ought to be getting tired of karma fortunes by now.pdurrant ought to be getting tired of karma fortunes by now.pdurrant ought to be getting tired of karma fortunes by now.pdurrant ought to be getting tired of karma fortunes by now.pdurrant ought to be getting tired of karma fortunes by now.pdurrant ought to be getting tired of karma fortunes by now.
 
pdurrant's Avatar
 
Posts: 71,406
Karma: 305065800
Join Date: Jul 2007
Location: Norfolk, England
Device: Kindle Voyage
Quote:
Originally Posted by petercrowell View Post
Or maybe my problem is that I don't know what "go to the directory where the book is present" means.

Am I doing that inside the command line tool? Am I literally opening the folder? What does that step look like?
Use the 1.0 Applescript from here.
pdurrant is offline   Reply With Quote
Old 04-14-2011, 12:12 PM   #7
ATDrake
Wizzard
ATDrake ought to be getting tired of karma fortunes by now.ATDrake ought to be getting tired of karma fortunes by now.ATDrake ought to be getting tired of karma fortunes by now.ATDrake ought to be getting tired of karma fortunes by now.ATDrake ought to be getting tired of karma fortunes by now.ATDrake ought to be getting tired of karma fortunes by now.ATDrake ought to be getting tired of karma fortunes by now.ATDrake ought to be getting tired of karma fortunes by now.ATDrake ought to be getting tired of karma fortunes by now.ATDrake ought to be getting tired of karma fortunes by now.ATDrake ought to be getting tired of karma fortunes by now.
 
Posts: 11,517
Karma: 33048258
Join Date: Mar 2010
Location: Roundworld
Device: Kindle 2 International, Sony PRS-T1, BlackBerry PlayBook, Acer Iconia
I'm guessing you've never used the command-line at all?

If that's the case, then here are my easy step-by-step instructions for total Terminal newbies.
  1. Get 2 folders open in the Finder: the folder where you have unzipped KindleGen, and the folder where the html or ePub file you want to convert is.
  2. Go to Applications/Utilities and launch the Terminal app.
  3. Drag and drop the KindleGen utility from the KindleGen folder onto the Terminal window: you should see a line then saying /WhereverYouvePlacedIt/kindlegen show up in the Terminal window.
  4. Drag and drop your OPF or ePub file if you have one or your HTML file if that's all you have, onto the Terminal window: you should see a line then saying /WhereverYouvePlacedIt/yourfile.opf.epub.html right after the "kindlegen" bit (with a space)
  5. Type "-o WhateverYouWantToNameIt.mobi" right after the kindlegen + file.opf.epub.html stuff. Optionally add "-c2" for tightest compression if file size matters.
  6. Press return, and wait for KindleGen to compile your book or spit out error messages (add "-verbose" to the command line options when you retry to see more error message which may help you track down the problem).
  7. If all goes well, enjoy your new e-book!

You may find it easier to use MR member pdurrant's handy drag and drop AppleScript front-end to KindleGen, although I don't know if he's updated it for the changes in 1.2.

Also, the newer versions of KindleGen bloat up the resulting file by incorporating a copy of the original source files in the final book, so you may also want to use KindleStrip, which also has a handy AppleScript droplet version, to get rid of that before you submit the file to Amazon.

If you get more proficient at using the Terminal in the future, you can add both commands to a location in your $PATH somewhere and alias them for the most usual options you use for convenience.

Hope this helps.
ATDrake is offline   Reply With Quote
Old 04-14-2011, 12:14 PM   #8
ATDrake
Wizzard
ATDrake ought to be getting tired of karma fortunes by now.ATDrake ought to be getting tired of karma fortunes by now.ATDrake ought to be getting tired of karma fortunes by now.ATDrake ought to be getting tired of karma fortunes by now.ATDrake ought to be getting tired of karma fortunes by now.ATDrake ought to be getting tired of karma fortunes by now.ATDrake ought to be getting tired of karma fortunes by now.ATDrake ought to be getting tired of karma fortunes by now.ATDrake ought to be getting tired of karma fortunes by now.ATDrake ought to be getting tired of karma fortunes by now.ATDrake ought to be getting tired of karma fortunes by now.
 
Posts: 11,517
Karma: 33048258
Join Date: Mar 2010
Location: Roundworld
Device: Kindle 2 International, Sony PRS-T1, BlackBerry PlayBook, Acer Iconia
Aargh. Duplicate post.

Might as well add that the "official" way to get to folders on the command line is to type "cd", then a space, then to the folder you want (which you can drag and drop onto the Terminal to save time).

E.g. "cd ~/KindleGen/" which will take you inside a folder at the top level of your Home named KindleGen.

Last edited by ATDrake; 04-14-2011 at 12:18 PM. Reason: Might as well add some useful info to the blank space.
ATDrake is offline   Reply With Quote
Old 04-14-2011, 12:17 PM   #9
st_albert
Guru
st_albert gives new meaning to the word 'superlative.'st_albert gives new meaning to the word 'superlative.'st_albert gives new meaning to the word 'superlative.'st_albert gives new meaning to the word 'superlative.'st_albert gives new meaning to the word 'superlative.'st_albert gives new meaning to the word 'superlative.'st_albert gives new meaning to the word 'superlative.'st_albert gives new meaning to the word 'superlative.'st_albert gives new meaning to the word 'superlative.'st_albert gives new meaning to the word 'superlative.'st_albert gives new meaning to the word 'superlative.'
 
Posts: 688
Karma: 150000
Join Date: Feb 2010
Device: none
OK, let's assume you have downloaded the KindleGen.zip file to your mac, and unzipped it into a directory called "KindleGen" in your home directory, just like the instructions said.

Let's further assume your nameofbook.html file is located in your Desktop folder.

Now, open Terminal.app, and you should be in your home directory. To verify this, type "pwd" at the prompt (without quotes, of course), hit return (<cr>), and you should see something like:

/Users/petercrowell

if your username is "petercrowell"

Now if you type "ls" at the prompt, and hit return you should see a listing of files and subdirectories within your home directory. Among those should be a directory called "KindleGen", which is where the kindlegen program resides, and one called "Desktop" which is where your nameofbook.html file resides. (If you installed kindlegen elsewhere, or your .html file elsewhere, adjust the pathnames in the following steps to match your actual situation.)

so now you need to change your working directory to the Desktop directory, by typing "cd Desktop" and hitting return. (Note: it's case-sensitive.)

Now if you type "pwd<cr>" you should see

/Users/petercrowell/Desktop

and if you type "ls<cr>" you should see a listing of all the files and directories on your desktop, among which should be "nameofbook.html".

Now we're ready for the big finish: At the command prompt, type

~/KindleGen/kindlegen nameofbook.html<cr>

and if all goes well you'll have a new file, nameofbook.mobi, in the Desktop directory and, thus, on your desktop.

Don't forget the "~" in the kindlegen command. The "~" is unix shorthand for your home directory, /Users/petercrowell/ in this example. So the complete command is actually

"/Users/petercrowell/KindleGen/kindlegen nameofbook.html"

Because you are in the same directory as nameofbook.html when you execute the command, you don't need to specify a full path to the input file -- just the filename iteself.

The output file will ALWAYS be put in the current directory -- i.e. the one where you were when you executed the command. I don't think you can specify an alternate path.

Hope this helps!
st_albert is offline   Reply With Quote
Old 04-14-2011, 12:35 PM   #10
petercrowell
Connoisseur
petercrowell began at the beginning.
 
Posts: 61
Karma: 10
Join Date: Apr 2011
Device: Kindle
Yes, I'm a complete newbie to the command line!

Thank you everyone for your help. Yes, I am a complete and total newbie to the command line on my mac.

ATDrake, St. Albert, thanks so much. Your tutorials should be exactly what I need.

pdurrant, thanks for the applescript. When I have a better understanding of how this works I'll be wanting to automate a bit.

I think I have what I need to take the next step.

Thanks again everyone!
petercrowell is offline   Reply With Quote
Old 04-14-2011, 09:10 PM   #11
petercrowell
Connoisseur
petercrowell began at the beginning.
 
Posts: 61
Karma: 10
Join Date: Apr 2011
Device: Kindle
A question about a command line error

Well, I've hit a snag I can't figure out. Can anyone see anything in the manifest and spine code that would yield the error that follows below?


The code:
<manifest>

<item id=”item1″ media-type=”text/x-oeb1-document” href=”silverlance.html“></item>

<item id=”toc” media-type=”application/x-dtbncx+xml” href=”toc.ncx”></item>

</manifest>

<spine toc=”toc”>

<itemref idref=”item1″/>

</spine>


The command line error:
option: -verbose: Verbose output
Error(opfparser): the id in the spine does not match any item in the manifest: ”item1″/
petercrowell is offline   Reply With Quote
Old 04-14-2011, 09:22 PM   #12
ATDrake
Wizzard
ATDrake ought to be getting tired of karma fortunes by now.ATDrake ought to be getting tired of karma fortunes by now.ATDrake ought to be getting tired of karma fortunes by now.ATDrake ought to be getting tired of karma fortunes by now.ATDrake ought to be getting tired of karma fortunes by now.ATDrake ought to be getting tired of karma fortunes by now.ATDrake ought to be getting tired of karma fortunes by now.ATDrake ought to be getting tired of karma fortunes by now.ATDrake ought to be getting tired of karma fortunes by now.ATDrake ought to be getting tired of karma fortunes by now.ATDrake ought to be getting tired of karma fortunes by now.
 
Posts: 11,517
Karma: 33048258
Join Date: Mar 2010
Location: Roundworld
Device: Kindle 2 International, Sony PRS-T1, BlackBerry PlayBook, Acer Iconia
I think the actual problem is much more fundamental than any flaws in your opf markup, which otherwise seems fine.

But by the section you copy-pasted, is your editor set to use "smart quotes"? Because that will completely mess up the parser's ability to read and understand your markup. It has to be all straight quotes or straight apostrophes in the markup.
ATDrake is offline   Reply With Quote
Old 04-14-2011, 09:25 PM   #13
petercrowell
Connoisseur
petercrowell began at the beginning.
 
Posts: 61
Karma: 10
Join Date: Apr 2011
Device: Kindle
I humbly admit to having copy/pasted all the markup from a tutorial I found on a blog. I wondered about the curly quotes.

I'll fix those and try it again.

Thanks ATDrake!
petercrowell is offline   Reply With Quote
Old 04-14-2011, 09:33 PM   #14
petercrowell
Connoisseur
petercrowell began at the beginning.
 
Posts: 61
Karma: 10
Join Date: Apr 2011
Device: Kindle
I fixed all the curlies, and the .mobi went through. But it did so with "warnings"

Info(prcgen): The file format version is V6
Info(prcgen): Saving MOBI file
Info(prcgen): MOBI File generated with WARNINGS!

I'm guessing that's not normal?
petercrowell is offline   Reply With Quote
Old 04-14-2011, 09:52 PM   #15
ATDrake
Wizzard
ATDrake ought to be getting tired of karma fortunes by now.ATDrake ought to be getting tired of karma fortunes by now.ATDrake ought to be getting tired of karma fortunes by now.ATDrake ought to be getting tired of karma fortunes by now.ATDrake ought to be getting tired of karma fortunes by now.ATDrake ought to be getting tired of karma fortunes by now.ATDrake ought to be getting tired of karma fortunes by now.ATDrake ought to be getting tired of karma fortunes by now.ATDrake ought to be getting tired of karma fortunes by now.ATDrake ought to be getting tired of karma fortunes by now.ATDrake ought to be getting tired of karma fortunes by now.
 
Posts: 11,517
Karma: 33048258
Join Date: Mar 2010
Location: Roundworld
Device: Kindle 2 International, Sony PRS-T1, BlackBerry PlayBook, Acer Iconia
KindleGen almost always does that. It's picky and somewhat buggy, so unless the warnings come with specific error messages, it's generally safe to ignore them.

As long as your book got built correctly, you should be fine.

You might want to check in Kindle Previewer to make sure the cover image, html TOC, and NCX were applied in the way that will make them accessible through the menu and 5-way controller, if this version of your book was meant to have them. There are three handy toolbar buttons on the right-hand side of KPreviewer just for this purpose.

Congratulations on having built your first e-book!
ATDrake is offline   Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Anyone using Kindlegen? simonp Kindle Formats 11 09-16-2011 05:17 AM
Troubleshooting TOC fails in Kindlegen 1.1, not Kindlegen 1.0 cyberbaffled Amazon Kindle 3 12-25-2010 05:21 PM
KindleGen 1.1 pdurrant Kindle Formats 0 08-08-2010 06:18 AM
Kindlegen now for Mac OS X (Intel) pdurrant Kindle Formats 4 04-27-2010 02:46 PM
Classic nook Impressions From a Neophyte Abulia Barnes & Noble NOOK 20 12-30-2009 07:51 PM


All times are GMT -4. The time now is 05:13 AM.


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