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

Go Back   MobileRead Forums > E-Book Formats > ePub

Notices

Reply
 
Thread Tools Search this Thread
Old 02-25-2013, 03:26 AM   #16
dgatwood
Curmudgeon
dgatwood ought to be getting tired of karma fortunes by now.dgatwood ought to be getting tired of karma fortunes by now.dgatwood ought to be getting tired of karma fortunes by now.dgatwood ought to be getting tired of karma fortunes by now.dgatwood ought to be getting tired of karma fortunes by now.dgatwood ought to be getting tired of karma fortunes by now.dgatwood ought to be getting tired of karma fortunes by now.dgatwood ought to be getting tired of karma fortunes by now.dgatwood ought to be getting tired of karma fortunes by now.dgatwood ought to be getting tired of karma fortunes by now.dgatwood ought to be getting tired of karma fortunes by now.
 
dgatwood's Avatar
 
Posts: 629
Karma: 1623086
Join Date: Jan 2012
Device: iPad, iPhone, Nook Simple Touch
Quote:
Originally Posted by roger64 View Post
I'll try it, though it does not work with Wine (a pity for a GPL tool). At least it's considerably lighter than calibre for this purpose.
If you're running Linux or OS X, just use the command-line zip tool. The syntax should be the same as in OS X.
dgatwood is offline   Reply With Quote
Old 02-25-2013, 04:01 AM   #17
roger64
Wizard
roger64 ought to be getting tired of karma fortunes by now.roger64 ought to be getting tired of karma fortunes by now.roger64 ought to be getting tired of karma fortunes by now.roger64 ought to be getting tired of karma fortunes by now.roger64 ought to be getting tired of karma fortunes by now.roger64 ought to be getting tired of karma fortunes by now.roger64 ought to be getting tired of karma fortunes by now.roger64 ought to be getting tired of karma fortunes by now.roger64 ought to be getting tired of karma fortunes by now.roger64 ought to be getting tired of karma fortunes by now.roger64 ought to be getting tired of karma fortunes by now.
 
Posts: 2,608
Karma: 3000161
Join Date: Jan 2009
Device: Kindle PW3 (wifi)
Quote:
Originally Posted by JSWolf View Post
I do use WinRAR and yes, you can add files to an ePub without messing up the structure. So you could add the XML and it would not cause a problem.
Thanks. At long last using WinRAR has been the most convenient solution for me. Though WinRAR is also working with Linux (Wine), I took no chance and did use a virtualised XP. Now the EPUB files have a successful Epubcheck validation and this dammed apple.xml file appears in the Misc folder when I open Sigil.

Thanks to all of you.

Last edited by roger64; 02-25-2013 at 04:04 AM.
roger64 is offline   Reply With Quote
Advert
Old 02-25-2013, 04:39 AM   #18
Jellby
frumious Bandersnatch
Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.
 
Jellby's Avatar
 
Posts: 7,514
Karma: 18512745
Join Date: Jan 2008
Location: Spaniard in Sweden
Device: Cybook Orizon, Kobo Aura
If you are on linux, it's best to just use the command-line zip, or maybe some front-end like ark, Xarchiver...
Jellby is offline   Reply With Quote
Old 02-25-2013, 05:33 AM   #19
roger64
Wizard
roger64 ought to be getting tired of karma fortunes by now.roger64 ought to be getting tired of karma fortunes by now.roger64 ought to be getting tired of karma fortunes by now.roger64 ought to be getting tired of karma fortunes by now.roger64 ought to be getting tired of karma fortunes by now.roger64 ought to be getting tired of karma fortunes by now.roger64 ought to be getting tired of karma fortunes by now.roger64 ought to be getting tired of karma fortunes by now.roger64 ought to be getting tired of karma fortunes by now.roger64 ought to be getting tired of karma fortunes by now.roger64 ought to be getting tired of karma fortunes by now.
 
Posts: 2,608
Karma: 3000161
Join Date: Jan 2009
Device: Kindle PW3 (wifi)
Quote:
Originally Posted by Jellby View Post
If you are on linux, it's best to just use the command-line zip, or maybe some front-end like ark, Xarchiver...
You're surely right but I went for what looked the easiest for me and my 45 files as I had already lost some time on this. Unhappily, the sky is not my limit...

I also used GPRename (Linux) to batch rename files from epub to zip and back, which saved some time.

If you have a command available for this, I'll be happy to try it next time.
roger64 is offline   Reply With Quote
Old 02-25-2013, 05:43 AM   #20
Jellby
frumious Bandersnatch
Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.
 
Jellby's Avatar
 
