GithubHelp home page GithubHelp logo

epr's People

Contributors

chenrui333 avatar dsanson avatar imgbotapp avatar jneidel avatar kianmeng avatar klei22 avatar pschfr avatar wustho avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

epr's Issues

Footnote viewer

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}.

No module named '_curses'

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?

Skips the last 2-3 line when going to the next page in Windows Terminal

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.

Feature Request: Tables

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.

Position info

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.

How to use

I cannot seem to find out how to use this lol, are there any better instructions, thanks!

words are missing or out of order

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.

Printing 2 pages on top of each other

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 -->               

can't open the pictures when more than 2 pictures are on the page

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()

Images Not Working MacOS

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.

Screen Shot 2022-01-27 at 1 07 39 PM

Ideia

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

Improvement: reset zoom with zero key

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.

getting json decoder error (just downloaded at 3/22/2019 07:55 CST)

~/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)

Add &amp support and others

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

Example 1:

  • Correct: displayed text in iBooks
    image

  • Incorrect: not displayed text in epr.py
    image

Example 2:

  • Correct: &amp not shown in iBooks
    image

  • Incorrect: epr.py (notice the &amp part):
    image

In any case thank you for the nice piece of software!

PyPI Package

Out of curiosity, any reason this isn't on PyPI? I saw #11 but it didn't mention any particular reason.

New installation procedure on Debian 12

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:

  • as root: apt-get install pipx
  • as root: rm /usr/local/bin/epr
  • as user: pipx install epr-reader
  • as user: pipx ensurepath

Remember last position

Some books have glossaries, and I would like to view them, then return and continue reading. Bookmarks would work, or a jump list.

Featurerequest: use ebook title and checksum instead of filename to store position

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.

epr.py should give visual indication of chapter ending

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.

  1. when using <DOWN> to reach the last line of the chapter, <-- END --> should display before epr.py switches to next chapter.

It's very surprising to see a new chapter, when I use <DOWN> to read the next line.


  1. when using <PAGEDOWN> to reach the last line of the chapter, I'm often surprised that I have lost my reading position, since an unknown number of lines has scrolled past. I don't know if I've read half the page, or 2/3 of the page, or how many lines of the page.

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

python3 support

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.

Feature request: Font styles

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

Where is dictionary integration?

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.

bash: epr: command not found

I've installed epr just now and can't seem to get it to work. Here's my terminal output:

image

Not sure if it's just something wrong with my local environment

Request: Python 3.2 support for older devices

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.

Cannot install (Linux Mint)

I get the following when running pip3 install git+https://github.com/wustho/epr.git

Can you tell me if I'm missing a step?

image

Feature requests: keyboard shortcuts, search

Love this! Some suggestions:

  1. The space-bar should also be a default shortcut for PAGE_DOWN, like it is in more and less.
  2. The vim-like shortcuts for paging up and down should include Ctrl-U for PAGE_UP and Ctrl-D for PAGE_DOWN.
  3. At the end of a chapter, PAGE_DOWN should take me to the next chapter, just like turning a page in a book.
  4. Search would be great! Again, more and less offer a good model for keyboard shortcuts that will be familiar to most users.
  5. (This is a reach but): vim-like counts would be cool: e.g., "5j" goes down 5 lines; 3l jumps three chapters forward...

'unable to create directory' error

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

Termux related problem while opening epr

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'

Top and bottom margins

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.

Failed to open epub file

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

Show information?

Would be great if we could toggle some information display regarding the current position, like Page 3 of 20 or 7%

Support for (left, right) navigation in regex/search window missing

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.

Feature Request: configurable image viewer

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.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.