环境:
Ubuntu MATE 20.04
Linux 5.4.0-153-generic
#170-Ubuntu SMP Fri Jun 16 13:43:31 UTC 2023
x86_64 x86_64 x86_64 GNU/Linux
我创建了一个脚本[参见脚本 1],它捆绑了一个 EPUB 文件。
当我右键单击生成的文件时,获取上下文菜单,然后选择“优先“从菜单中,卡哈崩溃!!!
在命令行中,“文件“命令将 OK 报告为 epub 文件:
/DB001_F4/STACKS__Library$ file 'BOOK__SciFi__IAsimov__RDaneelOlivaw 2 - The Naked Sun__1956_1.epub'
BOOK__SciFi__IAsimov__RDaneelOlivaw 2 - The Naked Sun__1956_1.epub: EPUB document
/DB001_F4/STACKS__Library$
同样从命令行信息命令似乎没有报告问题:
/DB001_F4/STACKS__Library$ einfo 'BOOK__SciFi__IAsimov__RDaneelOlivaw 2 - The Naked Sun__1956_u.epub'
Filename: BOOK__SciFi__IAsimov__RDaneelOlivaw 2 - The Naked Sun__1956_u.epub
Root(s):
OEBPS/content.opf (application/oebps-package+xml)
Title(s):
The Naked Sun
Creator(s):
aut: Isaac Asimov (Asimov, Isaac)
Identifier(s):
5c1396b5-6ede-5b81-87d6-dec6d1b2867a(uuid:uuid_id)
9780553293395(ISBN:unspecified)
Reading order:
COVERpage(L) DUSTJACKETBLURBpage(L) STORYSUMMARYpage(L) ABOUTAUTHORpage(L) TITLEpage(L) COPYRIGHTSpage(L) DEDICATIONpage(L) TOCpage(L) chpt-001(L) chpt-002(L) chpt-003(L) chpt-004(L) chpt-005(L) chpt-006(L) chpt-007(L) chpt-008(L) chpt-009(L) chpt-010(L) chpt-011(L) chpt-012(L) chpt-013(L) chpt-014(L) chpt-015(L) chpt-016(L) chpt-017(L)
Guide:
Cover -> Text/binder_001_COVER.html(cover)
Extra local metadata:
cover : cover
unspecified : unspecified
unspecified : unspecified
/DB001_F4/STACKS__Library$
请注意,脚本会创建两种可接受的格式类型对于 EPUB:
- 没有压缩文件
- 只有“mimetype”未压缩
还要注意,mimetype 是第一个文件已归档在两个 zip 文件中。
最后,我可以使用 calibre 提供的 EPUB 查看器打开这两个文件进行查看,没有任何问题。
有人能解释一下为什么吗?
content.opf 文件的开头:
<?xml version="1.0" encoding="UTF-8"?>
<package xmlns="http://www.idpf.org/2007/opf" version="2.0" unique-identifier="uuid_id">
<metadata
xmlns:opf="http://www.idpf.org/2007/opf"
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:dcterms="http://purl.org/dc/terms/"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:calibre="http://calibre.kovidgoyal.net/2009/metadata">
<!-- insert point for other considerations -->
<meta name="cover" content="cover"/>
<dc:date>2023-08-06T22:09:52-04:00</dc:date>
<dc:language>en_CA</dc:language>
<dc:identifier id="uuid_id" opf:scheme="uuid">5c1396b5-6ede-5b81-87d6-dec6d1b2867a</dc:identifier>
<dc:identifier opf:scheme="ISBN">9780553293395</dc:identifier>
<dc:title id="title">The Naked Sun</dc:title>
<dc:creator opf:role="aut" opf:file-as="Asimov, Isaac">Isaac Asimov</dc:creator>
<dc:publisher>Fawcett Publications, Inc. / Greenwich, Conn.</dc:publisher>
<dc:subject id="subject-1">Science fiction</dc:subject>
<meta property="authority" refines="#subject-1">LCSH</meta>
<meta property="term" refines="#subject-1">sh85118629</meta>
<dc:description>THE PLANET SOLARIA
两秒钟内就能摧毁地球
并且可能最终会...。
Solaria 强大而又渴求能量。它花了两百年时间才研发出终极武器……一支庞大的机器人大军,可以在几天之内毁灭地球并统治宇宙。
但现在还得等待。
索拉利亚最杰出的科学家之一突然被发现惨遭杀害。只有地球上最著名的侦探伊莱贾·贝莱 (Elijah Baley) 才能解开这个黑暗而又令人费解的谜团。索拉利亚请求他的帮助。
贝莱不想去。但他又怎么能拒绝呢?
地球的生存岌岌可危。 </dc:description>(...剪辑...)
EPUB 文件内容列表(unzip -l):
/DB001_F4/STACKS__Library$ unzip -l 'BOOK__SciFi__IAsimov__RDaneelOlivaw 2 - The Naked Sun__1956_1.epub'
Archive: BOOK__SciFi__IAsimov__RDaneelOlivaw 2 - The Naked Sun__1956_1.epub
Length Date Time Name
--------- ---------- ----- ----
20 2022-01-21 08:31 mimetype
0 2023-07-27 20:01 META-INF/
260 2023-07-05 20:03 META-INF/container.xml
0 2023-08-06 22:09 OEBPS/
7071 2023-08-06 22:09 OEBPS/content.opf
0 2023-07-27 20:01 OEBPS/Fonts/
30812 2019-12-02 20:35 OEBPS/Fonts/Aileron-BlackItalic.otf
29904 2019-12-02 20:35 OEBPS/Fonts/Aileron-Black.otf
30968 2019-12-02 20:35 OEBPS/Fonts/Aileron-BoldItalic.otf
29196 2019-12-02 20:35 OEBPS/Fonts/Aileron-Bold.otf
29612 2019-12-02 20:35 OEBPS/Fonts/Aileron-Italic.otf
27644 2019-12-02 20:35 OEBPS/Fonts/Aileron-Regular.otf
123408 2017-06-15 15:37 OEBPS/Fonts/Archivo-BoldItalic.ttf
123072 2017-06-15 15:37 OEBPS/Fonts/Archivo-Bold.ttf
117820 2017-06-15 15:38 OEBPS/Fonts/Archivo-Italic.ttf
113644 2017-06-15 15:38 OEBPS/Fonts/Archivo-Regular.ttf
100392 2015-06-04 16:56 OEBPS/Fonts/LiberationSerif-BoldItalic.ttf
129416 2015-06-04 16:56 OEBPS/Fonts/LiberationSerif-Bold.ttf
100420 2015-06-04 16:56 OEBPS/Fonts/LiberationSerif-Italic.ttf
156076 2015-06-04 16:56 OEBPS/Fonts/LiberationSerif-Regular.ttf
0 2023-08-06 17:43 OEBPS/Images/
256154 2023-08-04 17:30 OEBPS/Images/BOOK__SciFi__IAsimov__RDaneelOlivaw 2 - The Naked Sun__1956__COVER.jpg
0 2023-08-03 17:17 OEBPS/Styles/
14715 2023-08-02 17:57 OEBPS/Styles/styling_fawcettcrest.css
2898 2023-07-16 21:24 OEBPS/Styles/styling_fontfamilies.css
58 2021-08-08 01:25 OEBPS/Styles/styling_paging.css
0 2023-08-06 22:09 OEBPS/Text/
676 2023-08-06 22:09 OEBPS/Text/binder_001_COVER.html
1714 2023-08-06 22:09 OEBPS/Text/binder_002_DUSTJACKETBLURB.html
9166 2023-08-06 22:09 OEBPS/Text/binder_003_STORYSUMMARY.html
3272 2023-08-06 22:09 OEBPS/Text/binder_004_ABOUTAUTHOR.html
1197 2023-08-06 22:09 OEBPS/Text/binder_005_TITLE.html
2430 2023-08-06 22:09 OEBPS/Text/binder_006_COPYRIGHTS.html
951 2023-08-06 22:09 OEBPS/Text/binder_007_DEDICATION.html
3417 2023-08-06 22:09 OEBPS/Text/binder_008_CONTENTS.html
32235 2023-08-06 22:09 OEBPS/Text/content_001.html
30970 2023-08-06 22:09 OEBPS/Text/content_002.html
30071 2023-08-06 22:09 OEBPS/Text/content_003.html
22866 2023-08-06 22:09 OEBPS/Text/content_004.html
23950 2023-08-06 22:09 OEBPS/Text/content_005.html
31737 2023-08-06 22:09 OEBPS/Text/content_006.html
27229 2023-08-06 22:09 OEBPS/Text/content_007.html
28539 2023-08-06 22:09 OEBPS/Text/content_008.html
22552 2023-08-06 22:09 OEBPS/Text/content_009.html
28710 2023-08-06 22:09 OEBPS/Text/content_010.html
28074 2023-08-06 22:09 OEBPS/Text/content_011.html
31934 2023-08-06 22:09 OEBPS/Text/content_012.html
24318 2023-08-06 22:09 OEBPS/Text/content_013.html
24713 2023-08-06 22:09 OEBPS/Text/content_014.html
32437 2023-08-06 22:09 OEBPS/Text/content_015.html
26559 2023-08-06 22:09 OEBPS/Text/content_016.html
29505 2023-08-06 22:09 OEBPS/Text/content_017.html
35860 2023-08-06 22:09 OEBPS/Text/content_018.html
4699 2023-08-06 22:09 OEBPS/toc.ncx
196 2023-08-06 22:48 META-INF/calibre_bookmarks.txt
--------- -------
1978906 57 files
/DB001_F4/STACKS__Library$
脚本1的源代码:
#!/bin/sh
#23456789+123456789+123456789+123456789+123456789+123456789+123456789+123456789+123456789+123456789+
####################################################################################################
###
### $Id: EPUB__CreateZipBundle.sh,v 1.3 2023/07/24 02:32:46 ericthered Exp ericthered $
###
### This script is used to create the well-formed BOOK EPUB file
### from the various files and sub-directories found within the WIP_Book directory.
###
### It is expected to be run from the '00__PUBLISH' directory.
###
### For further guidance, refer to the top-level script,
###
### EPUB__ExtractPdfToNormalizedText.sh
###
### for additional clarification of the expected process.
###
### KEYWORDS: |PACKAGER|BOOK|HTML|EPUB|CSS|FONTS|IMAGES|
###
####################################################################################################
DBG=0
#BookWorkDirectory="WIP__Book"
while [ $# -gt 0 ]
do
case "${1}" in
--bookWorkDirectory )
BookWorkDirectory="${2}" ;
shift ; shift ;
;;
--sourceBase )
SourceBase="${2}" ;
shift ; shift ;
;;
--debug )
DBG=1 ; shift
;;
* ) echo "\n\t Invalid parameter '${1}' used on command line. Only valid options: --bookDirectory {book_directory_name} \n Bye!\n" ; exit 1 ;
;;
esac
done
if [ -z "${BookWorkDirectory}" ]
then
echo "\n Must specify the work directory within which will be found \n the directory structure and files for creating the EPUB.\n Bye!\n"
exit 1
fi
cd "${BookWorkDirectory}" || {
echo "\n failed to set Book directory as working directory" ; exit 1
}
BookFiles=../`basename "$0" ".sh" `.bookfiles.txt
StartDir=`dirname "$0" `
Epub="${StartDir}/${SourceBase}.epub"
if [ ${DBG} -eq 1 ]
then
echo "\t PWD = `pwd`"
echo "\t [reporting from $0 ]\n"
ls -l
exit 1
fi
find META-INF OEBPS -print | sort |
grep -v '^OEBPS/Fonts/DISABLED' |
grep -v '^OEBPS/Fonts/License__' |
grep -v '/HOLD/' |
grep -v '/HOLD$' |
grep -v '__HOLD$' |
grep -v '.css__' |
grep -v '^EPUB__splitChapters__FromMONOLITH.sh' |
grep -v '^output.txt' |
awk -v sq="'" '{
if( index( $0, " " ) > 0 ){
printf("%s%s%s\n", sq, $0, sq ) ;
}else{
print $0 ;
} ;
}' >"${BookFiles}.tmp"
# grep -v '^mimetype' >"${BookFiles}.tmp"
{
echo "mimetype"
cat "${BookFiles}.tmp"
} >"${BookFiles}"
DBG=0
if [ ${DBG} -eq 1 ]
then
cat "${BookFiles}"
exit 1
fi
method_1()
{
###
### 2-Step method (only mimetype uncompressed)
###
rm -fv "${Epub}" 2>&1 | awk '{ printf("\t %s\n", $0 ) ; }' >&2
zip -X0 "${Epub}" mimetype
### This form strips quotes around filenames
#zip -9 "${Epub}" `cat "${BookFiles}.tmp" `
awk -v zipcom="zip -9 \"${Epub}\"" 'BEGIN{
printf("%s ", zipcom ) ;
}{
printf(" %s", $0 ) ;
}END{
printf("\n", $0 ) ;
}' "${BookFiles}.tmp" >"${BookFiles}.job"
. "./${BookFiles}.job"
#if [ $? -eq 0 ]
#then
# rm -f "./${BookFiles}.job"
#fi
echo "\t '${Epub}' created ...\n"
}
method_2()
{
###
### Single-Step method (all items uncompressed)
###
rm -fv "${Epub}_2" 2>&1 | awk '{ printf("\t %s\n", $0 ) ; }' >&2
### This form strips quotes around filenames
#zip -X0 "${Epub}_2" `cat "${BookFiles}" `
awk -v zipcom="zip -X0 \"${Epub}_2\"" 'BEGIN{
printf("%s ", zipcom ) ;
}{
printf(" %s", $0 ) ;
}END{
printf("\n", $0 ) ;
}' "${BookFiles}" >"${BookFiles}.job"
. "./${BookFiles}.job"
if [ $? -eq 0 ]
then
rm -f "./${BookFiles}.job"
fi
echo "\t '${Epub}_2' created ...\n"
}
if [ ${DBG} -eq 1 ]
then
echo "\t StartDir = '${StartDir}' ..."
echo "\t Epub = '${Epub}' ..."
exit 1
fi
method_1
method_2
rm -f "${BookFiles}"
rm -f "${BookFiles}.tmp"
echo ""
if [ -f "${Epub}_2" ]
then
ls -l "${Epub}" "${Epub}_2" 2>&1 | awk '{ printf("\t %s\n", $0 ) ; }' >&2
else
ls -l "${Epub}" 2>&1 | awk '{ printf("\t %s\n", $0 ) ; }' >&2
fi
echo "\n Done!\n"