Posts: 7,514
Karma: 18512745
Join Date: Jan 2008
Location: Spaniard in Sweden
Device: Cybook Orizon, Kobo Aura
For renaming?

rename 's/.zip/.epub/' *e.zip

(or with other versions of rename: rename .zip .epub .zip)
Jellby is offline   Reply With Quote
Advert
Old 02-25-2013, 05:56 AM   #21
roger64
Wizard
roger64 ought to be getting tired of karma fortunes by now.roger64 ought to be getting tired of karma fortunes by now.roger64 ought to be getting tired of karma fortunes by now.roger64 ought to be getting tired of karma fortunes by now.roger64 ought to be getting tired of karma fortunes by now.roger64 ought to be getting tired of karma fortunes by now.roger64 ought to be getting tired of karma fortunes by now.roger64 ought to be getting tired of karma fortunes by now.roger64 ought to be getting tired of karma fortunes by now.roger64 ought to be getting tired of karma fortunes by now.roger64 ought to be getting tired of karma fortunes by now.
 
Posts: 2,608
Karma: 3000161
Join Date: Jan 2009
Device: Kindle PW3 (wifi)
No. Renaming was easy enough (see screenshot) though your solution is really nice.

I mean, opening the zip file (s), inserting the apple file in META, and back.
Attached Thumbnails
Click image for larger version

Name:	GPRename.png
Views:	204
Size:	79.4 KB
ID:	101945  
roger64 is offline   Reply With Quote
Old 02-25-2013, 06:21 AM   #22
Jellby
frumious Bandersnatch
Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.
 
Jellby's Avatar
 
Posts: 7,514
Karma: 18512745
Join Date: Jan 2008
Location: Spaniard in Sweden
Device: Cybook Orizon, Kobo Aura
zip file.epub META-INF/com.apple.ibooks.display-options.xml

It requires having the apple file in a META-INF directory, though.
Jellby is offline   Reply With Quote
Old 02-25-2013, 07:13 AM   #23
roger64
Wizard
roger64 ought to be getting tired of karma fortunes by now.roger64 ought to be getting tired of karma fortunes by now.roger64 ought to be getting tired of karma fortunes by now.roger64 ought to be getting tired of karma fortunes by now.roger64 ought to be getting tired of karma fortunes by now.roger64 ought to be getting tired of karma fortunes by now.roger64 ought to be getting tired of karma fortunes by now.roger64 ought to be getting tired of karma fortunes by now.roger64 ought to be getting tired of karma fortunes by now.roger64 ought to be getting tired of karma fortunes by now.roger64 ought to be getting tired of karma fortunes by now.
 
Posts: 2,608
Karma: 3000161
Join Date: Jan 2009
Device: Kindle PW3 (wifi)
Quote:
Originally Posted by Jellby View Post
zip file.epub META-INF/com.apple.ibooks.display-options.xml

It requires having the apple file in a META-INF directory, though.
Looks very useful. How can I resist messing around...

Following what you said, I put the apple.xml file in a META-INF folder, alongside with two EPUBS (screenshot).

I then tried the customary:
Code:
roger@lmde64:~/Bureau/Test$ zip *.epub META-INF/com.apple.ibooks.display-options.xml
updating: META-INF/com.apple.ibooks.display-options.xml (deflated 27%)
  adding: Cocardes et dentelles v2.epub (deflated 1%)
roger@lmde64:~/Bureau/Test$
Result: Only the first EPUB file was correctly processed. The second one, "Cocardes et dentelles v2" was not. Is there a way to batch this?

If I take away from the Test folder the first processed EPUB and then repeat the same command, the second EPUB is correctly processed. This can go quickly...
Attached Thumbnails
Click image for larger version

Name:	apple.png
Views:	183
Size:	26.7 KB
ID:	101950  

Last edited by roger64; 02-25-2013 at 07:21 AM.
roger64 is offline   Reply With Quote
Old 02-25-2013, 07:40 AM   #24
Jellby
frumious Bandersnatch
Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.
 
Jellby's Avatar
 
Posts: 7,514
Karma: 18512745
Join Date: Jan 2008
Location: Spaniard in Sweden
Device: Cybook Orizon, Kobo Aura
Quote:
Originally Posted by roger64 View Post
I then tried the customary:
Code:
roger@lmde64:~/Bureau/Test$ zip *.epub META-INF/com.apple.ibooks.display-options.xml
updating: META-INF/com.apple.ibooks.display-options.xml (deflated 27%)
  adding: Cocardes et dentelles v2.epub (deflated 1%)
