mirror of
https://github.com/jarun/nnn.git
synced 2024-11-24 11:51:27 +00:00
gutenread: support epub
This commit is contained in:
parent
6d7c25822a
commit
19ea710e08
|
@ -16,7 +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 |
|
| gutenread | sh | curl, unzip, w3m<br>[epr](https://github.com/wustho/epr) (optional)| 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)) |
|
||||||
|
@ -24,7 +24,7 @@ The currently available plugins are listed below.
|
||||||
| kdeconnect | sh | kdeconnect-cli | Send selected files to an Android device |
|
| kdeconnect | sh | kdeconnect-cli | Send selected files to an Android device |
|
||||||
| mediainf | sh | mediainfo | Show media information |
|
| mediainf | sh | mediainfo | Show media information |
|
||||||
| moclyrics | sh | [ddgr](https://github.com/jarun/ddgr), [moc](http://moc.daper.net/) | Show lyrics of the track playing in moc |
|
| moclyrics | sh | [ddgr](https://github.com/jarun/ddgr), [moc](http://moc.daper.net/) | Show lyrics of the track playing in moc |
|
||||||
| mocplay | sh | [moc](http://moc.daper.net/) | Appends (and plays, see script) selection/dir/file in moc|
|
| mocplay | sh | [moc](http://moc.daper.net/) | Append (and/or play) selection/dir/file in moc|
|
||||||
| ndiff | sh | vimdiff | Diff for selection (limited to 2 for directories) |
|
| ndiff | sh | vimdiff | Diff for selection (limited to 2 for directories) |
|
||||||
| nmount | sh | pmount, udisks2 | Toggle mount status of a device as normal user |
|
| nmount | sh | pmount, udisks2 | Toggle mount status of a device as normal user |
|
||||||
| notes | sh | - | Open a quick notes file/dir in `$EDITOR` |
|
| notes | sh | - | Open a quick notes file/dir in `$EDITOR` |
|
||||||
|
|
|
@ -6,11 +6,15 @@
|
||||||
# Details: Set the variable EBOOK_ID to download in html format and read in w3m.
|
# 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
|
# Clear EBOOK_ID to browse available ebooks by popularity and set it to
|
||||||
# the ID once you find an interesting one.
|
# the ID once you find an interesting one.
|
||||||
|
# To dowload and read in epub format set READER to an epub reader like
|
||||||
|
# epr: https://github.com/wustho/epr
|
||||||
#
|
#
|
||||||
# For example:
|
# More on EBOOK_ID:
|
||||||
# Wuthering Heights by Emily Brontë is at https://www.gutenberg.org/ebooks/768
|
# Wuthering Heights by Emily Brontë is at https://www.gutenberg.org/ebooks/768
|
||||||
# So EBOOK_ID would be 768
|
# So EBOOK_ID would be 768
|
||||||
#
|
#
|
||||||
|
# Downloaded ebooks are at ${XDG_CACHE_HOME:-$HOME/.cache}/nnn/gutenbooks/
|
||||||
|
#
|
||||||
# Shell: POSIX compliant
|
# Shell: POSIX compliant
|
||||||
# Author: Arun Prakash Jana
|
# Author: Arun Prakash Jana
|
||||||
|
|
||||||
|
@ -18,17 +22,27 @@ EBOOK_ID=
|
||||||
DIR=${XDG_CACHE_HOME:-$HOME/.cache}/nnn/gutenbooks/"$EBOOK_ID"
|
DIR=${XDG_CACHE_HOME:-$HOME/.cache}/nnn/gutenbooks/"$EBOOK_ID"
|
||||||
BROWSE_LINK="http://www.gutenberg.org/ebooks/search/?sort_order=downloads"
|
BROWSE_LINK="http://www.gutenberg.org/ebooks/search/?sort_order=downloads"
|
||||||
BROWSER=w3m
|
BROWSER=w3m
|
||||||
|
READER=
|
||||||
|
|
||||||
if [ ! -z "$EBOOK_ID" ]; then
|
if [ ! -z "$EBOOK_ID" ]; then
|
||||||
if [ ! -e $DIR ]; then
|
if [ ! -e $DIR ]; then
|
||||||
mkdir -p $DIR
|
mkdir -p $DIR
|
||||||
cd $DIR
|
cd $DIR
|
||||||
curl -L -O "https://www.gutenberg.org/files/"$EBOOK_ID"/"$EBOOK_ID"-h.zip"
|
|
||||||
unzip "$EBOOK_ID"-h.zip
|
if [ -z "$READER" ]; then
|
||||||
|
curl -L -O "https://www.gutenberg.org/files/"$EBOOK_ID"/"$EBOOK_ID"-h.zip"
|
||||||
|
unzip "$EBOOK_ID"-h.zip
|
||||||
|
else
|
||||||
|
curl -L -o "$EBOOK_ID".epub "http://www.gutenberg.org/ebooks/"$EBOOK_ID".epub.noimages"
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -d $DIR ]; then
|
if [ -d $DIR ]; then
|
||||||
"$BROWSER" $DIR/"$EBOOK_ID"-h/"$EBOOK_ID"-h.htm
|
if [ -z "$READER" ]; then
|
||||||
|
"$BROWSER" $DIR/"$EBOOK_ID"-h/"$EBOOK_ID"-h.htm
|
||||||
|
else
|
||||||
|
"$READER" $DIR/"$EBOOK_ID".epub
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
"$BROWSER" $BROWSE_LINK
|
"$BROWSER" $BROWSE_LINK
|
||||||
|
|
Loading…
Reference in a new issue