branch: externals/calibre
commit f4ac11181e39bd70d149960fb44d004420c0ffbe
Author: Kjartan Oli Agustsson <[email protected]>
Commit: Kjartan Oli Agustsson <[email protected]>
Remove summary as a metadata field
* calibre-book.el (calibre-book): Remove summary field.
* calibre-cli.el (calibre-cli--make-book): Don't retrieve the book's
summary.
* calibre-core.el (calibre-library-columns): Remove summary as an option.
(calibre-book--print-info): Remove case for summary.
(calibre-book--file): Remove case for summary.
* calibre-db.el (calibre-db--make-book): Don't expect to receive summary.
(calibre-db--query): Don't retrieve the book's summary.
The summary field typically contains large amounts of text and does
not display well in the *Library* buffer. This leads to a large
increase in memory consumption (it caused issues for `memory-report')
for very little, if any, gain. For the upcoming feature for viewing
information on a single book we will be better served by fetching the
summary as needed.
---
calibre-book.el | 5 +----
calibre-cli.el | 3 +--
calibre-core.el | 49 ++++++++++++++++++++++++++++---------------------
calibre-db.el | 14 +++++---------
4 files changed, 35 insertions(+), 36 deletions(-)
diff --git a/calibre-book.el b/calibre-book.el
index f9b96b1857..bf4080bd88 100644
--- a/calibre-book.el
+++ b/calibre-book.el
@@ -68,10 +68,7 @@
:documentation "The book's position within the library")
(file-name nil
:type string
- :documentation "The book's filename, sans extension.")
- (summary nil
- :type (or string null)
- :documentation "The book's summary."))
+ :documentation "The book's filename, sans extension."))
(defcustom calibre-format-preferences '(pdf epub)
"The preference order of file formats."
diff --git a/calibre-cli.el b/calibre-cli.el
index da19c5c58e..c074519acc 100644
--- a/calibre-cli.el
+++ b/calibre-cli.el
@@ -70,8 +70,7 @@ specified the default is \\='all\\='."
:tags (sort .tags)
:formats (calibre-cli--parse-formats .formats)
:path (calibre-cli--parse-path .formats)
- :file-name (calibre-cli--parse-file-name .formats)
- :summary .comments)))
+ :file-name (calibre-cli--parse-file-name .formats))))
(defun calibre-cli--parse-authors (authors)
"Parse AUTHORS a string, into a list of authors.
diff --git a/calibre-core.el b/calibre-core.el
index 14be43a68b..7c4df853e7 100644
--- a/calibre-core.el
+++ b/calibre-core.el
@@ -136,8 +136,7 @@ column should have."
(const :tag "Series Index" series-index)
(const :tag "Tags" tags)
(const :tag "Formats" formats)
- (const :tag "Publication date" pubdate)
- (const :tag "Summary" summary))
+ (const :tag "Publication date" pubdate))
(integer :tag "Width")))
:set (lambda (symbol value)
(set-default symbol value)
@@ -174,31 +173,39 @@ with values determined by `calibre-library-columns'."
(formats `("Formats" ,width))
(pubdate `("Publication Date" ,width (lambda (a b)
(time-less-p
(calibre-book-pubdate (car a))
-
(calibre-book-pubdate (car b))))))
- (summary `("Summary" ,width)))))
+
(calibre-book-pubdate (car b)))))))))
calibre-library-columns)))
(defun calibre-book--print-info (book)
"Return list suitable as a value of `tabulated-list-entries'.
BOOK is a `calibre-book'."
(list book
- (vconcat (mapcar (lambda (x)
- (let ((column (car x)))
- (cl-case column
- (id (int-to-string (calibre-book-id book)))
- (title (calibre-book-title book))
- (authors (string-join (calibre-book-authors
book) ", "))
- (publisher (let ((publisher
(calibre-book-publisher book)))
- (if (not publisher) "" publisher)))
- (series (let ((series (calibre-book-series
book))) (if (not series) "" series)))
- (series-index (if (calibre-book-series book)
(format "%.1f" (calibre-book-series-index book)) ""))
- (tags (string-join (calibre-book-tags book) ",
"))
- (formats (string-join (mapcar (lambda (f)
(upcase (symbol-name f))) (calibre-book-formats book)) ", "))
- (pubdate (if (calibre-book-pubdate book)
- (format-time-string
calibre-library-time-format (calibre-book-pubdate book))
- "Invalid"))
- (summary (or (calibre-book-summary book) "")))))
- calibre-library-columns))))
+ (vconcat
+ (mapcar
+ (lambda (x)
+ (let ((column (car x)))
+ (cl-case column
+ (id (int-to-string (calibre-book-id book)))
+ (title (calibre-book-title book))
+ (authors (string-join (calibre-book-authors book) ", "))
+ (publisher (or (calibre-book-publisher book) ""))
+ (series (or (calibre-book-series book) ""))
+ (series-index
+ (if (calibre-book-series book)
+ (format "%.1f" (calibre-book-series-index book))
+ ""))
+ (tags (string-join (calibre-book-tags book) ", "))
+ (formats (string-join
+ (mapcar (lambda (f)
+ (upcase (symbol-name f)))
+ (calibre-book-formats book))
+ ", "))
+ (pubdate (if (calibre-book-pubdate book)
+ (format-time-string
+ calibre-library-time-format
+ (calibre-book-pubdate book))
+ "Invalid")))))
+ calibre-library-columns))))
(defun calibre-book--file (book format)
"Return the path to BOOK in FORMAT."
diff --git a/calibre-db.el b/calibre-db.el
index 696f5f601d..be567b010f 100644
--- a/calibre-db.el
+++ b/calibre-db.el
@@ -39,7 +39,7 @@ TIMESTAMP is a string of the form YYYY-MM-DD
HH:MM:SS.xxxxxx+00:00."
(defun calibre-db--make-book (entry)
"Create a `calibre-book' from ENTRY.
ENTRY is a list of the form:
-\(ID TITLE SERIES SERIES-INDEX TIMESTAMP PUBDATE LAST-MODIFIED PATH SUMMARY)."
+\(ID TITLE SERIES SERIES-INDEX TIMESTAMP PUBDATE LAST-MODIFIED PATH)."
(seq-let
[id
title
@@ -48,8 +48,7 @@ ENTRY is a list of the form:
timestamp
pubdate
last-modified
- path
- summary]
+ path]
entry
(make-calibre-book :id id
:title title
@@ -63,8 +62,7 @@ ENTRY is a list of the form:
:tags (sort (calibre-db--get-book-tags id))
:formats (calibre-db--get-book-formats id)
:path path
- :file-name (calibre-db--get-book-file-name id)
- :summary summary)))
+ :file-name (calibre-db--get-book-file-name id))))
(defun calibre-db--get-book-authors (id)
"Return a list of authors for the book identified by ID."
@@ -164,12 +162,10 @@ WHERE books.id = ?"
timestamp,
pubdate,
last_modified,
- path,
- comments.text
+ path
FROM books
LEFT JOIN books_series_link sl ON books.id = sl.book
-LEFT JOIN series ON sl.series = series.id
-LEFT JOIN comments ON books.id = comments.book;"))))
+LEFT JOIN series ON sl.series = series.id;"))))
(defmacro calibre-db--query (query arg fuzzy)
"Run QUERY on the Calibre database.