roger@lmde64:~/Bureau/Test$
Result: Only the first EPUB file was correctly processed. The second one, "Cocardes et dentelles v2" was not.
Not only that, but the whole second EPUB was added to the first, that's the way the zip command works. What you did is equivalent to:

Code:
zip file1.epub file2.epub apple.xml
which adds file2.epub and apple.xml to file1.epub.

For what you want, you could use bash loops, which may look daunting, but it's really simple:

Code:
for i in file1.epub file2.epub
do zip "$i" apple.xml
done
(the first line is just "repeat the block, each time assigning to the variable 'i' one of the values listed"). The linebreaks are important, but you can replace them with semicolons:

Code:
for i in file1.epub file2.epub; do zip "$i" apple.xml; done
(putting $i between quotes ensures that it works properly if the filename includes spaces, in which case, of course, you should write them between quotes in the first line as well).
Jellby is offline   Reply With Quote
Old 02-25-2013, 08:10 AM   #25
roger64
Wizard
roger64 ought to be getting tired of karma fortunes by now.roger64 ought to be getting tired of karma fortunes by now.roger64 ought to be getting tired of karma fortunes by now.roger64 ought to be getting tired of karma fortunes by now.roger64 ought to be getting tired of karma fortunes by now.roger64 ought to be getting tired of karma fortunes by now.roger64 ought to be getting tired of karma fortunes by now.roger64 ought to be getting tired of karma fortunes by now.roger64 ought to be getting tired of karma fortunes by now.roger64 ought to be getting tired of karma fortunes by now.roger64 ought to be getting tired of karma fortunes by now.
 
Posts: 2,608
Karma: 3000161
Join Date: Jan 2009
Device: Kindle PW3 (wifi)
I am sorry to give you all this trouble.

I found that the first try was very convenient for my level of understanding (even then I did a mistake...) as it allows to process one EPUB at a time. Furthermore, as we can use again and again exactly the same command, it's easy to use. We just have to replace an EPUB with the next one.

I'm afraid the "loop" thing is way beyond my capacity. I did not expect it to become so quickly so complex. Just writing long file names for the terminal (using antislashes and things like that) is a chore.

So, I will keep myself at the first level. Thank you for your help, explanations and brilliant solution that, for sure, I will use next time...
roger64 is offline   Reply With Quote
Old 02-25-2013, 08:32 AM   #26
Jellby
frumious Bandersnatch
Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.
 
Jellby's Avatar
 
Posts: 7,514
Karma: 18512745
Join Date: Jan 2008
Location: Spaniard in Sweden
Device: Cybook Orizon, Kobo Aura
Quote:
Originally Posted by roger64 View Post
Just writing long file names for the terminal (using antislashes and things like that) is a chore.
Easier, use quotes: "Cocardes et dentelles v2.epub"

(that sometimes fails with exclamation marks, probably a bug in my bash version, just avoid exclamation marks).

and you know you can use autocompletion too, don't you? Write the first few letters of the filename and press the TAB key, the filename will probably be completed (as far as it can be, without ambiguity)
Jellby is offline   Reply With Quote
Old 02-25-2013, 07:23 PM   #27
roger64
Wizard
roger64 ought to be getting tired of karma fortunes by now.roger64 ought to be getting tired of karma fortunes by now.roger64 ought to be getting tired of karma fortunes by now.roger64 ought to be getting tired of karma fortunes by now.roger64 ought to be getting tired of karma fortunes by now.roger64 ought to be getting tired of karma fortunes by now.roger64 ought to be getting tired of karma fortunes by now.roger64 ought to be getting tired of karma fortunes by now.roger64 ought to be getting tired of karma fortunes by now.roger64 ought to be getting tired of karma fortunes by now.roger64 ought to be getting tired of karma fortunes by now.
 
Posts: 2,608
Karma: 3000161
Join Date: Jan 2009
Device: Kindle PW3 (wifi)
Hi

Just the time to sleep over it with a little nagging remorse for being lazy. OK, I must admit once again you're very right. I did a try with three EPUB and my META-INF folder and it works brilliantly.

Once all the files were here, I used TAB to auto-complete. I had three EPUB with three filenames beginning with "La ". The terminal wrote every successive name with antislashes but who cares?
Code:
roger@lmde64:~/Bureau/Test$ for i in La\ brune\ et\ la\ blonde\ v2.epub La\ grande\ fête\ v2.epub La\ main\ aux\ dames\ v2.epub; do zip "$i" META-INF/com.apple.ibooks.display-options.xml; done
  adding: META-INF/com.apple.ibooks.display-options.xml (deflated 27%)
  adding: META-INF/com.apple.ibooks.display-options.xml (deflated 27%)
  adding: META-INF/com.apple.ibooks.display-options.xml (deflated 27%)
