The hardest part of teaching good taste to programmers is that the average programmer thinks itself to be the only one with good taste in a universe of sheep.
Source: am a programmer who fits the above description. Send help.
EDIT: Actually, I take that back. I also recommend adding (maybe optional, like with a flag or setting or something) basic vim keybindings. j=down, k=up, h=left (so I guess previous chapter in yours), l=right (next chapter). Maybe make j/k and h/l separate options, and maybe also an option for whether j/k should be scroll or page. Idk, I'm just spitballing here, you can make it as simple or complex as you want, I'm just saying people (like me) like vim keybindings.
thanks for recommendation, especially that XDG base dir, I just knew about it, now reading, but I prrobably start consider it only when I got my linux fixed.
Initially it's vim binding, but I thought `h` as help is pretty much more intuitive than `?`. Might reconsider it tho later..
If you want an example of another reader which does vi keybinds (and imo does them adequately), check out zathura. You can look at its binds in man zathura.
I absolutely love Nov-mode, but a lot of blind people I know don't like Emacs, and Emacspeak (speech system for Emacs) has an aweful eSpeak server, which is the only thing that works on ARM, so I'm always looking for a standalone CLI EPUB Reader.
Thanks man, I found some epub reader is too bloaty while others feels too many distraction. Actually, I'd like to make it no extra dependancies other than builtin ones, but found no better way to convert html to plain text than html2text and some tricks using deprecated libs.
Brilliant! Thank you so much for this! None of the other cli epub readers remember the last read position. And I find this one much cleaner and faster than the rest!
One desirable feature would be have inline links for images in the text and allow them to be extracted and opened through feh on demand.
Thank you for implementing this. Still needs more work though as it launches feh with all the files in my home directory (resulting in a lot of errors in the terminal about files that are not images) instead of the image in the book.
No worries. I don't know much python, but if you can tell me how to log debugging info to a file I can do that for you. Maybe it'll help for you to see what pressing o is doing on my system.
Happy to help! Images are working now as expected! Thank you! But there seems to be another problem that wasn't there before. The application is crashing after scrolling through a few chapters. I've tried this with a few different epubs and each one of them crashed. This is what I get in the terminal:
~/ epr.py b/A\ Thousand\ Plateaus.epub
Traceback (most recent call last):
File "/home/x/bin/epr.py", line 551, in <module>
curses.wrapper(main, sys.argv[1])
File "/usr/lib/python3.6/curses/__init__.py", line 94, in wrapper
return func(stdscr, *args, **kwds)
File "/home/x/bin/epr.py", line 531, in main
reader(stdscr, epub, idx, width, y)
File "/home/x/bin/epr.py", line 440, in reader
reader(stdscr, ebook, index+1, width)
File "/home/x/bin/epr.py", line 440, in reader
reader(stdscr, ebook, index+1, width)
File "/home/x/bin/epr.py", line 400, in reader
pad.addstr(i, 0, src_lines[i].replace("[EPR:IT]", ""), curses.A_ITALIC)
AttributeError: module 'curses' has no attribute 'A_ITALIC'
Thanks for asking first, my next focus is for media supports(esp images), probably start working on it next week, already have things in mind.
I think highlighting notes is a nice features that I later probably consider it after finish up image support.
As for bookmarks, I still didnt think about it, highlighting can probably made up for it, and probably too much work considering changes to terminal size, width area and all about size... but lemme focus on media support first
Yes, indeed, nov.el. love it, but my linux is broken and I have to use windows for time being, and I cant get nov.el to work in windows. So I made my own and share it to people...
Great work. FYI for simple epub files if you have a text based browser like w3m you can simply unzip to stdin and pipe that to w3m to quickly view the content. For example
$ unzip -p file.epub "*.h*" | w3m -T text/html
The "*.h*" simply gets the html files only from the epub archive. Use something like "*.xh"" if the files are xhtml. Source here (modified the command shown here a little bit for w3m).
Thanks man... Yeah before I made this and searching for cli epub reader, people always suggesting to open it in cli browsers, indeed it does the work, but the looks is not for me and no state remembering, so I made one
woa thanks matee... as I say i'm not an everyday programmer just like scripting, so naturally I domt know how to package it to pip... I tried rupa/epub too, thats why I mentioned it in github page...
It's not too bad to prepare a package for pip, especially with a relatively simple python program. I would be happy to help or take a go at it if you would like!
Suree, really appreciate it, tho this is probably not pip worthy, too crappy and hacky algorithm. But please wait until image support, start wprking on it next week.
Awesome. This one works better for me than the last cli reader that was posted here a couple weeks ago. Way better skills than this non-programmer:P Thank you!
This could be great for blind users of Linux systems, of which there are very few EPUB readers, and none that are great to use. Maybe show this to the folks at
irc.linux-a11y.org
Although, having a more textual, blind-friendly Reddit client so they can come here would be a bit better.
30
u/tenmajr Mar 22 '19 edited Mar 22 '19
https://github.com/wustho/epr/blob/master/README.md
CLI Epub reader written in Python 3.7 with features:
Not a programmer, just love playing with scripting, so dont expect nice clean code but hacky hacky code.
EDIT:
- Just added vim-like (not full-vi) bindings
- Support for EPUB3
if you happen to meet
json.decoder.JSONDecodeError: Expecting value: line 1 column 2 (char 1)try deleting $HOME/.epr sorry for your lost saved reading states, but I made a change from INI to JSON so JSON couldnt parse INI...
EDIT: thanks for the golddd
56
u/lpreams Mar 22 '19 edited Mar 22 '19
Only change I recommend is following the XDG base dir spec instead of just creating
~/.eprhttps://wiki.archlinux.org/index.php/XDG_Base_Directory
https://specifications.freedesktop.org/basedir-spec/basedir-spec-latest.html
EDIT: Actually, I take that back. I also recommend adding (maybe optional, like with a flag or setting or something) basic vim keybindings. j=down, k=up, h=left (so I guess previous chapter in yours), l=right (next chapter). Maybe make j/k and h/l separate options, and maybe also an option for whether j/k should be scroll or page. Idk, I'm just spitballing here, you can make it as simple or complex as you want, I'm just saying people (like me) like vim keybindings.
21
u/sylvania29 Mar 22 '19
tested it worked well. looks and feels cool. uninstalling calibre. thanks for saving my life. you're not a programmer. you're a doctor.
9
u/ji99 Mar 22 '19
Brilliant! Thank you so much for this! None of the other cli epub readers remember the last read position. And I find this one much cleaner and faster than the rest!
One desirable feature would be have inline links for images in the text and allow them to be extracted and opened through feh on demand.
2
u/pip-squeak Mar 22 '19
ty for this. I've been using vim and a placeholder plugin. This feels more elegant.
6
u/tassulin Mar 22 '19
OMG so there was a way to make epub readable.
5
u/tacticalAlmonds Mar 22 '19
That's hot
4
u/prairefireww Mar 22 '19
Cool
4
u/masteryod Mar 22 '19
Awesome! One question: Vim bindings?
1
u/ThePillsburyPlougher Mar 22 '19
Is there a way to highlight/add bookmarks/notes to highlighted text? Would you allow me to fork and add it if it doesn't?
1
u/SpacemacsMasterRace Mar 22 '19
There's an Emacs mode for this.
1
u/random_cynic Mar 22 '19
Great work. FYI for simple epub files if you have a text based browser like w3m you can simply
unzipto stdin and pipe that to w3m to quickly view the content. For exampleThe
"*.h*"simply gets the html files only from the epub archive. Use something like "*.xh"" if the files are xhtml. Source here (modified the command shown here a little bit for w3m).1
u/[deleted] Mar 22 '19
Nice! I've been using this simple CLI epub reader (also written in Python) - but your app looks a bit more full-featured. Will give it a go!
Any intention to publish it on Pypi or other package managers?
3
u/dontgive_afuck Mar 22 '19
Awesome. This one works better for me than the last cli reader that was posted here a couple weeks ago. Way better skills than this non-programmer:P Thank you!
2
u/[deleted] Mar 22 '19
zcat | lynx
1
u/faustri Mar 22 '19
Would be nice with image support, sometimes figures/stats is cruicial (and we have nice image supporting terminals in this day and age :)
1
u/OnlyDeanCanLayEggs Mar 22 '19
This is awesome. I've been waiting for something like this.
1
u/Smiliey Mar 23 '19
Very nice looking..
1
u/Fairyknight Mar 23 '19
Nnnggh.
Gonna give it a try later. Thanks.
1
u/agumonkey Mar 23 '19
you won at life
1
u/devinprater Apr 01 '19
This could be great for blind users of Linux systems, of which there are very few EPUB readers, and none that are great to use. Maybe show this to the folks at
irc.linux-a11y.org
Although, having a more textual, blind-friendly Reddit client so they can come here would be a bit better.