mirror of
https://github.com/jarun/nnn.git
synced 2024-11-24 11:51:27 +00:00
Plugin to browse, download, read from Project Gutenberg
This commit is contained in:
parent
262c94f696
commit
2f413f8059
|
@ -16,6 +16,7 @@ The currently available plugins are listed below.
|
||||||
| drop-file | sh | [dragon](https://github.com/mwh/dragon) | Drag and drop files into nnn |
|
| drop-file | sh | [dragon](https://github.com/mwh/dragon) | Drag and drop files into nnn |
|
||||||
| fzy-open | sh | fzy, xdg-open | Fuzzy find a file in dir subtree and edit or xdg-open |
|
| fzy-open | sh | fzy, xdg-open | Fuzzy find a file in dir subtree and edit or xdg-open |
|
||||||
| getplugs | sh | curl | Update plugins |
|
| getplugs | sh | curl | Update plugins |
|
||||||
|
| gutenread | sh | curl, unzip, w3m | Browse, download, read from Project Gutenberg |
|
||||||
| hexview | sh | xxd | View a file in hex in `$PAGER` |
|
| hexview | sh | xxd | View a file in hex in `$PAGER` |
|
||||||
| imgresize | sh | [imgp](https://github.com/jarun/imgp) | Resize images in dir to screen resolution |
|
| imgresize | sh | [imgp](https://github.com/jarun/imgp) | Resize images in dir to screen resolution |
|
||||||
| imgur | bash | - | Upload an image to imgur (from [imgur-screenshot](https://github.com/jomo/imgur-screenshot)) |
|
| imgur | bash | - | Upload an image to imgur (from [imgur-screenshot](https://github.com/jomo/imgur-screenshot)) |
|
||||||
|
|
35
plugins/gutenread
Executable file
35
plugins/gutenread
Executable file
|
@ -0,0 +1,35 @@
|
||||||
|
#!/usr/bin/env sh
|
||||||
|
|
||||||
|
# Description: Browse Project Gutenberg catalogue by popularity, then download
|
||||||
|
# and read a book of your choice.
|
||||||
|
#
|
||||||
|
# Details: Set the variable EBOOK_ID to download in html format and read in w3m.
|
||||||
|
# Clear EBOOK_ID to browse available ebooks by popularity and set it to
|
||||||
|
# the ID once you find an interesting one.
|
||||||
|
#
|
||||||
|
# For example:
|
||||||
|
# Wuthering Heights by Emily Brontë is at https://www.gutenberg.org/ebooks/768
|
||||||
|
# So EBOOK_ID would be 768
|
||||||
|
#
|
||||||
|
# Shell: POSIX compliant
|
||||||
|
# Author: Arun Prakash Jana
|
||||||
|
|
||||||
|
EBOOK_ID=
|
||||||
|
DIR=${XDG_CACHE_HOME:-$HOME/.cache}/nnn/gutenbooks/"$EBOOK_ID"
|
||||||
|
BROWSE_LINK="http://www.gutenberg.org/ebooks/search/?sort_order=downloads"
|
||||||
|
BROWSER=w3m
|
||||||
|
|
||||||
|
if [ ! -z "$EBOOK_ID" ]; then
|
||||||
|
if [ ! -e $DIR ]; then
|
||||||
|
mkdir -p $DIR
|
||||||
|
cd $DIR
|
||||||
|
curl -L -O "https://www.gutenberg.org/files/"$EBOOK_ID"/"$EBOOK_ID"-h.zip"
|
||||||
|
unzip "$EBOOK_ID"-h.zip
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ -d $DIR ]; then
|
||||||
|
"$BROWSER" $DIR/"$EBOOK_ID"-h/"$EBOOK_ID"-h.htm
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
"$BROWSER" $BROWSE_LINK
|
||||||
|
fi
|
Loading…
Reference in a new issue