View Single Post
Old 02-20-2012, 04:18 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,307
Karma: 3966249
Join Date: Dec 2011
Location: Midwest USA
Device: Kindle Paperwhite(10th)
[GUI Plugin] EpubMerge

Merging together multiple eBooks together into one eBook seems to be a common request, but there haven't been many tools to do so.

This plugin provides the ability to create new EPUBs by combining the contents of existing (non-DRM) EPUB format eBooks.

The source may be seen, and a Command Line version obtained, from the project home page.

Main Features of EpubMerge Plugin:
  • Select a list of books in calibre,
  • Order them,
  • Edit the metadata for the new combined eBook, and then,
  • Merge the contents of the EPUBs together into the new eBook, now including cover from metadata if set.
  • UnMerge previously merged epubs if metadata was saved during merge.
  • Configurably able to save the metadata for each merged book for UnMerging later if desired. (Defaults to On.)
  • Configurably able to populate custom columns from source books.
  • Options now stored inside the Library rather than an external JSON file.
  • CLI via calibre-debug --run-plugin
There are a few configurable options: whether or not to insert a Table of Contents entry for each merged book (with it's original TOC nested underneath it), an option to flatten the TOC down to one level only, and including the merged books comments. These options are stored by Library.

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

Languages:

This plugin has (at least partial) translations for:
  • Catalan
  • Dutch
  • English
  • French
  • German
  • Japanese
  • Lithuanian
  • Norwegian Bokmål
  • Polish
  • Portuguese
  • Portuguese (Brazil)
  • Romanian
  • Spanish
  • Swedish
  • Turkish
  • Ukrainian

Command Line Interface(CLI)

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 EpubMerge -- [options] <input epub> [<input epub>...]

Given list of epubs will be merged together into one new epub.

Options:
  -h, --help            show this help message and exit
  -o OUTPUT, --output=OUTPUT
                        Set OUTPUT file, Default: merge.epub
  -t TITLE, --title=TITLE
                        Use TITLE as the metadata title.  Default: '<first
                        epub title> Anthology'
  -d DESC, --description=DESC
                        Use DESC as the metadata description.  Default: '<epub
                        title> by <author>' for each epub.
  -a AUTHOR, --author=AUTHOR
                        Use AUTHOR as a metadata author, multiple authors may
                        be given, Default: <All authors from epubs>
  -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
  -n, --no-titles-in-toc
                        Default is to put an entry in the TOC for each epub,
                        nesting each epub's chapters under it.
  -N, --no-original-toc
                        Default is to include the TOC from each original epub.
  -f, --flatten-toc     Flatten TOC down to one level only.
  -c COVER, --cover=COVER
                        Path to a jpg to use as cover image.
  -k, --keep-meta       Keep original metadata files in merged epub.  Use for
                        UnMerging.
  -s URL, --source=URL  Include URL as dc:source and
                        dc:identifier(opf:scheme=URL).
  -u, --unmerge         UnMerge an existing epub that was created by merging
                        with --keep-meta.
  -D OUTPUTDIR, --outputdir=OUTPUTDIR
                        Set output directory for unmerge, Default: (current
                        dir)


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 2.18.0 - 2024-04-01
- Update Translations
- Decrypt encrypted/obfuscated font files
- Save opf:file-as attr from author tags in CLI #13
- Actually have 'en' default for `-l` in CLI.

Version 2.17.0 - 2023-11-29
- Update Translations

Version 2.16.0 - 2023-07-19
- Show busy cursor during unmerge
- Consolidate FFF title/log page skipping code to fix cover issue
- Add option to not condense TOC for a book down to a single entry if there's only one chapter in it.
- Add Restore Selection option
- Fix for writing relative paths in merged epub
- Update Translations

Version 2.15.0 - 2022-09-13
- Fix remove/up/down rows when lower selected first.
- Update Translations

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

Version 2.13.0 - 04 Apr 2022
- Add check for multiple toc.ncx files, use last to match Calibre viewer.
- Update Translations

Version 2.12.0 - 21 Jan 2022
- Explicitly set --output-profile=tablet when doing epub3->epub2 autoconvert in BG. For #7
- Changes for upcoming Qt6 Calibre
- Update Translations

Version 2.11.0 - 10 Sep 2020
- Do merging in a BG ground.
- Do merge in temp files instead of memory.
- Automatically convert input epub3s to epub2s before merging.
- Add new messages for translation.
- Update translations.

Version 2.10.0 - 05 Aug 2020
- Update translations.
- Bump min Calibre version.
- Fix FFF one-chapter story check

Version 2.9.0 - 10 Feb 2020
- Add a check and error message for unsupported epub3.

Version 2.8.0 - 13 Jan 2020
- Changes for eventual Python3 migration of Calibre.
- Add 'current time' option to custom datetime columns.
- Update translations

Version 2.7.0 - 16 Dec 2019
- Copy six.ensure_binary for Calibre v3.
- Reduce debug output.

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

Version 2.5.0 - 05 Jan 2019
- Update Translations
- Set allowZip64=True when writing zip files. Should only matter for files >2G.
- Also disable menu items while on device view.

Version 2.4.0 - 19 Sep 2018
- Add option not to include TOC from input files, thanks murraypaul
- Tweak wording of originalnavpoints option and add a warning about merged books with no TOC at all.

Version 2.3.0 - 06 Sep 2018
- Update Translations.
- Calibre treats book comments as HTML better.

Version 2.2.0 - 13 Mar 2018
- Update Translations.
- Apply normpath to hrefs and srcs in case of extra adsf/.. /./ etc.

Version 2.1.1 - 30 Jun 2017
Update Translations.

Version 2.1.0 - 13 Dec 2016
Add firstseries option feature.
Update Translations.

Version 2.0.14 - 06 Sep 2016
Handle sub-books with single top-level TOC, but nested entries better.
Update Translations

Version 2.0.13 - 24 Aug 2016
Add code for handling cover that isn't jpg. Detected by file extension.
Fail more gracefully when metadata indicates a file that doesn't exist.
Update translations, add Portuguese and Turkish.

Version 2.0.12 - 04 May 2016
Fix for Mac OS X crashes - changes to progress bar dialogs implementation.
Fix for Mac OS X freezes - set log level to CRITICAL unless calibre in debug or in BG job.
Update translations.

Version 2.0.11 - 30 Dec 2015
Really update translations.

Version 2.0.10 - 28 Dec 2015
Allow multiple UnMerge
Add 'Apply to all' checkbox
Add logger, change prints to logger.
Add Translations for Lithuanian and Polish (from Transifex.com).
Update Translations (from Transifex.com).

Version 2.0.9 - 06 Oct 2015
Allow Merge Word ('Anthology') to be removed entirely.
Update Translations (from Transifex.com).

Version 2.0.8 - 12 Jul 2015
Update FanFicFare integration.
Translation updates, add partial Romanian translation.

Version 2.0.7 - 29 Apr 2015
Translation updates.

Version 2.0.6 - 22 Apr 2015
Translation updates.

Version 2.0.5 - 16 Mar 2015
Switch to github for source repository.
Normalize line endings on windows standard.
Some translation updates.

Version 2.0.4 - 18 Nov 2014
Fix for calibre 2.10's changes to how keyboard shortcuts work. Removes unnecessary dynamic menu.

Version 2.0.3 - 23 Sep 2014
New translation for Swedish, courtesy of the volunteers at Transifex.

Version 2.0.2 - 04 Sep 2014
Add Include Books' Comments feature.

Version 2.0.1 - 04 Aug 2014
Don't put 'by <author>' in comment if only one author.

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

Portuguese (Brazil)
Version 1.3.9 - 02 Jul 2014
Add Ukrainian translations, courtesy of the volunteers at Transifex.
Pretty format XML of generated metadata files.

Version 1.3.8 - 02 Feb 2014
Add German Translation. Thanks, Wolfgang.

Version 1.3.7 - 30 Dec 2013
Add French Translation. Thanks, Ptitprince.

Version 1.3.6 - 18 Aug 2013
Add configuration option to change word 'Anthology' to something else.

Version 1.3.5 - 30 Jul 2013
Add options to average int/float type custom columns on merge.
Add option to configurably attach tags to new merged books.

Version 1.3.4 - 23 May 2013
Fix for poorly formed metadata--ignore item tags outside manifest tag.

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

Version 1.3.2 - 15 Mar 2013
Add calibre CLI.

Version 1.3.1 - 19 Feb 2013
Add UnMerge and 'Keep Metadata for UnMerge' options.
Expose an API for other plugins (eg FFDL) to call.

Version 1.2.5 - 13 Dec 2012
Allow namespaces in metadata xml.

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

Version 1.2.3 - 09 Nov 2012
Save PI options properly.

Version 1.2.2 - 23 Sep 2012
Minor fix for first epub missing metadata.
Only show 'by' author in TOC if only one author.
Make custom columns tab scrollable.

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

Version 1.2.0 - 27 Jul 2012
Options now stored inside the Library rather than an external JSON file.

Version 1.1.0 - 21 May 2012
Default cover to first book, add cover from metadata to epub if present.

Version 1.0.4 - 17 Apr 2012
Unquote item hrefs, so %20 becomes space, etc.

Version 1.0.3 - 06 Apr 2012
Improved handling of epubs with present, but empty author.

Version 1.0.2 - 24 Mar 2012
Improved handling of epubs with missing title and/or author.

Version 1.0.1 - 07 Mar 2012
Add configurable options to populate custom columns from source books.

Version 0.0.0 - 20 Feb 2012
Initial version.
Attached Files
File Type: zip EpubMerge.zip (473.6 KB, 1170 views)

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