问题描述
我的目标是通过AppleScript创建EPUB文件,而我首先是半手动生成EPUB文件.我的问题是IDPF EPUB验证器报告不是我的MIMETYPE文件不是我的EPUB包中的第一个文件,或者我的MIMETYPE不存在.我的AppleScript正在创建EPUB文件夹结构和MIMETYPE文件:
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
因此,稍后,当我有一组类似于标准EPUB结构的文件夹和文件时,我正在使用命令行将EPUB压缩:
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"
稍后,我可以解压缩我的EPUB,实际上看到其中确实存在一个MIMETYPE文件,但是也许不是第一个文件,因为META-INF文件夹是第一个排序的?
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?
问题:是否有人在Mac上通过命令行创建EPUB的提示?
Question: does anyone have any tips to create an EPUB via the command line on a Mac?
推荐答案
如您所知,mimetype文件名必须为小写.在EPUB格式所需的文件中,只有META-INF/目录应具有大写名称.顺便说一句,您只需要一个""zip -rDX9"命令. -r将递归地将子目录和文件包含到.epub中.
As you found out, the mimetype filename must be lowercase. Of the files required by the EPUB format, only the META-INF/ directory should have an uppercase name. By the way, you only need one """zip -rDX9" command. The -r will recursively include the subdirectories and files into the .epub.
这篇关于将MIMETYPE文件设置为EPUB ZIP文件中的第一个文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!