Skip to content

Commit

Permalink
Add a few settings to the article fetcher
Browse files Browse the repository at this point in the history
  • Loading branch information
baskerville committed Jan 6, 2021
1 parent 7c5c4f9 commit 4315c4a
Show file tree
Hide file tree
Showing 9 changed files with 302 additions and 67 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ Any 4.*X*.*Y* firmware, with *X* ≥ 6, will do.
- Adjust the contrast.
- Define words using *dictd* dictionaries.
- Annotations, highlights and bookmarks.
- Retrieve articles from online sources through [hooks](doc/HOOKS.md).
- Retrieve articles from online sources through [hooks](doc/HOOKS.md) (an example *wallabag* [article fetcher](doc/ARTICLE_FETCHER.md) is provided).

[![Tn01](artworks/thumbnail01.png)](artworks/screenshot01.png) [![Tn02](artworks/thumbnail02.png)](artworks/screenshot02.png) [![Tn03](artworks/thumbnail03.png)](artworks/screenshot03.png) [![Tn04](artworks/thumbnail04.png)](artworks/screenshot04.png)

Expand Down
15 changes: 15 additions & 0 deletions doc/ARTICLE_FETCHER.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
A *wallabag* article fetcher is distributed in the release archive, in `bin/article_fetcher`.

## Configuration

Rename `Settings-sample.toml` to `Settings.toml` and fill it out.

The fetcher manages a `.session.json` file that you shouldn't modify or remove.

## Usage

In the library menu:
- Select *Library → On Board*.
- Select *Toggle Select → Articles* (the downloaded articles are saved in the hook's *path*).

If the *Toggle Select* sub-menu is missing, [add the relevant hook](HOOKS.md).
18 changes: 11 additions & 7 deletions doc/HOOKS.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,15 @@ The above chunk needs to be added after one of the `[[libraries]]` section.

`path` is the path of the directory that will trigger the hook. `program` is
the path to the executable associated with this hook. The `sort-method`,
`first-column` and `second-column` keys are optional.
`first-column` and `second-column` keys are optional. When specified, they will
override the *home*'s settings of the same name, while `path` is being
selected.

The *Toogle Select* sub-menu of the library menu can be used to trigger a hook
when there's no imported documents in `path`. Otherwise, you can just tap the
directory in the navigation bar. When the hook is triggered, the associated
`program` is spawned. It will receive the directory path, wifi and online
statuses (*true* or *false*) as arguments.
`program` is executed as a background process. It will receive the directory
path, wifi and online statuses (*true* or *false*) as arguments.

A fetcher can use its standard output (resp. standard input) to send events to
(resp. receive events from) *Plato*. An event is a JSON object with a required
Expand All @@ -37,8 +39,8 @@ The events that can be written to standard output are:
{"type": "addDocument", "info": OBJECT}
// Enable or disable the WiFi.
{"type": "setWifi", "enable": BOOL}
// Search for books inside `path` matching `query`.
{"type": "search", "path": STRING, "query": STRING}
// Search for books inside `path` matching `query` and sort the results by `sortBy`.
{"type": "search", "path": STRING, "query": STRING, "sortBy": [STRING, BOOL]}
// Import new entries and update existing entries in the current library.
{"type": "import"}
// Remove entries with dangling paths from the current library.
Expand All @@ -48,8 +50,10 @@ The events that can be written to standard output are:
The events that can be read from standard input are:

```
// Sent in response to `search`. `results` is an array of *Info* objects.
{"type": "search": "results": ARRAY}
// Sent in response to `search`. `path` is the path of the library
// that was searched for. `results` is an array of *Info* objects.
{"type": "search": "path": STRING, "results": ARRAY}
// Sent to all the fetchers when the network becomes available.
{"type": "network", "status": "up"}
```
Expand Down
2 changes: 2 additions & 0 deletions doc/MANUAL.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,8 @@ An exclamation mark can be prepended to a state selector's letter to invert its
- *F*: finished.
- *A*: has annotations.
- *B*: has bookmarks.
- *O*: opened after the given date and time.
- *D*: added after the given date and time.

## Bottom bar

Expand Down
Loading

0 comments on commit 4315c4a

Please sign in to comment.