Recently Written · git

librivox

Automated youtube uploading of audiobooks

git clone https://github.com/equwal/librivox

Log | Files | Refs


commit ef40c7852fe06374c3642efe4f9645814da85973
Spenser Truex <struex0@gmail.com>
2018-08-02 12:44:04 -0700

Latest loadable system.

 packages.lisp       |  4 +++-
 src/bash.lisp       |  4 ++--
 src/html-parse.lisp |  7 ++++++-
 src/librivox.lisp   | 18 +++++++++++++-----
 4 files changed, 24 insertions(+), 9 deletions(-)
diff --git a/packages.lisp b/packages.lisp
index 4ade801..9f19bf4 100644
--- a/packages.lisp
+++ b/packages.lisp
@@ -4,7 +4,8 @@
 (defpackage :html-parser
   (:use :cl :cl-ppcre :utils)
   (:import-from :cl-ppcre :scan-to-strings)
-  (:import-from :utils :dbind :mvbind))
+  (:import-from :utils :dbind :mvbind)
+  (:export :html->lispy))
 (defpackage :bash
   (:use :cl :uiop)
   (:export :run-line
@@ -48,6 +49,7 @@
   (:import-from :rss :parse-feed
 		:update
 		:update!)
+  (:import-from :html-parser :html->lispy)
   (:import-from :utils :nth-digit)
   (:import-from :bash :run-line :*bash-output*)
   (:import-from :bordeaux-threads
diff --git a/src/bash.lisp b/src/bash.lisp
index e79549e..6173a89 100644
--- a/src/bash.lisp
+++ b/src/bash.lisp
@@ -1,4 +1,4 @@
 (in-package :bash)
 (defvar *bash-output* *debug-io*)
-(defun run-line (code-string &key (output t))
-  (run-program code-string :output output))
+(defun run-line (code-string &key (output t) ignore-error-status)
+  (run-program code-string :output output :ignore-error-status t))
diff --git a/src/html-parse.lisp b/src/html-parse.lisp
index 12e117e..2420a04 100644
--- a/src/html-parse.lisp
+++ b/src/html-parse.lisp
@@ -22,7 +22,11 @@
   (cons left right))
 (defun make-tree (node1 node2)
   (cons node1 node2))
-
+(defun get-tree (id tree &optional (test #'equal))
+  (if (null tree) nil
+      (if (funcall test id (caar tree))
+	  (car tree)
+	  (get-tree id (cdr tree) test))))
 (defun make-datum (id text)
   (make-node id text))
 (defun html->lispy (html-string)
@@ -35,3 +39,4 @@
 								   :inside t)))
 		       (html->lispy (content-of tag-of html-string :after t)))
 	    html-string))))
+
diff --git a/src/librivox.lisp b/src/librivox.lisp
index 52529b1..d8f609c 100644
--- a/src/librivox.lisp
+++ b/src/librivox.lisp
@@ -5,8 +5,16 @@
 	      #- multithreading 1)
 (defvar *url* "https://librivox.org/rss/latest_releases")
 
-(if (= 1 *max-threads*)
-    ;; No multithreading: One book at a time.
-    (parse-feed (http-request *url*))
-    ;; Multithreading: One thread per book method.
-    ())
+(defun main-loop ()
+    (if (= 1 *max-threads*)
+	;; No multithreading: One book at a time.
+	(parse-feed (http-request *url*))
+	;; Multithreading: One thread per book method.
+	()))
+(defun rate (specification actual &optional (test #'eql))
+  (if (or (null specification) (null actual))
+      0
+      (if (and (consp (car specification)) (consp (car actual)))
+	  (rate (car specification) (car actual) test)
+	  (+ (if (funcall test (car specification) (car actual)) 1 0)
+	     (rate (cdr specification) (cdr actual) test)))))