My build of nnn with minor changes
Du kannst nicht mehr als 25 Themen auswählen Themen müssen entweder mit einem Buchstaben oder einer Ziffer beginnen. Sie können Bindestriche („-“) enthalten und bis zu 35 Zeichen lang sein.
 
 
 
 
 
 

50 Zeilen
1.5 KiB

  1. #!/usr/bin/env sh
  2. # Description: Browse Project Gutenberg catalogue by popularity, then download
  3. # and read a book of your choice.
  4. #
  5. # Details: Set the variable EBOOK_ID to download in html format and read in w3m.
  6. # Clear EBOOK_ID to browse available ebooks by popularity and set it to
  7. # the ID once you find an interesting one.
  8. # To dowload and read in epub format set READER to an epub reader like
  9. # epr: https://github.com/wustho/epr
  10. #
  11. # More on EBOOK_ID:
  12. # Wuthering Heights by Emily Brontë is at https://www.gutenberg.org/ebooks/768
  13. # So EBOOK_ID would be 768
  14. #
  15. # Downloaded ebooks are at ${XDG_CACHE_HOME:-$HOME/.cache}/nnn/gutenbooks/
  16. #
  17. # Shell: POSIX compliant
  18. # Author: Arun Prakash Jana
  19. EBOOK_ID=
  20. DIR=${XDG_CACHE_HOME:-$HOME/.cache}/nnn/gutenbooks/"$EBOOK_ID"
  21. BROWSE_LINK="http://www.gutenberg.org/ebooks/search/?sort_order=downloads"
  22. BROWSER=w3m
  23. READER=
  24. if [ ! -z "$EBOOK_ID" ]; then
  25. if [ ! -e $DIR ]; then
  26. mkdir -p $DIR
  27. cd $DIR
  28. if [ -z "$READER" ]; then
  29. curl -L -O "https://www.gutenberg.org/files/"$EBOOK_ID"/"$EBOOK_ID"-h.zip"
  30. unzip "$EBOOK_ID"-h.zip
  31. else
  32. curl -L -o "$EBOOK_ID".epub "http://www.gutenberg.org/ebooks/"$EBOOK_ID".epub.noimages"
  33. fi
  34. fi
  35. if [ -d $DIR ]; then
  36. if [ -z "$READER" ]; then
  37. "$BROWSER" $DIR/"$EBOOK_ID"-h/"$EBOOK_ID"-h.htm
  38. else
  39. "$READER" $DIR/"$EBOOK_ID".epub
  40. fi
  41. fi
  42. else
  43. "$BROWSER" $BROWSE_LINK
  44. fi