Skip to content

Commit

Permalink
Rewrote kepubify command (#34)
Browse files Browse the repository at this point in the history
  • Loading branch information
pgaskin committed Jan 14, 2020
1 parent 1282954 commit 30b1a49
Show file tree
Hide file tree
Showing 9 changed files with 1,003 additions and 326 deletions.
20 changes: 0 additions & 20 deletions .drone.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,26 +12,6 @@ steps:
commands:
- GO111MODULE=on go test -mod=readonly -v ./kepub

# ---
#
# kind: pipeline
# name: kepub-windows
# type: docker
#
# platform:
# os: windows
# arch: amd64
#
# steps:
# - name: test-html
# image: golang:1.13-windowsservercore
# commands:
# - GO111MODULE=on go test -mod=readonly -run "^TestMod_" golang.org/x/net/html -v
# - name: test-kepub
# image: golang:1.13-windowsservercore
# commands:
# - GO111MODULE=on go test -mod=readonly -v ./kepub

---

kind: pipeline
Expand Down
40 changes: 24 additions & 16 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,26 +15,34 @@ Kepubify can also be installed via Homebrew (kepubify).

## Usage
```
Usage: kepubify [OPTIONS] PATH [PATH]...
Options:
--calibre use .kepub instead of .kepub.epub as the output extension (for Calibre compatibility, only use if you know what you are doing)
-c, --css string custom CSS to add to ebook
--fullscreen-reading-fixes enable fullscreen reading bugfixes based on https://www.mobileread.com/forums/showpost.php?p=3113460&postcount=16
-h, --help show this help text
Usage: kepubify [options] input_path [input_path]...
General Options:
-v, --verbose show extra information in output
--version show the version
-h, --help show this help text
Output Options:
-u, --update don't reconvert files which have already been converted (i.e. don't overwrite output files)
-i, --inplace don't add the _converted suffix to converted files and directories
--no-preserve-dirs flatten the directory structure of the input (an error will be shown if there are conflicts)
-o, --output string [>1 inputs || 1 file input with existing dir output]: directory to place converted files/dirs under; [1 file input with
nonexistent output]: output filename; [1 dir input]: output directory for contents of input (default: current directory)
--calibre use .kepub instead of .kepub.epub as the output extension (for Calibre compatibility, only use if you know what you are doing)
Conversion Options:
--smarten-punctuation smarten punctuation (smart quotes, dashes, etc) (excluding pre and code tags)
-c, --css stringArray custom CSS to add to ebook
--hyphenate force enable hyphenation
--no-hyphenate force disable hyphenation
-o, --output string the directory to place the converted files (default ".")
--fullscreen-reading-fixes enable fullscreen reading bugfixes based on https://www.mobileread.com/forums/showpost.php?p=3113460&postcount=16
-r, --replace stringArray find and replace on all html files (repeat any number of times) (format: find|replace)
--smarten-punctuation smarten punctuation (smart quotes, dashes, etc) (excluding pre and code tags)
-u, --update don't reconvert files which have already been converted
-v, --verbose show extra information in output
--version show the version
Arguments:
PATH is the path to an epub file or directory to convert. If it is a directory,
the converted dir is the name of the dir with the suffix _converted. If the path
is a file, the converted file has the extension .kepub.epub.
Links:
Website - https://pgaskin.net/kepubify
Source Code - https://github.com/geek1011/kepubify
Bugs/Support - https://github.com/geek1011/kepubify/issues
MobileRead - http://mr.gd/forums/showthread.php?t=295287
```

## seriesmeta
Expand Down
67 changes: 40 additions & 27 deletions docs/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,12 @@
<b>Features</b>
<ul>
<li>Full support of all kepub features</li>
<li>Batch conversion</li>
<li>Fast (about 15x faster than Calibre)</li>
<li>Works from the command line</li>
<li>Extremely fast (about 15x faster and uses 3x less memory than Calibre)</li>
<li>Batch conversion with full control over the directory structure</li>
<li>Works from the command line and can be embedded in other applications</li>
<li>Comprehensive test suite</li>
<li>Optionally pre-generate covers (can also stretch it to a specific aspect ratio)</li>
<li>Optionally update Kobo series metadata (even before the book is imported)</li>
<li>Does not add any extra metadata (unlike Calibre)</li>
<li>Supports many different CSS tweaks</li>
<li><b><a href="https://github.com/geek1011/kepubify/releases/latest">Covergen</a>: </b>Optionally pre-generate covers (can also stretch it to a specific aspect ratio)</li>
<li><b><a href="https://github.com/geek1011/kepubify/releases/latest">Seriesmeta</a>: </b>Optionally update Kobo series metadata (even before the book is imported)</li>
</ul>
Expand Down Expand Up @@ -88,26 +87,34 @@
<div class="section">
<div class="name">Usage</div>
<div class="text">
<pre>Usage: kepubify [OPTIONS] PATH [PATH]...
<pre>Usage: kepubify [options] input_path [input_path]...

Options:
--calibre use .kepub instead of .kepub.epub as the output extension (for Calibre compatibility, only use if you know what you are doing)
-c, --css string custom CSS to add to ebook
--fullscreen-reading-fixes enable fullscreen reading bugfixes based on https://www.mobileread.com/forums/showpost.php?p=3113460&postcount=16
-h, --help show this help text
General Options:
-v, --verbose show extra information in output
--version show the version
-h, --help show this help text

Output Options:
-u, --update don't reconvert files which have already been converted (i.e. don't overwrite output files)
-i, --inplace don't add the _converted suffix to converted files and directories
--no-preserve-dirs flatten the directory structure of the input (an error will be shown if there are conflicts)
-o, --output string [>1 inputs || 1 file input with existing dir output]: directory to place converted files/dirs under; [1 file input with
nonexistent output]: output filename; [1 dir input]: output directory for contents of input (default: current directory)
--calibre use .kepub instead of .kepub.epub as the output extension (for Calibre compatibility, only use if you know what you are doing)

