1
0
Fork 0

- used 'gpub' as file extension for generated gempub files.

This commit is contained in:
cage 2024-09-18 20:36:05 +02:00
parent 2dfdf804a4
commit f6f3428dbb
4 changed files with 11 additions and 3 deletions

View File

@ -71,6 +71,8 @@
(define-constant +metadata-entry-name+ "metadata.txt" :test #'string=) (define-constant +metadata-entry-name+ "metadata.txt" :test #'string=)
(define-constant +gempub-file-extension+ "gpub" :test #'string=)
(defun extract-metadata (zip-file) (defun extract-metadata (zip-file)
(when (gempub:gempub-file-p zip-file :ignore-errors t) (when (gempub:gempub-file-p zip-file :ignore-errors t)
(let ((entries (zip-info:list-entries zip-file))) (let ((entries (zip-info:list-entries zip-file)))

View File

@ -181,7 +181,9 @@
license license
copyright copyright
cover-filename)) cover-filename))
(os-utils:zip-directory gemtext-directory :flat t))) (os-utils:zip-directory gemtext-directory
:extension gempub:+gempub-file-extension+
:flat t)))
(defun create-gempub (gemtext-dir) (defun create-gempub (gemtext-dir)
(gui:with-modal-toplevel (toplevel :title (_ "Add Metadata")) (gui:with-modal-toplevel (toplevel :title (_ "Add Metadata"))

View File

@ -319,13 +319,16 @@ numerical user ID, as an assoc-list."
(when (not (process-exit-success-p process)) (when (not (process-exit-success-p process))
(error (format nil (_ "File ~s extraction from ~s failed") file-entry zip-file)))))) (error (format nil (_ "File ~s extraction from ~s failed") file-entry zip-file))))))
(defun zip-directory (dir &key (flat nil)) (defun zip-directory (dir &key (extension nil) (flat nil))
(with-output-to-string (stream) (with-output-to-string (stream)
(let* ((process (run-external-program +zip-bin+ (let* ((process (run-external-program +zip-bin+
(append (when flat (append (when flat
(list "-j")) (list "-j"))
(list "-r" (list "-r"
dir (format nil
"~a~@[.~a~]"
dir
extension)
dir)) dir))
:search t :search t
:wait t :wait t

View File

@ -2946,6 +2946,7 @@
(:shadowing-import-from :misc :random-elt :shuffle) (:shadowing-import-from :misc :random-elt :shuffle)
(:export (:export
:+metadata-entry-name+ :+metadata-entry-name+
:+gempub-file-extension+
:gempub-file-p :gempub-file-p
:extract-metadata :extract-metadata
:sync-library :sync-library