diff --git a/src/release/release.py b/src/release/release.py
index 94cd6ed..75b043b 100755
--- a/src/release/release.py
+++ b/src/release/release.py
@@ -4,7 +4,7 @@
from utils import loadBook
from utils import txtRelease
from utils import jsonRelease
-from utils import htmlRelease
+from utils import mobiRelease
from utils import staticRelease
from utils import gitbookRelease
@@ -13,6 +13,6 @@ metadata, content = loadBook('rc-5')
# txtRelease(metadata, content)
# jsonRelease(metadata, content)
-htmlRelease(metadata, content)
+mobiRelease(metadata, content)
# staticRelease(metadata, content)
# gitbookRelease(metadata, content)
diff --git a/src/release/utils/__init__.py b/src/release/utils/__init__.py
index 1f7f49c..cc6b786 100644
--- a/src/release/utils/__init__.py
+++ b/src/release/utils/__init__.py
@@ -5,6 +5,6 @@ from .common import loadBook
from .release import txtRelease
from .release import jsonRelease
-from .release import htmlRelease
+from .release import mobiRelease
from .release import staticRelease
from .release import gitbookRelease
diff --git a/src/release/utils/common.py b/src/release/utils/common.py
index f457f5e..e016293 100644
--- a/src/release/utils/common.py
+++ b/src/release/utils/common.py
@@ -20,8 +20,8 @@ releaseInfo = { # release file name
'epub': '栩栩若生.epub',
'mobi': '栩栩若生.mobi',
'static': 'XXRS.tar.xz',
- 'calibre': 'xxrs.html',
'gitbook': 'xxrs-online/',
+ 'calibre': 'xxrs-calibre/',
}
releaseInfo = { # convert to absolute path
key: os.path.join(releasePath, file) for (key, file) in releaseInfo.items()
diff --git a/src/release/utils/release.py b/src/release/utils/release.py
index b19e06e..5b27cd6 100644
--- a/src/release/utils/release.py
+++ b/src/release/utils/release.py
@@ -129,3 +129,46 @@ def staticRelease(metadata: dict, content: dict) -> None:
staticDepends(tempDir.name, metadata, content)
staticBuild(tempDir.name)
tempDir.cleanup()
+
+
+def calibreDepends(workDir: str, metadata: dict, content: dict) -> None:
+ metaInfo = [
+ '',
+ '',
+ '',
+ '',
+ '',
+ '',
+ ]
+ opfInfo = [
+ '',
+ '',
+ '',
+ '%s' % metadata['name'],
+ 'zho',
+ 'Dnomd343',
+ '%(aut)s' % {'aut': metadata['author']},
+ '%s' % projectUrl,
+ '%s' % '<div>%s</div>' % (
+ ''.join(['<p>%s</p>' % x for x in metadata['desc']])
+ ),
+ '' % metadata['author'],
+ '' % metadata['name'],
+ '',
+ '',
+ ' ',
+ ' ',
+ '',
+ '', '', '',
+ '',
+ ]
+ createFolder(os.path.join(workDir, 'META-INF'))
+ saveFile(os.path.join(workDir, 'mimetype'), 'application/epub+zip')
+ saveFile(os.path.join(workDir, 'content.opf'), '\n'.join(opfInfo) + '\n')
+ saveFile(os.path.join(workDir, 'xxrs.html'), htmlSerialize(metadata, content))
+ saveFile(os.path.join(workDir, 'META-INF', 'container.xml'), '\n'.join(metaInfo) + '\n')
+
+
+def mobiRelease(metadata: dict, content: dict) -> None:
+ createFolder(releaseInfo['calibre'])
+ calibreDepends(releaseInfo['calibre'], metadata, content)