Conversion Options:
--smarten-punctuation smarten punctuation (smart quotes, dashes, etc) (excluding pre and code tags)
-c, --css stringArray custom CSS to add to ebook
--hyphenate force enable hyphenation
--no-hyphenate force disable hyphenation
-o, --output string the directory to place the converted files (default ".")
--fullscreen-reading-fixes enable fullscreen reading bugfixes based on https://www.mobileread.com/forums/showpost.php?p=3113460&postcount=16
-r, --replace stringArray find and replace on all html files (repeat any number of times) (format: find|replace)
--smarten-punctuation smarten punctuation (smart quotes, dashes, etc) (excluding pre and code tags)
-u, --update don't reconvert files which have already been converted
-v, --verbose show extra information in output
--version show the version

Arguments:
PATH is the path to an epub file or directory to convert. If it is a directory, the converted
dir is the name of the dir with the suffix _converted. If the path is a file, the converted
file has the extension .kepub.epub.</pre>
Links:
Website - https://pgaskin.net/kepubify
Source Code - https://github.com/geek1011/kepubify
Bugs/Support - https://github.com/geek1011/kepubify/issues
MobileRead - http://mr.gd/forums/showthread.php?t=295287</pre>
</div>
</div>
<div class="section">
Expand Down Expand Up @@ -170,6 +177,12 @@
<br>
<tt>kepubify --update /path/to/the/books/</tt>
</p>

