wustho / epr Goto Github PK
View Code? Open in Web Editor NEWCLI Epub Reader
License: MIT License
CLI Epub Reader
License: MIT License
It would be nice to have a footnote viewer. Perhaps as a floating window popping out when you press some keybind (similar to the ToC window when you press TAB). The currently displayed text would have to be search for patterns like ^{1}.
First of all, thanks a lot for your work. epr
looks fantastic and I can't wait to be able to use it.
I was trying to install it on SailfishOS using pip
but I got an error during installation related to _curses
module missing. I tried also to execute the epr.py
file directly fetched from git, but I get a similar issue:
[nemo@Sailfish Downloads]$ python3 epr.py
Traceback (most recent call last):
File "epr.py", line 50, in <module>
import curses
File "/usr/lib/python3.8/curses/__init__.py", line 13, in <module>
from _curses import *
ModuleNotFoundError: No module named '_curses'
Here are the ncurses
packages I have currently instaled:
Information for package ncurses:
--------------------------------
Repository : jolla
Name : ncurses
Version : 6.1+git1-1.4.1.jolla
Arch : armv7hl
Vendor : meego
Installed Size : 167.7 KiB
Installed : Yes (automatically)
Status : up-to-date
Source package : ncurses-6.1+git1-1.4.1.jolla.src
Summary : Ncurses support utilities
Information for package ncurses-base:
-------------------------------------
Repository : jolla
Name : ncurses-base
Version : 6.1+git1-1.4.1.jolla
Arch : armv7hl
Vendor : meego
Installed Size : 320.4 KiB
Installed : Yes (automatically)
Status : up-to-date
Source package : ncurses-6.1+git1-1.4.1.jolla.src
Summary : Descriptions of common terminals
Information for package ncurses-devel:
--------------------------------------
Repository : jolla
Name : ncurses-devel
Version : 6.1+git1-1.4.1.jolla
Arch : armv7hl
Vendor : meego
Installed Size : 352.7 KiB
Installed : Yes
Status : up-to-date
Source package : ncurses-6.1+git1-1.4.1.jolla.src
Summary : Development files for the ncurses library
Information for package ncurses-libs:
-------------------------------------
Repository : jolla
Name : ncurses-libs
Version : 6.1+git1-1.4.1.jolla
Arch : armv7hl
Vendor : meego
Installed Size : 504.3 KiB
Installed : Yes (automatically)
Status : up-to-date
Source package : ncurses-6.1+git1-1.4.1.jolla.src
Summary : Ncurses libraries
I tried installing ncurses-libs
and ncurses-term
but that didn't help. I couldn't see the minimal ncurses
versions epr
depend on in the README. Does it need a more recent installation of ncurses
?
If you try to turn to the next page when using Windows Terminal it will skip over the last 2-3 line on the page.
Scrolling line by line works fine, and if you scroll up 2-3 lines before moving to the next page then it works fine.
Regular CMD outside of Windows Terminal is also fine so I'm guessing its just something to do with how Terminal handles the display.
I'm not sure if there is actually anything that could be done about that other then hope Windows Terminal's display handling improves but I figured I should mention it.
Hi,
I was reading a epub file with this tui and I noticed that it doesn't seem
to have the ability to render tables, if that is the case I'd like to see the
project feature the rendering of tables in the text.
the specific table in question is in the format of html code
`
Company | Contact | Country |
---|---|---|
Alfreds Futterkiste | Maria Anders | Germany |
Centro comercial Moctezuma | Francisco Chang | Mexico |
Pls lemme know any thoughts.
It would be nice to have some indication about the current position.
I am aware that it is difficult to get the relative position since that require pre-reading the rest.
Just either about which line or page that is current would be sufficient.
I cannot seem to find out how to use this lol, are there any better instructions, thanks!
I've read a epub in Chinese language using epr on macos 10.15.4, python 3.7:
窦文涛:今天 [1] 我终于见到了一位我一直想见到的老师——李玫瑾老师。虽然今天真的都无数次采访过您,通过电话连线。今天终于是见着真人了,我觉得您真是很有风度的一眉立目的那么一款,没想到看上去很温婉。样子的时候,会觉得您是穿着警服有点横
And the content displayed in ibooks is:
窦文涛:今天 [1] 我终于见到了一位我一直想见到的老师——李玫瑾老师。虽然今天真的是第一次见到您,但是在我和傅见锋[2] 做的节目当中,我们好像都无数次采访过您,通过电话连线。今天终于是见着真人了,我觉得您真是很有风度的一位女士!原来他们做点好采访,我没见到您样子的时候, 会觉得您是穿着警服有点横 眉立目的那么一款,没想到看上去很温婉。会觉得您是穿着警服有点横
Not only this paragraph or this book but also many have this problem.
I was reading this epub: https://sternchenland.com/downloads/karl-may/Winnetou%20I%20-%20Karl%20May.epub in an xterm and (initially) I didn't manage to get to the next page (past the front page).
Further experiments showed that if I make the xterm window wide enough, I get 2 pages of text next to each other (initially they have the same text). When I page down, the left-hand page stays the same but the right-hand page changes. If I make the xterm narrower, it becomes clear that the unchanging page is printed on top of the moving (correct) page.
First I thought it was something weird about just this epub, but I tried it with a few others and there it happened too. At the next chapter, the left-hand page switches to the first page of the new chapter.
I am using XTERM_VERSION=XTerm(330)
and XTERM_LOCALE=en_US.UTF-8
.
I just today installed epr using pip3 install git+https://github.com/wustho/epr.git
.
"screenshot:"
Erstes Kapitel.
Euch gern habe. Ihr seid hier bei
en ist nichts für Euch, Sir, gar nichts.
Ein Greenhorn. m an die Atlantik und Pazifik Company
ne daß Ihr es wußtet. Habt gut
Lieber Leser, weißt du, was das Wort Greenhorn bedeutet? eine höchst ärgerliche
und despektierliche Bezeichnung für denjenigen, auf welchen sie angewendet wird. lick in dasselbe warf und da mein
and, gingen mir die Augen über. Er aber
Green heißt grün, und unter horn ist Fühlhorn gemeint. Ein Greenhorn ist demnach
ein Mensch, welcher noch grün, also neu und unerfahren im Lande ist und seine
Fühlhörner behutsam ausstrecken muß, wenn er sich nicht der Gefahr aussetzen gutes Pferd. Habe den Rotschimmel
will, ausgelacht zu werden. sollt ihn bekommen. Und Waffen müßt Ihr
tgeben, das alte, schwere Gun, welches
Ein Greenhorn ist ein Mensch, welcher nicht von seinem Stuhle aufsteht, wenn r bei jedem Schusse in das Schwarze
eine Lady sich auf denselben setzen will; welcher den Herrn des Hauses grüßt,
ehe er der Mistreß und Miß seine Verbeugungen gemacht hat; welcher beim Laden
des Gewehres die Patrone verkehrt in den Lauf schiebt oder erst den Propfen, ich die Sprache wiederfand, wollte ich
dann die Kugel und zuletzt das Pulver in den Vorderlader stößt. Ein Greenhorn nen Erfolg. Diese guten Menschen hatten
spricht entweder gar kein oder ein sehr reines und geziertes Englisch; ihm ist nd es hätte sie tief gekränkt, wenn ich
das Yankee-Englisch oder gar das Hinterwälder-Idiom ein Greuel; es will ihm wenigstens für einstweilen, alle
nicht in den Kopf und noch viel weniger über die Zunge. Ein Greenhorn hält ein an der Tafel Platz, und wir Andern
Racoon für ein Opossum und eine leidlich hübsche Mulattin für eine Quadroone. en; es wurde gegessen, und das Thema
Ein Greenhorn raucht Cigaretten und verabscheut den tabakssaftspeienden Sir. Ein erden.
Greenhorn läuft, wenn er von eine Ohrfeige erhalten hat, mit seiner Klage zum
Friedensrichter, anstatt, wie ein richtiger Yankee tun soll, den Kerl einfach sen mußte. Die Bahn sollte von St. Louis
und auf der Stelle niederzuschießen. Ein Greenhorn hält die Stapfen eines Turkey ko, Arizona und Kalifornien nach der
für eine Bärenfährte und eine schlanke Sportjacht für einen Mississippisteamer. an gefaßt, diese weite Strecke in
Ein Greenhorn geniert sich, seine schmutzigen Stiefel auf die Kniee seines ssen zu lassen. Diejenige Sektion,
Mitpassagiers zu legen und seine Suppe mit dem Schnaufen eines verendenden s unter einem Oberingenieur zugefallen
Büffels hinabzuschlürfen. Ein Greenhorn schleppt der Reinlichkeit wegen einen io Pecos und des südlichen Kanadian. Die
Waschschwamm von der Größe eines Riesenkürbis und zehn Pfund Seife mit in die Stone und Will Parker sollten uns
Prairie und steckt sich dazu einen Kompaß bei, welcher schon am dritten oder von wackeren Westmännern vorfinden
vierten Tag nach allen möglichen andern Richtungen, aber nie mehr nach Norden gen hatten. Natürlich waren wir außerdem
zeigt. Ein Greenhorn notiert sich achthundert Indianerausdrücke, und wenn er dem sicher. Um mich so recht zu
ersten Roten begegnet, so bemerkt er, daß er diese Notizen im letzten Couvert t gesagt worden, freilich etwas sehr
nach Hause geschickt und dafür den Brief aufgehoben hat. Ein Greenhorn kauft , daß für meine vollständige Ausrüstung
Schießpulver, und wenn er den ersten Schuß tun will, erkennt er, daß man ihm Es blieb mir nichts weiter zu tun, als
gemahlene Holzkohle gegeben hat. Ein Greenhorn hat zehn Jahre lang Astronomie e in der Wohnung des Oberingenieurs auf
studiert, kann aber ebenso lang den gestirnten Himmel angucken, ohne zu wissen, n Henry und Sam Hawkens hin und wurde
wie viel Uhr es ist. Ein Greenhorn steckt das Bowiemesser so in den Gürtel, daß n, daß ich hatte überrascht werden
er, wenn er sich bückt, sich die Klinge in den Schenkel sticht. Ein Greenhorn ung nicht übelnehmen.
macht im wilden Westen ein so starkes Lagerfeuer, daß es baumhoch emporlodert,
und wundert sich dann, wenn er von den Indianern entdeckt und erschossen worden r deutschen Familie Abschied genommen
ist, darüber, daß sie ihn haben finden können. Ein Greenhorn ist eben ein ne Dankesworte dadurch ab, daß er, mir
Greenhorn und ein solches Greenhorn war damals auch ich. derben Weise mich unterbrach:
Aber man denke ja nicht etwa, daß ich die Überzeugung oder auch nur die Ahnung doch nur deshalb hinausgeschickt, damit
gehabt hätte, daß diese kränkende Bezeichnung auf mich passe! O nein, denn es nn. Kehrt Ihr zurück, so sucht mich auf
ist ja eben die hervorragendste Eigentümlichkeit jedes Greenhorns, eher alle habt. Dann wird es sich zeigen, ob Ihr
andern Menschen, aber nur nicht sich selbst für ›grün‹ zu halten. ch nicht glauben wollt, nämlich ein
Ich glaubte ganz im Gegenteile, ein außerordentlich kluger und erfahrener Mensch
zu sein; hatte ich doch, so was man zu sagen pflegt, studiert und nie vor einem ehe er sie schloß, sah ich, daß ihm das
Examen Angst gehabt! Daß dann das Leben die eigentliche und richtige Hochschule
ist, deren Schüler täglich und stündlich geprüft werden und vor der Vorsehung
zu bestehen haben, daran wollte mein jugendlicher Sinn damals nicht denken. d -->
I just tried to look at the pictures on a page with 2 images. This leaded to a none reactive epr which i needed to shutdown by crtl+c ..
The console gave the following error ->
Traceback (most recent call last):
File "/usr/bin/epr", line 1272, in <module>
main()
File "/usr/bin/epr", line 1268, in main
curses.wrapper(preread, file)
File "/usr/lib/python3.10/curses/__init__.py", line 94, in wrapper
return func(stdscr, *args, **kwds)
File "/usr/bin/epr", line 1162, in preread
incr, width, y, pctg = reader(stdscr, epub, idx, width, y, pctg)
File "/usr/bin/epr", line 1042, in reader
p = pad.getch()
Running epr on 2020 MacBook Pro with the M1 chip running Monterey 12.1, terminal emulator is iTerm2, image viewers are sxiv preview(native) feh. Installed epr with Python Pip.
Images work in GUI readers but when I press o
to open an image I get the following:
Error Opening Image
│ -------------------
│
│ local variable 'content_path' referenced before assignment
I looked at the code on Github and saw that feh is first on the list for image viewers. I installed feh with Homebrew (version 3.8 stable). Tried multiple images with no success. I tried looking for local variable 'content_path' to see if it is something I could adjust but could not find references to it.
Other details:
Model Name: MacBook Pro
Model Identifier: MacBookPro17,1
Chip: Apple M1
System Firmware Version: 7429.61.2
OS Loader Version: 7429.61.2
Python versions 2.7 and 3.9.1
Thanks for your effort on the program and any hints on how to resolve the image issue.
Even a rudimentary support would improve the readability greatly. Many thanks in advance.
Just FYI, terminal file manager nnn
now has a plugin to read books from Project Gutenberg: https://github.com/jarun/nnn/blob/master/plugins/gutenread
epr
is the suggested utility for those who (like myself) prefer the epub format.
Great utility! Keep up the good work!
Hi, I don't know how to contact you, but I will delete this message here soon.
I just wanna say that I liked so much your epub reader, and I here to bring you the idea, to maybe create a writer, in the exactly same style as that epub reader.
I'm sorry to bother here
Sincerely,
Mateus
Usually when a zoom functionality is offered apps zoom in/out with +
(or =
) and -
respectively. Most of the time they also offer a way to reset the zoom level back to normal. I think that would be a good addition to epr to.
~/epr.py myfile.epub (happens with epr.py --help too)
Traceback (most recent call last):
File "/home/user/epr.py", line 44, in
state = json.load(f)
File "/usr/lib/python3.7/json/init.py", line 296, in load
parse_constant=parse_constant, object_pairs_hook=object_pairs_hook, **kw)
File "/usr/lib/python3.7/json/init.py", line 348, in loads
return _default_decoder.decode(s)
File "/usr/lib/python3.7/json/decoder.py", line 337, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
File "/usr/lib/python3.7/json/decoder.py", line 355, in raw_decode
raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 2 (char 1)
There are some things which I found aren't displayed correctly or are not displayed at all, is there any chance for a fix? Or is this outside the scope of the project and is it only meant for simpler epub?
Some examples:
Take for instance this epub:
https://github.com/kaunta/gnu-manuals
In any case thank you for the nice piece of software!
Out of curiosity, any reason this isn't on PyPI? I saw #11 but it didn't mention any particular reason.
After upgrading to Debian Bookworm, epr would no longer start.
You have to re-install via pipx and remove your old epr installation. Your old config and last-read-position will still be there.
Here's what worked for me:
Some books have glossaries, and I would like to view them, then return and continue reading. Bookmarks would work, or a jump list.
I use a calibre server to have my ebooks stored. I use lynx to search throu them and than hand them over to epr. In this case the file gets a random name each time i at least restart my pc. this renders the currently used implementation how epr stores the last reading position useless. I thought a little about it and maybe the following would be an idea:
Instead of using the file name to identify a file use the ebook title + a checksum of the file.
If I go to the second chapter, then use <UP> (up on keyboard) to get to the first chapter, epr.py shows <-- END --> as an indication that I've changed chapters.
It's very surprising to see a new chapter, when I use <DOWN> to read the next line.
this should be fixed by prefixing each line from the previous page with a * to indicate that only a partial page has been displayed.
* lines lines
* lines lines
* lines lines
* lines lines
* lines lines
* lines lines
lines lines
lines lines
lines lines
lines lines
lines lines
lines lines
lines lines
In order to install epr, I had to run the command pip3 install git+https://github.com/wustho/epr.git
On Debian-like systems, pip3
comes from the package python3-pip
.
Thanks for your great app!
I was wondering if epr could support font styles (e.g. italic, bold, underline, etc)? Often, they convey meaning in ebooks.
Thanks
FictionBook is basically XML
行 844 src_lines, imgs = parser.get_lines(width // 2)
修改后,显示完整。
The readme claims that there's integration with dictionaries. But I don't see it anywhere.
Also, is there a way to select and copy some text? That can serve as an alternative of dictionary integration.
It would be nice to have the filename or book title displayed as the WM_CLASS, which can be useful in some window managers
Will it be possible for you provide a epr binary that uses only python 3.2?
There are some old devices that has only python 3.2 support, for example Blackberry OS 10.
We old platform users would greatly appreciate it if you would do it.
Thank you.
I've created a chocolatey package for epr. The page for the is https://chocolatey.org/packages/epr.
My source for the package is at https://github.com/cybercatgurrl/chocolatey-pkgs/tree/master/epr.
You can mention something like you can install with Chocolatey "choco install epr" as soon as the package goes public.
Cheers!
Just realized when I posted an issue there's no version numbers. Would help for specifying issues going forward.
You can display images in the terminal with w3m or by using a terminal that supports images like kitty.
Take a look at the image backends for neofetch for pretty much every option available.
i would love this feature
I am using iTerm2 on Max OS Big Sur. I often use imgcat:
https://iterm2.com/documentation-images.html
Would it be possible to integrate this directly into epr?
This is not a real issue, but I really like to know the font name. I would like to use it for my reading. Thanks.
Love this! Some suggestions:
more
and less
.more
and less
offer a good model for keyboard shortcuts that will be familiar to most users.When you open an image in an ePub, it shows the following error on the screen, in the end it does open the image, but it makes the screen dirty with errors.
(nemo:4844): dconf-CRITICAL **: 16:43:18.763: unable to create directory '/run/user/0/dconf': Permiso denegado. dconf will not work properly.
Linux Mint 19 Cinnamon
Cinnamon 3.8.9
Xviewer 1.8.1
python 3.6
Traceback (most recent call last):
File "/data/data/com.termux/files/usr/bin/epr", line 8, in sys.exit(main())
File "/data/data/com.termux/files/usr/lib/python3.10/site-packages/epr.py", line 1253, in main
curses.wrapper(preread, file)
File "/data/data/com.termux/files/usr/lib/python3.10/curses/init.py", line 94, in wrapper
return func(stdscr, *args, **kwds)
File "/data/data/com.termux/files/usr/lib/python3.10/site-packages/epr.py", line 1143, in preread
epub.initialize()
File "/data/data/com.termux/files/usr/lib/python3.10/site-packages/epr.py", line 198, in initialize
name = j.find("DAISY:navLabel/DAISY:text", self.NS).text
AttributeError: 'NoneType' object has no attribute 'text'
I could not find any way to add empty rows to the start and end of the page view, i.e. top and bottom margins. It would be nice to be able to adjust these, like the text width.
Just as a quick note, it seems to work just fine over here, but isn't installable, feel free to just dismiss and close this issue tho.
I've done a cursory check and this does not seem to be supported. Would be nice to have.
sometimes got this error when opening my ebook,
Traceback (most recent call last):
File "epr.py", line 1240, in
File "epr.py", line 1236, in main
File "curses_init_.py", line 102, in wrapper
File "epr.py", line 1122, in preread
File "epr.py", line 194, in initialize
ValueError: '../Text/cover.xhtml' is not in list
[4060] Failed to execute script epr
Would be great if we could toggle some information display regarding the current position, like Page 3 of 20
or 7%
I noticed that the regex/search window currently does not support navigation with arrow keys (left, right). I had a go at it, and it works quite well on multiple terminals (Terminal.app, Kitty, Alacritty).
Don't know if it's needed. If needed, then I'll add the PR.
It would be totally amazing if we could have a configurable image viewer. I suggest that even being fully aware that i could already configure the default image viewer using xdg standard. The reason for this is mostly i don't want to change the default image viewer for other applications (it makes sense to have a more feature rich solution there). There is a second advantage without writing an additional bash script we can setup parameter for the image viewer that way.
Use the keys d
and u
(from ^d
/^u
in vim) to go down/up half a page.
pre
nodes are displayed without newlines, which makes code blocks unreadable in epr
.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.