批量转换epub书籍为mobi电子书

来源:互联网 发布:网络限速上行多少合适 编辑:程序博客网 时间:2024/05/16 09:49
电脑上有不少的EPUB格式的电子书,想一次性把它全转为MOBI格式,试过Calibre,那速度慢得真是叫人难以忍受,而发邮件给Amazon,对于这么多的文件想想都是噩梦。好在Amazon发布了新版的制作kindle电子书的命令行工具:KindleGen1.2,试了一下转换速度相当快,只是不支持通配符,于是自己写了个简单的批处理,这样我们便可以批量制作mobi电子书了。
 
Windows版:
1、下载KindleGen.zip文件到你的电脑。
下载地址: 115盘
kindlegen_win32_v1.2.zip
2、解压到任意目录,比方说:D:\KindleGen
3、下载批处理文件epub2mobi.bat
http://u.115.com/file/clsgdg7e# epub2mobi.bat

或者自己拷贝下面这段代码存为BAT文件(epub2mobi.bat)

@echo off
@title kindlegen epub转换mobi

REM http://www.3dch.net/read-htm-tid-24825.html
REM 设置存放转换好的MOBI电子书的目录。由于kindlegen只能将转好的书放在源文件同一目录下,
REM 所以为方便管理,需要自己移到新的位置
set mobidir=..\mobi

REM 设置kindlegen的解压后的位置,比方说C:\KindleGen
set path=D:\GreenSoft\kindlegen_win32_v1.2

for %%i in (*.epub) do kindlegen "%%i"

if not exist %mobidir% md %mobidir%

if exist *.mobi move *.mobi %mobidir%

pause

4、根据自己的情况修改下载好的批处理文件
5、将需要转换的epub书籍拷贝到一个自己认识方便的文件夹内,比方说D:\epub
6、将修改好的批处理文件也拷贝到上面提到的epub文件夹内
7、双击运行批处理文件,过一会就可以将文件夹内所有EPUB书籍转为MOBI格式了

注意:kindlegen对EPUB里的METADATA要求比较高,有些格式不严谨的EPUB会转换失败,所以最后的选择还是用calibre来转换,或者发邮件给Amazon帮你转。

如果需要查看kindlegen的使用帮助的话,直接在CMD命令行里运行kindlegen,如下所示:
D:\GreenSoft\kindlegen_win32_v1.2>kindlegen

**************************************************
* Amazon.com kindlegen(Windows) V1.2 build 33307 *
* A command line e-bookcompiler                *
* Copyright Amazon.com2011                     *
**************************************************

Usage : kindlegen filename.opf/.htm/.html/.epub [-c0 or -c1 or c2][-verbose] [-rebuild] [-onlydeps or -nodeps] [-western] [-o<file name>]
Options:
   -c0: no compression
   -c1: standard DOCcompression
   -c2: Kindle huffdiccompression
   -o <filename>: Specifies the output file name. Output filewill be created in the same directory as that of input file.<file name> should not containdirectory path.
   -verbose: verbose output
   -rebuild: rebuilds alldependencies
   -onlydeps: build only neededdependencies
   -nodeps: do not check/builddependencies
   -western: force build ofWindows-1252 book
   -releasenotes: display releasenotes
   -gif: images are converted toGIF format (no JPEG in the book)

8、从帮助我们可以看到kindlegen支持多种格式文件的转换,大家只需要依葫芦画瓢就好了。
9、另外可以用MobiPocket ebook Reader对转换好的MOBI文件进行预览
http://u.115.com/file/aqk291xn#mobireadersetup.msi

我在这里只是抛砖引玉,希望引高手出来做出一些更好用的脚本来。

0 0
原创粉丝点击