View Single Post
Old 05-19-2012, 05:15 PM   #1
JimmXinu
Plugin Developer
JimmXinu ought to be getting tired of karma fortunes by now.JimmXinu ought to be getting tired of karma fortunes by now.JimmXinu ought to be getting tired of karma fortunes by now.JimmXinu ought to be getting tired of karma fortunes by now.JimmXinu ought to be getting tired of karma fortunes by now.JimmXinu ought to be getting tired of karma fortunes by now.JimmXinu ought to be getting tired of karma fortunes by now.JimmXinu ought to be getting tired of karma fortunes by now.JimmXinu ought to be getting tired of karma fortunes by now.JimmXinu ought to be getting tired of karma fortunes by now.JimmXinu ought to be getting tired of karma fortunes by now.
 
JimmXinu's Avatar
 
Posts: 6,313
Karma: 3966249
Join Date: Dec 2011
Location: Midwest USA
Device: Kindle Paperwhite(10th)
[GUI Plugin] EpubSplit

Splitting omnibus eBooks into multiple eBooks seems to be a common request, but there haven't been many tools to do so without a lot of hand editing.

This plugin provides the ability to create new EPUBs by splitting off part of an existing (non-DRM) EPUB format eBook.

Main Features of EpubSplit Plugin:
  • Present the user with a list of 'split lines' in the existing EPUB. The beginning of each file listed in the manifest spine and each Table of Contents(TOC) entry. <guide> tagged files are also indicated.
  • 'Preview' contents of each 'split line' as a tooltip over the HREF.
  • Allow user to edit the TOC entry(s) for each 'line'.
  • Select one or more of the offered lines to include in the new eBook,
  • Edit the metadata for the new split eBook, and then,
  • Extract only the selected contents of the source EPUB into the new EPUB,
  • Scan the selected content for CSS & image links for additional files to include,
  • Scan the selected content for internal links and anchors and update links that need to point to different filenames,
  • Use the metadata entered into calibre for the new eBook (including cover) as the metadata in the new EPUB.
  • Return to list of source EPUB sections after creating a new split EPUB.
  • New in version 2.1.0 - Select one or more of the offered lines and split each into a separate new book.
  • Configure which metadata from source EPUB to copy to new eBook, now offering more of the standard metadata and custom columns.
  • Configurably populate a custom column with the source book title/author/etc.
  • CLI via calibre-debug --run-plugin

Special Notes:
  • Requires Calibre v3.48.0 or later.

Languages:

This plugin has (at least partial) translations for:
  • Catalan
  • Chinese (Hong Kong)
  • Dutch
  • Estonian
  • French
  • German
  • Greek
  • Hebrew
  • Norwegian Bokmål
  • Polish
  • Portuguese (Brazil)
  • Romanian
  • Spanish
  • Swedish
  • Turkish
  • Ukrainian
Command Line Interface(CLI)

Starting with calibre v0.9.23, calibre offers a command-line interface (CLI) for calling plugins.

This plugin supports that option and allows the user to call the plugin's basic functionality from outside calibre without having to install Python or get the plugin's files separately.

Details:
Spoiler:

Code:
Usage: calibre-debug.exe --run-plugin EpubSplit -- [options] <input epub> [line numbers...]

Giving an epub without line numbers will return a list of line numbers: the
possible split points in the input file. Calling with line numbers will
generate an epub with each of the "lines" given included.

Options:
  -h, --help            show this help message and exit
  -o OUTPUT, --output=OUTPUT
                        Set OUTPUT file, Default: split.epub
  --output-dir=OUTPUTDIROPT
                        Set OUTPUT directory, Default: presend working
                        directory
  --split-by-section    Create a new epub from each of the listed line
                        sections instead of one containing all.  Splits all
                        sections if no lines numbers are given. Each split
                        will be named <number>-<output name> and placed in the
                        output-dir.  Sections without a Table of Contents
                        entry will be included with the preceding section(s)
  -t TITLE, --title=TITLE
                        Use TITLE as the metadata title.  Default: '<original
                        epub title> Split' or ToC entry with --split-by-
                        section
  -d DESC, --description=DESC
                        Use DESC as the metadata description.  Default: 'Split
                        from <epub title> by <author>'.
  -a AUTHOR, --author=AUTHOR
                        Use AUTHOR as a metadata author, multiple authors may
                        be given, Default: <All authors from original epub>
  -g TAG, --tag=TAG     Include TAG as dc:subject tag, multiple tags may be
                        given, Default: None
  -l LANG, --language=LANG
                        Include LANG as dc:language tag, multiple languages
                        may be given, Default: en
  -c COVER, --cover=COVER
                        Path to a jpg to use as cover image.


Installation Steps:
  1. Download the attached zip file and install the plugin/add to context menu or toolbar/restart Calibre as described in the Introduction to plugins thread.

Version History:
Spoiler:

Version 3.6.0 - 2024-04-01
- Update translations, change translation limit to 10%
- Decrypt obfuscated font files during split.
- Speed up get_split_files by using existing split_lines data #9

Version 3.6.0 - 2023-04-11
- Add --split-by-section & --output-dir CLI options.
- Update translations

Version 3.5.0 - 2022-09-13
- Add Split in N Books / Split by N Pieces Feature
- Fix for ProgressBar not initially rendering in Win10.
- Update translations

Version 3.4.0 - 2022-07-31
- Use Cal6 get_icons() so icon themes apply
- Update Translations

Version 3.3.0 - 2022-03-22
- Don't offer to copy composite columns.
- Update Translations

Version 3.2.0 - 2022-01-18
- Changes for upcoming Qt6 Calibre
- Update Translations

Version 3.1.0 - 2021-05-30
- Additional strings for translation.
- Add options to include src title, calibre URL and identifiers URL in split comments.
- Accept a wider range of types as font files.
- Update Translations

