[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] externals/greader 5964436 35/76: first functional version of grea
From: |
Stefan Monnier |
Subject: |
[elpa] externals/greader 5964436 35/76: first functional version of greader with back-ends! |
Date: |
Fri, 8 Feb 2019 15:26:52 -0500 (EST) |
branch: externals/greader
commit 59644364996181f50bb45667415dc2871bd42987
Author: Michelangelo Rodriguez <address@hidden>
Commit: Michelangelo Rodriguez <address@hidden>
first functional version of greader with back-ends!
---
.gitignore | 4 +++-
greader-espeak.el | 5 ++---
greader-speechd.el | 14 +++++++-------
greader.el | 48 ++++++++++++++++++++++++++++++++----------------
greader.elc | Bin 22659 -> 22675 bytes
5 files changed, 44 insertions(+), 27 deletions(-)
diff --git a/.gitignore b/.gitignore
index d7ebb35..3caabf1 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,2 +1,4 @@
-greader-espeak.el~
\ No newline at end of file
+greader-espeak.el~
+greader-speechd.elc
+greader-speechd.el~
\ No newline at end of file
diff --git a/greader-espeak.el b/greader-espeak.el
index 46daac0..55719d8 100644
--- a/greader-espeak.el
+++ b/greader-espeak.el
@@ -51,9 +51,8 @@ this variable determines authomatically if espeak is present
in your PATH enviro
(&optional lang)
"returns the appropriate string to pass to espeak in order to set the
language appropriately"
(if (not lang)
-
- (concat "-V " greader-espeak-language)
- (concat "-V " lang)))
+ (concat "-v" greader-espeak-language)
+ (concat "-v " lang)))
(defun greader-espeak--find-executable
()
"tries to find espeak executable in PATH.
diff --git a/greader-speechd.el b/greader-speechd.el
index a605fd2..230c879 100644
--- a/greader-speechd.el
+++ b/greader-speechd.el
@@ -51,8 +51,8 @@ none, some, or all."
"sets language 'lang' for speech-dispatcher client.
if lang is omitted, it looks in variable greader-speechd-language and
retrieves the appropriate string used by spd-say or another client compatible."
(if (not lang)
- (concat "-l " greader-speechd-language)
- (concat "-l " lang)))
+ (concat "-l" greader-speechd-language)
+ (concat "-l" lang)))
(defun greader-speechd-set-rate
(&optional rate)
@@ -68,15 +68,15 @@ punct must be a numeric value, 0 for no punctuation, 1 for
some and 2 or >2 for
(cond
((booleanp punct)
(if punct
- (throw 'return (concat "-m all"))
- (throw 'return (concat "-m none"))))
+ (throw 'return (concat "-mall"))
+ (throw 'return (concat "-mnone"))))
((numberp punct)
(if (= punct 0)
- (throw 'return (concat "-m none")))
+ (throw 'return (concat "-mnone")))
(if (= punct 1)
- (throw 'return (concat "-m some")))
+ (throw 'return (concat "-msome")))
(if (>= punct 2)
- (throw 'return (concat "-m all")))))))
+ (throw 'return (concat "-mall")))))))
(defun greader-speechd-stop ()
"stops speech-dispatcher client."
(start-process "speechd-client" nil greader-speechd-executable-path "-S"))
diff --git a/greader.el b/greader.el
index 4c34770..1184f20 100644
--- a/greader.el
+++ b/greader.el
@@ -1,5 +1,5 @@
;;; greader.el --- gnamù reader, a reader with espeak tts -*-
lexical-binding: t; -*-
-
+;Copyright (C) 2019 by Michelangelo Rodriguez
;; Copyright (C) 2017 Michelangelo Rodriguez
;; package-requires: ((emacs "25"))
;; Author: Michelangelo Rodriguez <address@hidden>
@@ -53,6 +53,13 @@
(defvar greader-backend-action 'greader-default-action)
(defvar greader-status 'paused)
(defvar greader-synth-process nil)
+(defun greader-load-backends ()
+ "loads backends taken from greader-backends."
+ (mapcar require greader-backends))
+(defun greader-call-backend (command &optional arg &rest ignore)
+ (if arg
+ (funcall greader-actual-backend command arg)
+ (funcall greader-actual-backend command)))
(defgroup
greader
@@ -145,13 +152,9 @@ the variable `greader-move-to-next-chung' must be set to a
function that moves t
For example, if you specify a function that gets a sentence, you should
specify a function that moves to the next one."
:type 'function
:tag "greader get chung of text function")
-(defcustom
+(defvar
greader-backend-filename
- "/usr/bin/espeak"
- "file name of the command for speech-dispatcher client.
-The program you specify must accept same arguments of spd-say program."
- :tag "speech-dispatcher client file name"
- :type 'file)
+ (greader-call-backend 'executable))
(defcustom
greader-rate
@@ -230,7 +233,7 @@ The program you specify must accept same arguments of
spd-say program."
(setq txt text)
(setq backend (append greader-backend `(,txt) backend))
(and (stringp txt) (setq-local greader-synth-process (make-process
- :name "spd-say"
+ :name
"greader-backend"
:sentinel
'greader-action
:filter
'greader-process-filter
:command backend)))
@@ -259,6 +262,11 @@ The program you specify must accept same arguments of
spd-say program."
(defun greader-tts-stop ()
(set-process-sentinel greader-synth-process 'greader-default-action)
+ (if
+ (not
+ (eq
+ (greader-call-backend 'stop) 'not-implemented))
+ (greader-call-backend 'stop))
(delete-process greader-synth-process)
(setq-local greader-backend-action 'greader-default-action))
@@ -277,20 +285,28 @@ The program you specify must accept same arguments of
spd-say program."
(greader-reset)
(let (args arg)
(setq arg
- (concat "-s" (number-to-string greader-rate)))
+ (greader-call-backend 'rate))
(setq args (append `(,arg) args))
-
- (cond (greader-language
+ (cond ((greader-call-backend 'lang)
(setq arg
- (concat "-v" greader-language))
+ (greader-call-backend 'lang))
(setq args (append `(,arg) args))))
- (cond (greader-punctuation
- (setq arg "--punct")
+ (cond ((greader-call-backend 'punctuation)
+ (setq arg (greader-call-backend 'punctuation))
(setq args (append `(,arg) args))))
- (setq greader-backend (append greader-backend args))))
+ (setq greader-backend (greader-call-backend 'executable))
+ (cond
+ (
+ (not
+ (eq
+ (greader-call-backend 'extra)
+ 'not-implemented))
+ (setq arg (greader-call-backend 'extra))
+ (setq args (append `(,arg) args))))
+ (setq greader-backend (append `(,greader-backend) args))))
(defun greader-reset ()
- (setq greader-backend `(,greader-backend-filename)))
+ (setq greader-backend `(,(greader-call-backend 'executable))))
(defun greader-next-action (process event)
(if greader-debug
(greader-debug (format "greader-next-action: %s" event)))
diff --git a/greader.elc b/greader.elc
index b4ef323..a2c65cc 100644
Binary files a/greader.elc and b/greader.elc differ
- [elpa] externals/greader 4b5bfb6 33/76: greader.el:, (continued)
- [elpa] externals/greader 4b5bfb6 33/76: greader.el:, Stefan Monnier, 2019/02/08
- [elpa] externals/greader cf490a5 31/76: function greader-speechd--find-executable not used for now, in any case we keep it in source for now., Stefan Monnier, 2019/02/08
- [elpa] externals/greader a79c95d 29/76: greader-speechd.el:, Stefan Monnier, 2019/02/08
- [elpa] externals/greader 7d01a11 30/76: Cleanup and bug corrections., Stefan Monnier, 2019/02/08
- [elpa] externals/greader 8076fb8 32/76: greader-espeak.el:, Stefan Monnier, 2019/02/08
- [elpa] externals/greader 365ecb6 41/76: greader-speechd.el:, Stefan Monnier, 2019/02/08
- [elpa] externals/greader 5084a46 40/76: greader.el:, Stefan Monnier, 2019/02/08
- [elpa] externals/greader 0c06007 36/76: greader-speechd.el:, Stefan Monnier, 2019/02/08
- [elpa] externals/greader 081c7c4 34/76: greader-speechd.el:, Stefan Monnier, 2019/02/08
- [elpa] externals/greader 5af124e 37/76: greader-espeak.el:, Stefan Monnier, 2019/02/08
- [elpa] externals/greader 5964436 35/76: first functional version of greader with back-ends!,
Stefan Monnier <=
- [elpa] externals/greader 5a4b548 39/76: greader-espeak.el: greader-backend-name property added to greader-espeak., Stefan Monnier, 2019/02/08
- [elpa] externals/greader 9dcdc83 38/76: bugfixes, Stefan Monnier, 2019/02/08
- [elpa] externals/greader b2cc418 42/76: greader-espeak.el:, Stefan Monnier, 2019/02/08
- [elpa] externals/greader c8f9e74 50/76: greader-pkg.el added., Stefan Monnier, 2019/02/08
- [elpa] externals/greader 43d18b9 47/76: backup files added to .gitignore., Stefan Monnier, 2019/02/08
- [elpa] externals/greader 3efc0a8 51/76: updated commentary., Stefan Monnier, 2019/02/08
- [elpa] externals/greader 0fc03d5 52/76: greader.elc removed., Stefan Monnier, 2019/02/08
- [elpa] externals/greader ed45417 45/76: functions to handle punctuation rewritten to reflect new back-end architecture., Stefan Monnier, 2019/02/08
- [elpa] externals/greader a325ef4 54/76: Adding autoloads., Stefan Monnier, 2019/02/08
- [elpa] externals/greader 083f14b 43/76: greader.el:, Stefan Monnier, 2019/02/08