Creating an epub

Got a LiveCode personal license? Are you a beginner, hobbyist or educator that's new to LiveCode? This forum is the place to go for help getting started. Welcome!

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller

Post Reply
exheusden
Posts: 170
Joined: Fri Oct 09, 2009 5:03 pm
Contact:

Creating an epub

Post by exheusden » Sat Jan 28, 2017 12:43 pm

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?

Thierry
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 875
Joined: Wed Nov 22, 2006 3:42 pm

Re: Creating an epub

Post by Thierry » Sat Jan 28, 2017 1:58 pm

Hi,

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

Thierry
!
SUNNY-TDZ.COM doesn't belong to me since 2021.
To contact me, use the Private messages. Merci.
!

exheusden
Posts: 170
Joined: Fri Oct 09, 2009 5:03 pm
Contact:

Re: Creating an epub

Post by exheusden » Sat Jan 28, 2017 4:21 pm

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.

AndyP
Posts: 634
Joined: Wed Aug 27, 2008 12:57 pm
Contact:

Re: Creating an epub

Post by AndyP » Sat Jan 28, 2017 5:27 pm

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
Andy .... LC CLASSIC ROCKS!

Thierry
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 875
Joined: Wed Nov 22, 2006 3:42 pm

Re: Creating an epub

Post by Thierry » Sat Jan 28, 2017 7:34 pm

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.
!
SUNNY-TDZ.COM doesn't belong to me since 2021.
To contact me, use the Private messages. Merci.
!

MaxV
Posts: 1580
Joined: Tue May 28, 2013 2:20 pm
Contact:

Re: Creating an epub

Post by MaxV » Wed Feb 01, 2017 12:18 pm

Livecode has an internal ZIP library, read here: http://livecode.wikia.com/wiki/Compressing_(zip)
It shouldn't produce any .DS file.
Livecode Wiki: http://livecode.wikia.com
My blog: https://livecode-blogger.blogspot.com
To post code use this: http://tinyurl.com/ogp6d5w

Post Reply