Skip to content

Commit

Permalink
完成功能
Browse files Browse the repository at this point in the history
  • Loading branch information
LiMing committed Dec 13, 2016
1 parent 94d6f02 commit 22c0c9d
Show file tree
Hide file tree
Showing 20 changed files with 14,804 additions and 4 deletions.
34 changes: 34 additions & 0 deletions main.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# coding=utf8

import sys
from txt2mobi.scaffold import init_project, generate_project, test_project


def main():
commands = ['init', 'gen', 'test', 'help']
if len(sys.argv) < 2:
print "Missing argument! Arguments must be [ %s ]" % " ".join(commands)
sys.exit(1)
command = sys.argv[1]
if command not in commands:
print "Wrong argument! Arguments must be [ %s ]" % " ".join(commands)
sys.exit(1)
if command == commands[0]:
init_project()
print 'project init successfull!'
sys.exit(0)
if command == commands[1]:
generate_project()
print 'project generated successfull!'
sys.exit(0)
if command == commands[2]:
test_project()
print 'project test successfull!'
sys.exit(0)
if command == commands[3]:
print '----help end----'
sys.exit(0)


if __name__ == "__main__":
main()
33 changes: 33 additions & 0 deletions resources/sample.opf
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
<?xml version="1.0" encoding="utf-8"?>
<package unique-identifier="shinemoon" version ="1.0" xmlns="http://www.idpf.org/2007/opf">
<metadata>
<dc-metadata xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:opf="http://www.idpf.org/2007/opf">
<dc:Title>[title_input]</dc:Title>
<dc:Language>zh</dc:Language>
<dc:Creator>[author_input]</dc:Creator>
<!--dc:Copyrights>Copyright owner</dc:Copyrights-->
<dc:Publisher>txt2Kindle</dc:Publisher>
<x-metadata>
<EmbeddedCover>cover.png</EmbeddedCover>
</x-metadata>
</dc-metadata>
</metadata>
<manifest>
<item id="toc" properties="nav" href="combined.html" media-type="application/xhtml+xml"/>
<item id="content" media-type="application/xhtml+xml" href="combined.html"></item>
<item id="cover-image" media-type="image/png" href="cover.png"/>
<item href="title.otf" id="title.otf" media-type="application/vnd.ms-opentype"/>
<item href="normal.otf" id="normal.otf" media-type="application/vnd.ms-opentype"/>

<!--item id="ncx" media-type="application/x-dtbncx+xml" href="toc.ncx"/-->
</manifest>
<spine>
<itemref idref="cover-image"/>
<itemref idref="toc"/>
<itemref idref="content"/>
</spine>
<!--guide>
<reference type="toc" title="Table of Contents" href="toc.html"/>
<reference type="text" title="Book" href="index.html"/>
</guide-->
</package>
19 changes: 19 additions & 0 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,2 +1,21 @@
# coding=utf8
__author__ = 'liming'

from setuptools import setup

setup(name='txt2mobi',
version='0.0.1',
description='Convert Chinese-Novel txt book to kindle .mobi file',
url='https://github.com/ipconfiger/txt2mobi',
author='Alexander.Li',
author_email='[email protected]',
license='GNU GENERAL PUBLIC LICENSE',
packages=['txt2mobi'],
install_requires=[
'shutil',
'chardet'
],
entry_points = {
'console_scripts': ['txt2mobi=main:main'],
},
zip_safe=False)
7 changes: 7 additions & 0 deletions tests/.project.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
[txt2mobi]
kindlegen=kindlegen

[book]
cover-img=cover.png
title=书名
author=作者
1,538 changes: 1,538 additions & 0 deletions tests/book.html

Large diffs are not rendered by default.

Loading

0 comments on commit 22c0c9d

Please sign in to comment.