Page 1 of 1

Creating an epub

Posted: Sat Jan 28, 2017 12:43 pm
by exheusden
Using information stored in a LiveCode stack, I have a script that both produces a website and an ebook in epub format.

I use the following code to produce the ebook:

Code: Select all

get shell ("zip -q0X  ROE.epub mimetype")
   get shell ("zip -qXr9D  ROE.epub *")
and, indeed, the epub is created and can be read by all manner of epub readers.

However, when validating it, I get the warning error, "Item 'OEBPS/images/.DS_Store' exists in the EPUB, but is not declared in the OPF manifest." This, of course, refers to a hidden MacOS system file.

When I create the epub outside of LiveCode, but making use of the same source files, using the app "ePub Zip-Unzip 3.0," on the other hand, no such waring is displayed.

Is there a way I can create the epub with LiveCode without generating the .DS_Store file?

Re: Creating an epub

Posted: Sat Jan 28, 2017 1:58 pm
by Thierry
Hi,

You could try this option with the zip command:
-x "*.DS_Store"
ore even only this one?
-x .DS_Store
HTH,

Thierry

Re: Creating an epub

Posted: Sat Jan 28, 2017 4:21 pm
by exheusden
Thanks for your help.

I tried both suggestions, adding them to the second shell call, as follows:

get shell ("zip -qXr9D ROE.epub * -x .DS_Store")

and

get shell ("zip -qXr9D ROE.epub * -x *.DS_Store")

(using quotes around *.DS_Store produced a LiveCode compilation error, so I left them out).

Unfortunately, however, the ePub validation errors remain.


UPDATE

Got it working, as follows:

Code: Select all

get shell ("zip -X ROE.epub mimetype")
get shell ("zip -rg ROE.epub META-INF -x \*.DS_Store")
get shell ("zip -rg ROE.epub OEBPS -x \*.DS_Store")

Again, thanks for your help.

Re: Creating an epub

Posted: Sat Jan 28, 2017 5:27 pm
by AndyP
It looks like the quotes are needed, try

get shell ("zip -qXr9D ROE.epub * -x " & '".DS_Store"') ... note the single quotes around the double quotes

Re: Creating an epub

Posted: Sat Jan 28, 2017 7:34 pm
by Thierry
exheusden wrote: I tried both suggestions, adding them to the second shell call, as follows:

get shell ("zip -qXr9D ROE.epub * -x .DS_Store")
Well, I guess this one doesn't work because you might have some sub-folders?
get shell ("zip -qXr9D ROE.epub * -x *.DS_Store")
(using quotes around *.DS_Store produced a LiveCode compilation error, so I left them out).
For this you need to write it this way:

Code: Select all

get shell ("zip -qXr9D  ROE.epub * -x " & quote & "*.DS_Store" & quote )
or your way or Andy's way....

Glad that it works for you :)

Thierry
Got it working, as follows:

Code: Select all

get shell ("zip -X ROE.epub mimetype")
get shell ("zip -rg ROE.epub META-INF -x \*.DS_Store")
get shell ("zip -rg ROE.epub OEBPS -x \*.DS_Store")
Again, thanks for your help.

Re: Creating an epub

Posted: Wed Feb 01, 2017 12:18 pm
by MaxV
Livecode has an internal ZIP library, read here: http://livecode.wikia.com/wiki/Compressing_(zip)
It shouldn't produce any .DS file.