Version 3.0.0 - 04 Nov 2020
- Don't sort TOC items in same file. Fix for prior 'fix' (a633bd1756b993947506e8eb9351d72e984bd3c5)
- Add busy cursor while reading split data.
- Update translations.
- Bump minimum calibre version to v3.48.0

Version 2.9.0 - 10 Feb 2020
- Update translations.
- Add check and error message for unsupported epub3.
- Changes for eventual Python3 migration of Calibre.

Version 2.8.0 - 02 Dec 2019
- Update translations
- Update cover view as well as tags and library list on new book create.

Version 2.7.0 - 20 Apr 2019
- Bump Supported Calibre Version to v2.85.1.
- Update translations
- Bump copyright year
- Newer BeautifulSoup version included in Calibre v3.41 needs changes.

Version 2.6.0 - 05 Jan 2019
- Update Translations

Version 2.5.0 - 10 Sep 2018
- Add user input check that they selected something.
- Change New Book per Section code to include non-TOC sections with previous TOC.
- Calibre treats comments as HTML better.
- Make Edit Metadata Optional(both single and per Section),.
- Move Source Column setting to top.
- Add 'Configure' button to dialog.
- Add 'Always Include' optional feature.
- Allow 'series' custom columns for Source Col and set series num to number of book split by simple count.
- Update Translations

Version 2.4.0 - 13 Mar 2018
Apply posixpath.normpath() to content and reference items in case of /../ in paths.
Update translations (from Transifex.com).

Version 2.3.0 - 04 Dec 2017
Add feature to calculate size of split book.
Update translations (from Transifex.com).

Version 2.2.1 - 30 Jun 2017
Update translations (from Transifex.com).

Version 2.2.0 - 01 Nov 2016
Update translations (from Transifex.com).

This version adds an option (that is checked by default) that each new split book will take it's title from the first included TOC entry. If there's no TOC entry for the first included file, the previous behavior (Copy Title or 'Unknown') will be used.

Version 2.1.2 - 04 May 2016
Update translations (from Transifex.com).
Fix for Mac OS X freezes - set log level to CRITICAL unless calibre in debug or in BG job.
Fix for Mac OS X crashes - changes to progress bar dialogs implementation.
Change to include font files in splits. Includes all fonts, use other tools to remove unused fonts.

Version 2.1.1 - 29 May 2015
Update translations.

Version 2.1.0 - 12 May 2015
New feature: Split individual sections into separate books.
New feature: Double-click HREF column to bring up a dialog of the section sample that can be copied from.
Update translations, include more partial translations.

Version 2.0.3 - 17 Mar 2015
Switch to github for source repository.
Normalize line endings on windows standard.

Version 2.0.2 - 08 Sep 2014
New translations for German and Greek, courtesy of the volunteers at Transifex.

Version 2.0.1 - 19 Aug 2014
New translation for Swedish, courtesy of the volunteers at Transifex.

Version 2.0.0 - 22 Jul 2014
Now supporting Qt5 and Calibre 2.0 (currently in beta).
Translations updates to Spanish, French and Ukrainian and new translation Portuguese (Brazil), courtesy of the volunteers at Transifex.
Plugin zip file now uncompressed for performance per Kovid's recommendation.

Version 1.3.4 - 02 Jul 2014
Update Spanish and add Ukrainian translations, courtesy of the volunteers at Transifex.
Pretty format XML of generated metadata files.

Version 1.3.3 - 30 Dec 2013
Tweaks to French Translation. Thanks, Ptitprince.

Version 1.3.2 - 12 Dec 2013
Add Spanish Translation. Thanks, Terisa.
Tweaks to French Translation. Thanks, Ptitprince.

Version 1.3.1 - 07 Dec 2013
Add French Translation. Thanks, Ptitprince.

Version 1.3.0 - 22 Sep 2013
Remove debug output. Caused errors for a Mac user with a large epub.

Version 1.2.9 - 03 May 2013
Fix for a changed an internal name in calibre in 0.9.29.

Version 1.2.8 - 16 Mar 2013
Move CLI main import into cli_main. Caused problems for some users on install.

Version 1.2.7 - 15 Mar 2013
Add calibre CLI.

Version 1.2.6 - 01 Dec 2012
Change import for 64 bit calibre.

Version 1.2.5 - 26 Nov 2012
Disable plugin when viewing device, not library.

Version 1.2.4 - 09 Nov 2012
Handle TOC entries with empty text gracefully.

Version 1.2.3 - 27 Sep 2012
'Preview' contents of each 'split line' as a tooltip over the HREF.

Version 1.2.2 - 23 Sep 2012
Add more standard columns to copy list, add custom columns tab to allow copying, make both scrollable in config dialog.
Add options to save the source book title/author/etc to a custom column.

Version 1.2.1 - 28 Jul 2012
Allow for old JSON settings with only partial settings.

Version 1.2.0 - 27 Jul 2012
Return to list of source EPUB sections after creating a new split EPUB.
Options now stored inside the Library rather than an external JSON file.

Version 1.1.1 - Jun 28 2012
Handling links to missing images and css files better.

Version 1.1.0 - Jun 23 2012
Change icon
Add config options to choose which metadata from source EPUB to copy to new eBook.

Version 1.0.0 - May 26 2012
Allow edit of ToC entries.

Version 0.0.1 - May 21 2012
Not configurable.
Show {Guide} entries when splitting.

Version 0.0.0 - May 19 2012
Initial version.
Attached Files
File Type: zip EpubSplit.zip (458.1 KB, 1383 views)

Last edited by JimmXinu; 04-01-2024 at 10:32 AM. Reason: Update to latest version.
JimmXinu is offline   Reply With Quote