<p>
<b>To convert a calibre library in-place</b>:
<br>
<tt>kepubify --update --inplace --calibre /path/to/calibre/library/</tt>
</p>
</div>
</div>
<div class="section">
Expand Down Expand Up @@ -225,16 +238,16 @@
<div class="name">Why would I use this over the Calibre kepub output plugin?</div>
<div class="text">
<ul>
<li>Calibre adds additional unnecessary metadata to the ebook</li>
<li>Kepubify is usually at least 12x faster than the Calibre plugin</li>
<li>Kepubify is usually at least 15x faster and uses 3x less memory than the Calibre plugin</li>
<li>Kepubify produces output nearly identical to official KEPUB files (as of 2020-01-14, Kepubify has a few things which the Calibre plugin doesn't)</li>
<li>Kepubify works from the command line</li>
<li>Kepubify removes leftover Adobe DRM tags, cleans up MS Word tags, and cleans up the html</li>
<li>Calibre is an enourmous program, which is unnecessary if all you want to do is convert books</li>
<li>Kepubify gives you complete control over the resulting file structure</li>
<li>Kepubify can be embedded in other applications</li>
<li>Calibre is an large application, which is unnecessary if all you want to do is convert books</li>
<li>Kepubify is written in Go, which is a compiled language</li>
<li>Kepubify can update the series metadata on your Kobo without managing your whole library</li>
<li>Kepubify is easier to customize</li>
</ul>
<p>If you are already using Calibre heavily to manage your books, kepubify is not for you. You can still use covergen and seriesmeta, though.</p>
<p>If you are already using Calibre heavily to manage your books, kepubify is not for you (unless you want to use it to pre-convert your books). You may still like covergen or seriesmeta, though.</p>
</div>
</div>
<div class="section">
Expand All @@ -249,7 +262,7 @@
</p>
</div>
</div>
<div class="footer">Copyright 2019 Patrick Gaskin</div>
<div class="footer">Copyright 2017-2020 Patrick Gaskin</div>

<script async src="https://www.googletagmanager.com/gtag/js?id=UA-66226417-1"></script>
<script>
Expand Down
3 changes: 1 addition & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,9 @@ module github.com/geek1011/kepubify
go 1.13

require (
// command/tools
// kepubify/covergen/seriesmeta
github.com/bamiaux/rez v0.0.0-20170731184118-29f4463c688b
github.com/geek1011/koboutils/v2 v2.0.0
github.com/mattn/go-isatty v0.0.11
github.com/mattn/go-sqlite3 v2.0.2+incompatible
github.com/mattn/go-zglob v0.0.1
github.com/spf13/pflag v1.0.5
Expand Down
4 changes: 0 additions & 4 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@ github.com/geek1011/net v0.0.0-20200112223105-747a32f770f8 h1:igYGtip7Y5+SQENEJa
github.com/geek1011/net v0.0.0-20200112223105-747a32f770f8/go.mod h1:GtsWdVoIzucsgYAWGiNlnsRjGNsNS1d8o6TTe5TRgB0=
github.com/kr/smartypants v0.1.0 h1:Sn8hn5XrY+uXrxSWUdcr621Gfpk11mOGGVs4XX06kEw=
github.com/kr/smartypants v0.1.0/go.mod h1:EcTX9ge+SWNaGwbQvHwNICsMGavh98FLUqyOWFr+j9c=
github.com/mattn/go-isatty v0.0.11 h1:FxPOTFNqGkuDUGi3H/qkUbQO4ZiBa2brKq5r0l8TGeM=
github.com/mattn/go-isatty v0.0.11/go.mod h1:PhnuNfih5lzO57/f3n+odYbM4JtupLOxQOAqxQCu2WE=
github.com/mattn/go-sqlite3 v2.0.2+incompatible h1:qzw9c2GNT8UFrgWNDhCTqRqYUSmu/Dav/9Z58LGpk7U=
github.com/mattn/go-sqlite3 v2.0.2+incompatible/go.mod h1:FPy6KqzDD04eiIsT53CuJW3U88zkxoIYsOqkbpncsNc=
github.com/mattn/go-zglob v0.0.1 h1:xsEx/XUoVlI6yXjqBK062zYhRTZltCNmYPx6v+8DNaY=
Expand All @@ -23,6 +21,4 @@ golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e h1:vcxGaoTs7kV8m5Np9uUNQin4
golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a h1:1BGLXjeY4akVXGgbC9HugT3Jv3hCI0z56oJR5vAMgBU=
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20191026070338-33540a1f6037 h1:YyJpGZS1sBuBCzLAR1VEpK193GlqGZbnPFnPV/5Rsb4=
golang.org/x/sys v0.0.0-20191026070338-33540a1f6037/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
Loading

0 comments on commit 30b1a49

Please sign in to comment.