branch: externals/calibre
commit b1720ba880c7a069a67826a3e44e230340932ebc
Author: Kjartan Oli Agustsson <[email protected]>
Commit: Kjartan Oli Agustsson <[email protected]>
Add the ability to add formats to existing books
* calibre-library.el (calibre-library-add-format): New function.
* doc/calibre.texi (Tagging added books): New section.
---
calibre-library.el | 11 +++++++++++
doc/calibre.texi | 10 ++++++++++
2 files changed, 21 insertions(+)
diff --git a/calibre-library.el b/calibre-library.el
index edf7327974..37a8b3380a 100644
--- a/calibre-library.el
+++ b/calibre-library.el
@@ -68,6 +68,17 @@ TAGS should be a list of strings to add to FILE."
nil)))
(calibre-exec--start-execution))
+(defun calibre-library-add-format (book file)
+ "Add FILE as a format for BOOK."
+ (interactive (list (tabulated-list-get-id)
+ (read-file-name "File: " nil nil t))
+ calibre-library-mode)
+ (calibre-exec--queue-command
+ `("add_format"
+ ,(number-to-string (calibre-book-id book))
+ ,(expand-file-name file)))
+ (calibre-exec--start-execution))
+
;;;###autoload
(defun calibre-dired-add (&optional tags)
"Add marked files to the Calibre library.
diff --git a/doc/calibre.texi b/doc/calibre.texi
index 19f74b77b5..c1014ff06d 100644
--- a/doc/calibre.texi
+++ b/doc/calibre.texi
@@ -277,6 +277,7 @@ is automatically refreshed once the modification has been
completed.
@menu
* Adding books::
+* Adding formats to existing books::
* Modifying books::
* Removing books::
@end menu
@@ -324,6 +325,15 @@ and @code{calibre-dired-add} can be called with a prefix
argument. When
called with a prefix argument they will prompt for a list of tags to
apply to the books being added.
+@node Adding formats to existing books
+@section Adding formats to existing books
+@findex calibre-library-add-format
+The @code{calibre-library-add-format} allows you to add formats to an
+existing book. The command will prompt for a file and add that file as
+a new format to the book at point in the @file{*Library*} buffer. Be
+aware that if you provide a file in a format already present in the
+library the existing file will be overwritten.
+
@node Modifying books
@section Modifying books
calibre.el provides two methods of modifying book metadata. A dedicated