roger@lmde64:~/Bureau/Test$
This is the code I will keep
Code:
for i in FILE; do zip "$i" META-INF/com.apple.ibooks.display-options.xml; done
This one works not only for one but for as many files as you wish (once their name has been added, even if the name includes some whitespace).


Last edited by roger64; 02-25-2013 at 07:54 PM.
roger64 is offline   Reply With Quote
Old 02-26-2013, 04:16 AM   #28
Jellby
frumious Bandersnatch
Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.
 
Jellby's Avatar
 
Posts: 7,514
Karma: 18512745
Join Date: Jan 2008
Location: Spaniard in Sweden
Device: Cybook Orizon, Kobo Aura
and... you can also use wildcards:

for i in *.epub; do zip ...

Jellby is offline   Reply With Quote
Old 02-26-2013, 11:30 PM   #29
dgatwood
Curmudgeon
dgatwood ought to be getting tired of karma fortunes by now.dgatwood ought to be getting tired of karma fortunes by now.dgatwood ought to be getting tired of karma fortunes by now.dgatwood ought to be getting tired of karma fortunes by now.dgatwood ought to be getting tired of karma fortunes by now.dgatwood ought to be getting tired of karma fortunes by now.dgatwood ought to be getting tired of karma fortunes by now.dgatwood ought to be getting tired of karma fortunes by now.dgatwood ought to be getting tired of karma fortunes by now.dgatwood ought to be getting tired of karma fortunes by now.dgatwood ought to be getting tired of karma fortunes by now.
 
dgatwood's Avatar
 
Posts: 629
Karma: 1623086
Join Date: Jan 2012
Device: iPad, iPhone, Nook Simple Touch
Quote:
Originally Posted by roger64 View Post
Looks very useful. How can I resist messing around...

Following what you said, I put the apple.xml file in a META-INF folder, alongside with two EPUBS (screenshot).

I then tried the customary:
Code:
roger@lmde64:~/Bureau/Test$ zip *.epub META-INF/com.apple.ibooks.display-options.xml
updating: META-INF/com.apple.ibooks.display-options.xml (deflated 27%)
  adding: Cocardes et dentelles v2.epub (deflated 1%)
roger@lmde64:~/Bureau/Test$
Result: Only the first EPUB file was correctly processed. The second one, "Cocardes et dentelles v2" was not. Is there a way to batch this?

If I take away from the Test folder the first processed EPUB and then repeat the same command, the second EPUB is correctly processed. This can go quickly...
The correct commands would be:

Code:
mkdir ex
cd ex
unzip /path/to/file.epub

[modify files here]

zip -Xr9D ../file-edited.epub mimetype * -x .DS_Store
Those flags (-X -r -9 -D and "-x .DS_Store") are pretty much required for proper spec conformance.

Then repeat for the next book in a different directory. You can create only a single zip file per command. Everything after that is considered to be a file that you want to include *in* the output file.
dgatwood is offline   Reply With Quote
Old 02-27-2013, 04:13 AM   #30
Jellby
frumious Bandersnatch
Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.
 
Jellby's Avatar
 
Posts: 7,514
Karma: 18512745
Join Date: Jan 2008
Location: Spaniard in Sweden
Device: Cybook Orizon, Kobo Aura
Quote:
Originally Posted by dgatwood View Post
Those flags (-X -r -9 -D and "-x .DS_Store") are pretty much required for proper spec conformance.
Not really. -r is, because otherwise the files in the subdirectories are not stored. But the rest just make the epub file somewhat smaller. -9 simply uses highest compression level, -D does not include entries for the directories themself, and -X does not store additional file attributes. As far as I know, neither -X nor -D are required for ePub compliance. And "-x .DS_Store" may be required only if .DS_Store files exist (in a Mac?)

Anyway, for the problem is here, which is adding a specific file to an existing ePub, creating one from scratch is a bit of an overkill...
Jellby 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
com.apple.ibooks.display-options brewt Plugins 5 09-06-2012 09:57 AM
Presence of com.apple.ibooks.display-options.xml breaks Readium? rtmyers ePub 2 08-18-2012 05:01 AM
Apple's iBooks 2, iBooks Author: Bids to own publishing's future wannabee News 0 01-19-2012 07:33 PM
XML files and XSD file to EPUB janneman Workshop 8 04-08-2011 05:23 PM
ePub display issue in iBooks Protagitron ePub 3 02-08-2011 01:38 PM


All times are GMT -4. The time now is 04:03 AM.


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