[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
- [elpa] externals/calibre updated (28c605f9dc -> ad65bf9b51), ELPA Syncer, 2023/05/20
- [elpa] externals/calibre 41263e2820 08/11: Fix byte compiler warnings, ELPA Syncer, 2023/05/20
- [elpa] externals/calibre 436e70ac13 09/11: Fix docstring quoting, ELPA Syncer, 2023/05/20
- [elpa] externals/calibre ad65bf9b51 11/11: Bump package version to 1.3.3, ELPA Syncer, 2023/05/20
- [elpa] externals/calibre 3fa7d264da 03/11: Use constant instead of magic value, ELPA Syncer, 2023/05/20
- [elpa] externals/calibre e0f6e49316 04/11: Add missing search function to calibre-cli, ELPA Syncer, 2023/05/20
- [elpa] externals/calibre 67b7386841 07/11: Move functions from calibre-core to calibre-cli,
ELPA Syncer <=
- [elpa] externals/calibre 6ff78d6eca 05/11: Use correct author separator in calibre-cli, ELPA Syncer, 2023/05/20
- [elpa] externals/calibre 503e175c54 02/11: Document internal variables, ELPA Syncer, 2023/05/20
- [elpa] externals/calibre d7dd1f4d70 01/11: Fix copyright header, ELPA Syncer, 2023/05/20
- [elpa] externals/calibre 49f05eedc0 10/11: Remove second definition of calibre-series widget, ELPA Syncer, 2023/05/20
- [elpa] externals/calibre 472fb38333 06/11: Factor out JSON parsing in calibre-cli, ELPA Syncer, 2023/05/20