branch: externals/calibre
commit 38e0beb8400bd2260016744529751934e36df8f0
Author: Kjartan Óli Ágústsson <[email protected]>
Commit: Kjartan Óli Ágústsson <[email protected]>
Get publishers
* calibre-book.el (calibre-book): Added the publishers slot
(calibre-make-book): Added initialisation of the publishers slot
* calibre-db.el: Created new function calibre-db--get-publishers
---
calibre-book.el | 5 +++++
calibre-db.el | 8 ++++++++
2 files changed, 13 insertions(+)
diff --git a/calibre-book.el b/calibre-book.el
index d5bc409e6f..c3bfecd44d 100644
--- a/calibre-book.el
+++ b/calibre-book.el
@@ -37,6 +37,9 @@
(authors :initarg :authors
:type list
:documentation "The authors of the book.")
+ (publishers :initarg :publishers
+ :type list
+ :documentation "The publishers of the book.")
(series :initarg :series
:initform nil
:type (or string null)
@@ -75,6 +78,7 @@ for private functions."
(calibre-book--slot id)
(calibre-book--slot title)
(calibre-book--slot authors)
+(calibre-book--slot publishers)
(calibre-book--slot series)
(calibre-book--slot series-index)
(calibre-book--slot tags)
@@ -90,6 +94,7 @@ ENTRY is a list of the form:
(calibre-book :id id
:title title
:authors (calibre-db--get-book-authors id)
+ :publishers (calibre-db--get-book-publishers id)
:series series
:series-index series-index
:timestamp (calibre-parse-timestamp timestamp)
diff --git a/calibre-db.el b/calibre-db.el
index 3bad18fa40..25df7a9f78 100644
--- a/calibre-db.el
+++ b/calibre-db.el
@@ -48,6 +48,14 @@ FROM authors
INNER JOIN books_authors_link al ON authors.id = al.author
WHERE al.book = ?" `[,id])))
+(defun calibre-db--get-book-publishers (id)
+ "Return a list of publishers for the book identified by ID."
+ (flatten-list (sqlite-select (calibre--db)
+ "SELECT publishers.name
+FROM publishers
+INNER JOIN books_publishers_link pl ON publishers.id = pl.publisher
+WHERE pl.book = ?" `[,id])))
+
(defun calibre-db--get-book-file-name (id)
"Return the file name, sans extension, of the book identified by ID."
(car (car (sqlite-select (calibre--db)