gutendex: read a book aloud over a voice front end
read_book now checks the local library first: a book already saved (matched by Project Gutenberg id, or by the name in the request) is read from disk with no network at all, and a book resolved from the catalog is reused from disk rather than re-downloaded. When the request arrives from a front end that can stream a read-aloud (the local voice gateway, or an LXMF/Sideband voice chat), the saved text is handed to the scheduler's speech channel (ctx.speech) instead of being summarised: the gateway streams it through Piper a chunk at a time until the user stops it, and the position is kept in a bookmarks.json beside the saved books so a later request resumes where the listener stopped. A text front end keeps the saved-file summary, and the skill reports honestly when a book has no plain text to read. The skill asks ctx.speech.supports(source) on both the saved-library and the fresh-download paths; the manifest/README describe the read-aloud and the library-first behaviour.
This commit is contained in:
1 parent
52346baf52
commit
530e9968a4
4 files changed
+477
-58
No files matched your search
@@ -7,7 +7,17 @@ for the [Gutendex](https://gutendex.com/) catalog of
|
||||
- **`gutendex.find_books`** — find public-domain books by **author**, **title**,
|
||||
or **genre** (author/title use Gutendex `search`; genre uses `topic`).
|
||||
- **`gutendex.read_book`** — resolve a book by name or Project Gutenberg id and
|
||||
download its **full plain text**, saving it to a `.txt` file.
|
||||
read it. It checks the **local library first** (the books folder): a book
|
||||
already saved — matched by id, or by the name in the request — is read from
|
||||
disk with no network at all, and a book resolved from the catalog is reused
|
||||
from disk rather than downloaded again. A book not in the library is
|
||||
downloaded and saved as a `.txt` file. Over a **voice front end** (the local
|
||||
voice gateway, or an LXMF/Sideband voice chat) it instead **reads the book
|
||||
aloud**: the text is streamed through Piper one chunk at a time until the user
|
||||
says "stop", and the position is kept in a `bookmarks.json` beside the saved
|
||||
books so a later request **resumes** where the listener stopped. A book is far
|
||||
too long to speak as a chat reply, so over a text front end it is saved to a
|
||||
file and summarised.
|
||||
|
||||
Gutendex is a free public JSON API. This pack needs **no account, no
|
||||
credentials, and no bridge** — the skill bodies make the HTTP requests directly
|
||||
|
||||
Reference in new issue
Block a user