emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[elpa] externals/calibre 67b7386841 07/11: Move functions from calibre-c


From: ELPA Syncer
Subject: [elpa] externals/calibre 67b7386841 07/11: Move functions from calibre-core to calibre-cli
Date: Sat, 20 May 2023 19:57:32 -0400 (EDT)

branch: externals/calibre
commit 67b7386841c9acf20b72368b0f373b9504b1e16b
Author: Kjartan Óli Ágústsson <kjartanoli@disroot.org>
Commit: Kjartan Óli Ágústsson <kjartanoli@disroot.org>

    Move functions from calibre-core to calibre-cli
    
    * calibre-cli.el (calibre-cli--get-titles):
    (calibre-cli--get-authors):
    (calibre-cli--get-publishers):
    (calibre-cli--get-series):
    (calibre-cli--get-tags):
    (calibre-cli--get-formats):
    Move from calibre-core.
    Use calibredb to get data instead of the in memory list of books.
    * calibre-core.el (calibre-cli--get-titles):
    (calibre-cli--get-authors):
    (calibre-cli--get-tags):
    (calibre-cli--get-formats):
    (calibre-cli--get-series):
    (calibre-cli--get-publishers):
    Move into calibre-cli.
---
 calibre-cli.el  | 46 ++++++++++++++++++++++++++++++++++++++++++++++
 calibre-core.el | 34 ----------------------------------
 2 files changed, 46 insertions(+), 34 deletions(-)

diff --git a/calibre-cli.el b/calibre-cli.el
index 665f141594..2b84f54bec 100644
--- a/calibre-cli.el
+++ b/calibre-cli.el
@@ -118,5 +118,51 @@ AUTHORS should be a comma separated string."
 (calibre-cli--search-operation tag)
 (calibre-cli--search-operation author)
 
+(defun calibre-cli--get-titles ()
+  "Return a list of the titles in the active library."
+  (cl-remove-duplicates
+   (mapcar (lambda (b)
+             (alist-get 'title b))
+           (calibre-cli--list "title"))
+   :test #'string=))
+
+(defun calibre-cli--get-authors ()
+  "Return a list of the authors in the active library."
+  (cl-remove-duplicates
+   (cl-reduce #'cl-union (mapcar (lambda (b)
+                                  (calibre-cli--parse-authors (alist-get 
'authors b)))
+                                 (calibre-cli--list "authors")))
+   :test #'string=))
+
+(defun calibre-cli--get-publishers ()
+  "Return a list of the publishers in the active library."
+  (remq nil (cl-remove-duplicates
+             (mapcar (lambda (b)
+                       (alist-get 'publisher b))
+                     (calibre-cli--list "publisher"))
+             :test #'string=)))
+
+(defun calibre-cli--get-series ()
+  "Return a list of the series in the active library."
+  (remq nil (cl-remove-duplicates
+             (mapcar (lambda (b)
+                       (alist-get 'series b))
+                     (calibre-cli--list "series"))
+             :test #'string=)))
+
+(defun calibre-cli--get-tags ()
+  "Return a list of the tags in the active library."
+  (cl-remove-duplicates
+   (cl-reduce #'cl-union (mapcar (lambda (b)
+                                  (alist-get 'tags b))
+                                 (calibre-cli--list "tags")))
+   :test #'string=))
+
+(defun calibre-cli--get-formats ()
+  "Return a list of the file formats stored in the active library."
+  (cl-reduce #'cl-union (mapcar (lambda (b)
+                                  (calibre-cli--parse-formats (alist-get 
'formats b)))
+                                (calibre-cli--list "formats"))))
+
 (provide 'calibre-cli)
 ;;; calibre-cli.el ends here
diff --git a/calibre-core.el b/calibre-core.el
index f7537e9565..15c9c81082 100644
--- a/calibre-core.el
+++ b/calibre-core.el
@@ -285,39 +285,5 @@ FILTERS should be a list of vectors, for the exact 
contents see
 (defvar calibre-tags-completion-table
   (completion-table-dynamic #'calibre-core--get-tags))
 
-
-;; These functions should be in calibre-cli.el, but they require
-;; calibre--books because the calibredb interface does not expose the
-;; ability get this information.
-(defun calibre-cli--get-titles ()
-  "Return a list of the titles in the active library."
-  (cl-remove-duplicates
-   (mapcar #'calibre-book-title (calibre--books))
-   :test #'string=))
-
-(defun calibre-cli--get-authors ()
-  "Return a list of the authors in the active library."
-  (cl-reduce #'cl-union (mapcar #'calibre-book-authors (calibre--books))))
-
-(defun calibre-cli--get-tags ()
-  "Return a list of the tags in the active library."
-  (cl-reduce #'cl-union (mapcar #'calibre-book-tags (calibre--books))))
-
-(defun calibre-cli--get-formats ()
-  "Return a list of the file formats stored in the active library."
-  (cl-reduce #'cl-union (mapcar #'calibre-book-formats (calibre--books))))
-
-(defun calibre-cli--get-series ()
-  "Return a list of the series in the active library."
-  (remq nil (cl-remove-duplicates
-             (mapcar #'calibre-book-series (calibre--books))
-             :test #'string=)))
-
-(defun calibre-cli--get-publishers ()
-  "Return a list of the publishers in the active library."
-  (remq nil (cl-remove-duplicates
-            (mapcar #'calibre-book-publisher (calibre--books))
-            :test #'string=)))
-
 (provide 'calibre-core)
 ;;; calibre-core.el ends here



reply via email to

[Prev in Thread] Current Thread [Next in Thread]