My goal is to create an EPUB file via an AppleScript, and I'm starting with semi-manually generating an EPUB file. My issue is that the IDPF EPUB validator reports that my MIMETYPE file isn't isn't the first file in my EPUB package or that my MIMETYPE doesn't exist. My AppleScript is creating the EPUB folder structure and a MIMETYPE file:
set EPUBMIMETYPEfilepath to ((EPUBfolderPath & ":MIMETYPE") as string)
set referenceToEPUBMIMETYPEfile to a reference to file EPUBMIMETYPEfilepath
open for access referenceToEPUBMIMETYPEfile with write permission
write "application/epub+zip" to referenceToEPUBMIMETYPEfile
close access referenceToEPUBMIMETYPEfile
So, later on when I have a collection of folders and files resembling a standard EPUB structure, I'm using the command line to ZIP up the EPUB:
zip -X0 ../epubFilename.epub MIMETYPE
zip -rDX9 ../epubFilename.epub.epub META-INF -x "*.DS_Store"
zip -rDX9 ../epubFilename.epub.epub OPS -x "*.DS_Store"
Later on I can unzip my EPUB and actually see that there's indeed a MIMETYPE file within, however perhaps not the first file because the META-INF folder is sorted first?
Question: does anyone have any tips to create an EPUB via the command line on a Mac?