Skip to content

Latest commit

 

History

History

script

Example scripts using hoardy

This directory contains a bunch of example scripts built on top of hoardy-web.

./hoardy-web-xdg-open --help
usage: ./hoardy-web-xdg-open [--help] WRR_FILE

Open `response.body` of the given WRR file with `xdg-open`.

This script only works for Debian's `xdg-open`, which waits for the child process to finish.

# Options:

  --help                print this message and exit

# Example:

  ./hoardy-web-xdg-open path/to/wrr/file.wrr
./hoardy-web-xdg-open-mimi --help
usage: ./hoardy-web-xdg-open-mimi [--help] WRR_FILE

Open `response.body` of the given WRR file using Mimi's `xdg-open`.

This will also work for other similar `xdg-open` scripts that do not wait for their child process to finish unless you specify `--wait`.

# Options:

  --help                print this message and exit

# Example:

  ./hoardy-web-xdg-open-mimi path/to/wrr/file.wrr
./hoardy-web-view-w3m --help
usage: ./hoardy-web-view-w3m [--help] WRR_FILE

Generate a plain text preview of a WRR file containing an HTML document using `w3m`.

# Options:

  --help                print this message and exit

  --raw-url             print the raw URL stored in the WRR_FILE
  --net-url             format the URL using on-the-wire representation
  --pretty-url          format the URL prettily; default
  --normalized-url      normalize the URL removing empty query parameters, and then format the URL prettily

# Example:

  ./hoardy-web-view-w3m path/to/wrr/file/containing/html.wrr
./hoardy-web-view-pandoc --help
usage: ./hoardy-web-view-pandoc [--help] WRR_FILE

Generate a plain text preview of a WRR file containing an HTML document using `pandoc`.

# Options:

  --help                print this message and exit

  --raw-url             print the raw URL stored in the WRR_FILE
  --net-url             format the URL using on-the-wire representation
  --pretty-url          format the URL prettily; default
  --normalized-url      normalize the URL removing empty query parameters, and then format the URL prettily

  -t FORMAT, --to FORMAT
                        `pandoc` output format: default: `plain`

# Example:

  ./hoardy-web-view-pandoc path/to/wrr/file/containing/html.wrr
./hoardy-web-spd-say --help
usage: ./hoardy-web-spd-say [--help] [--dry-run] [-s pattern] [-e pattern] [WRRFILE ...]

Feed (a part of) an HTML document containted in a given WRR file to a text-to-speech (TTS) engine.

This depends on `pandoc`, `sed`, and `spd-say` of `speech-dispatcher`.

The latter of which is a speech server that provides a single common API for whole lot of different TTS engines.
Configuring your `speech-dispatcher` is out of scope of this script, look it up elsewhere.

# Options:

  --help                print this message and exit

  -s PATTER, --start PATTERN
                        start speaking starting from this PATTERN

  -e PATTER, --end PATTERN
                        stop speaking at this PATTERN

  --dry-run             just print the text that would be fed to the TTS to
                        stdout, without actually running `spd-say`

# Note:

`--start` and `--end` run `sed -n "$start,$ p"` and similar commands internally.
Which is why see `man 1 sed` for more info about PATTERN syntax.

# Examples:

- Feed the whole document to the TTS:

  ./hoardy-web-spd-say path/to/wrr/file/containing/html.wrr

- Skip first 5 lines, then feed the next 100 lines to the TTS:

  ./hoardy-web-spd-say -s 5 -e +100 path/to/wrr/file/containing/html.wrr

- Start speaking aloud starting from the first `<hr>` element:

  ./hoardy-web-spd-say -s "/^-----/" path/to/wrr/file/containing/html.wrr

- Feed everything between the first two `<hr>` elements to the TTS:

  ./hoardy-web-spd-say -s "/^-----/" -e "/^-----/" path/to/wrr/file/containing/html.wrr

- Feed everything between the first "Chapter" header and the following "Next Chapter" link to the TTS:

  ./hoardy-web-spd-say -s "/^Chapter [0-9]/" -e "/^Next Chapter/" path/to/wrr/file/containing/html.wrr