GithubHelp home page GithubHelp logo

epub's People

Contributors

pavellishin avatar rupa 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  avatar  avatar

epub's Issues

html entities decoded incorrectly

For example,
“Captain Yerin,”
is rendered as
“Captain Yerin,”
instead of as
“Captain Yerin,”

(Yes, the entities are further escaped in this issue because github keeps parsing it all into smart quotes.)

-d fails on unicode when output redirected

Epub files containing unicode work beautifully when epub.py is called without command-line options. They also works perfectly well (at least in unicode locales) when the output is simply dumped to the screen. However, in most cases when dumping the contents of an entire ebook one would probably want to redirect the output, e.g., to a screen reader like less or to a file. The -d option fails in both these cases with the dreaded Python2 ascii codec error:

UnicodeEncodeError: 'ascii' codec can't encode characters in position 0-9: ordinal not in range(128)

As explained here, this is because python2 treats printing to the terminal differently than redirecting output.

Solution
I was able to fix this problem by using kitchen.text.converters.getwriter() as suggested in the document above. Normal functioning of the program does not seem to have been affected, and unicode files now work as expected in all cases (including -d).

BeautifulSoup 4

can this be made compatible with BeautilfulSoup 4, thanks

Title finding for TOC does not always work correctly

Sometimes, when using epub.py to open some .epub files, the TOC view won't display the chapter titles just numbers.

Does anybody have a file it works with?

I'm still working on isolating the cause of this.

Bookmark support

Please implement a simple bookmark system, it would be great to keep tracking of the progress of readings.

Leading newline in titles

I don't know whether this will prove to be a common issue, but the first (and so far only) epub book I tried to open with this script displayed the table of contents all wrong and strangely truncated. It turned out to be that somehow there were leading newline characters in each "title" string.

The fix for me was to change current line #173 from:
screen.addstr(i, 0, '{0:-5} {1}'.format(start, title))
To:
screen.addstr(i, 0, '{0:-5} {1}'.format(start, title.strip()))

Enable scrolling between chapters

In other readers (I use FBReader and CoolReader), upon reaching the end of a chapter in an ebook, if I continuue scrolling down, I will immediately see the beginning of the next chapter. Similarly, if I scroll up from the beginning of a chapter, I will find myself at the end of the previous chapter. It's awkward to have to switch to the table of contents, select the next chapter, and switch back.

Long book title lines wrapping to next line in TOC page

When a book's title length exceeds the window width it wraps to the first line of the chapter listings. This is probably the case also for chapter listings themselves. I noticed this in a case where the first chapter "title" was blank, so there was nothing to over-write the word-wrap of the prior line's title. What then happens is that the next line will partially over-write the wrapped line, so the result will be the correct current line followed by the remainder of the previous line's wrap.

If you want, I can attach the offending epub example file.

Support mobi

Please support (non-DRM) mobi as well. There should be code in Calibre you can use.

Images don't show

I've tried many things and I have everything required installed but images do not show. Instead, their path is printed.

-d option fails

It tries to access a non-existent screen variable.

(venv)[2013-01-04 11:07:03] pavel@addison:~/projects/epub
# ./epub.py -d ~/novel.epub
A Novel
-------




Traceback (most recent call last):
  File "./epub.py", line 362, in <module>
    dump_epub(args.EPUB)
  File "./epub.py", line 178, in dump_epub
    maxcol=screen.getmaxyx()[1]
NameError: global name 'screen' is not defined
(venv)[2013-01-04 11:07:11] pavel@addison:~/projects/epub

epub.py has syntax error

Installed epub.py from the .zip download. Attempt to run it produced this result
/home/g/Downloads/epub-master # ./epub.py -h
File "./epub.py", line 66
print image.Image(image_file.name)
^
SyntaxError: invalid syntax

I know nothing about python, could you kindly advise me of the problem here.
I have installed python2-beautifulsoup3-3.2.1-3 and python3.4.2 on arch linux mainline 3.18.1

Error when pip install -r dependencies.txt

s eta 0:09:56ERROR: Exception:
Traceback (most recent call last):
  File "/usr/local/lib/python3.7/dist-packages/pip/_vendor/resolvelib/resolvers.py", line 171, in _merge_into_criterion
    crit = self.state.criteria[name]
KeyError: 'pillow'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/lib/python3.7/dist-packages/pip/_vendor/urllib3/response.py", line 438, in _error_catcher
    yield
  File "/usr/local/lib/python3.7/dist-packages/pip/_vendor/urllib3/response.py", line 519, in read
    data = self._fp.read(amt) if not fp_closed else b""
  File "/usr/local/lib/python3.7/dist-packages/pip/_vendor/cachecontrol/filewrapper.py", line 62, in read
    data = self.__fp.read(amt)
  File "/usr/lib/python3.7/http/client.py", line 461, in read
    n = self.readinto(b)
  File "/usr/lib/python3.7/http/client.py", line 505, in readinto
    n = self.fp.readinto(b)
  File "/usr/lib/python3.7/socket.py", line 589, in readinto
    return self._sock.recv_into(b)
  File "/usr/lib/python3.7/ssl.py", line 1052, in recv_into
    return self.read(nbytes, buffer)
  File "/usr/lib/python3.7/ssl.py", line 911, in read
    return self._sslobj.read(len, buffer)
socket.timeout: The read operation timed out

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/lib/python3.7/dist-packages/pip/_internal/cli/base_command.py", line 189, in _main
    status = self.run(options, args)
  File "/usr/local/lib/python3.7/dist-packages/pip/_internal/cli/req_command.py", line 178, in wrapper
    return func(self, options, args)
  File "/usr/local/lib/python3.7/dist-packages/pip/_internal/commands/install.py", line 317, in run
    reqs, check_supported_wheels=not options.target_dir
  File "/usr/local/lib/python3.7/dist-packages/pip/_internal/resolution/resolvelib/resolver.py", line 122, in resolve
    requirements, max_rounds=try_to_avoid_resolution_too_deep,
  File "/usr/local/lib/python3.7/dist-packages/pip/_vendor/resolvelib/resolvers.py", line 453, in resolve
    state = resolution.resolve(requirements, max_rounds=max_rounds)
  File "/usr/local/lib/python3.7/dist-packages/pip/_vendor/resolvelib/resolvers.py", line 318, in resolve
    name, crit = self._merge_into_criterion(r, parent=None)
  File "/usr/local/lib/python3.7/dist-packages/pip/_vendor/resolvelib/resolvers.py", line 173, in _merge_into_criterion
    crit = Criterion.from_requirement(self._p, requirement, parent)
  File "/usr/local/lib/python3.7/dist-packages/pip/_vendor/resolvelib/resolvers.py", line 82, in from_requirement
    if not cands:
  File "/usr/local/lib/python3.7/dist-packages/pip/_vendor/resolvelib/structs.py", line 124, in __bool__
    return bool(self._sequence)
  File "/usr/local/lib/python3.7/dist-packages/pip/_internal/resolution/resolvelib/found_candidates.py", line 143, in __bool__
    return any(self)
  File "/usr/local/lib/python3.7/dist-packages/pip/_internal/resolution/resolvelib/found_candidates.py", line 38, in _iter_built
    candidate = func()
  File "/usr/local/lib/python3.7/dist-packages/pip/_internal/resolution/resolvelib/factory.py", line 169, in _make_candidate_from_link
    name=name, version=version,
  File "/usr/local/lib/python3.7/dist-packages/pip/_internal/resolution/resolvelib/candidates.py", line 306, in __init__
    version=version,
  File "/usr/local/lib/python3.7/dist-packages/pip/_internal/resolution/resolvelib/candidates.py", line 144, in __init__
    self.dist = self._prepare()
  File "/usr/local/lib/python3.7/dist-packages/pip/_internal/resolution/resolvelib/candidates.py", line 226, in _prepare
    dist = self._prepare_distribution()
  File "/usr/local/lib/python3.7/dist-packages/pip/_internal/resolution/resolvelib/candidates.py", line 312, in _prepare_distribution
    self._ireq, parallel_builds=True,
  File "/usr/local/lib/python3.7/dist-packages/pip/_internal/operations/prepare.py", line 457, in prepare_linked_requirement
    return self._prepare_linked_requirement(req, parallel_builds)
  File "/usr/local/lib/python3.7/dist-packages/pip/_internal/operations/prepare.py", line 482, in _prepare_linked_requirement
    self.download_dir, hashes,
  File "/usr/local/lib/python3.7/dist-packages/pip/_internal/operations/prepare.py", line 234, in unpack_url
    hashes=hashes,
  File "/usr/local/lib/python3.7/dist-packages/pip/_internal/operations/prepare.py", line 108, in get_http_url
    from_path, content_type = download(link, temp_dir.path)
  File "/usr/local/lib/python3.7/dist-packages/pip/_internal/network/download.py", line 163, in __call__
    for chunk in chunks:
  File "/usr/local/lib/python3.7/dist-packages/pip/_internal/cli/progress_bars.py", line 159, in iter
    for x in it:
  File "/usr/local/lib/python3.7/dist-packages/pip/_internal/network/utils.py", line 88, in response_chunks
    decode_content=False,
  File "/usr/local/lib/python3.7/dist-packages/pip/_vendor/urllib3/response.py", line 576, in stream
    data = self.read(amt=amt, decode_content=decode_content)
  File "/usr/local/lib/python3.7/dist-packages/pip/_vendor/urllib3/response.py", line 541, in read
    raise IncompleteRead(self._fp_bytes_read, self.length_remaining)
  File "/usr/lib/python3.7/contextlib.py", line 130, in __exit__
    self.gen.throw(type, value, traceback)
  File "/usr/local/lib/python3.7/dist-packages/pip/_vendor/urllib3/response.py", line 443, in _error_catcher
    raise ReadTimeoutError(self._pool, None, "Read timed out.")
pip._vendor.urllib3.exceptions.ReadTimeoutError: HTTPSConnectionPool(host='files.pythonhosted.org', port=443): Read timed out.

search function?

hi and thanks for this handy application!
have you considered adding search function? (in a perfect world vim-like, implemented with /.)
thanks!

Pillow, in place of PIL

Thanks for this terminal epub reader ! 😄

Is it possible to change the image handling from PIL to Pillow ?

(Since, upon looking around I found out that, PIL was dead, and the Pillow was considered to be its replacement)

Pip package?

Are there any plans to release this project on pip?

parse content.opf

toc.ncx doesn't list all the files in a book. should be using content.opf.

epub: command not found

Hi, I successfully installed epub all the dependecies through pip, but when executing the command it seems like it hasn't been installed, but I can see it in the following path: /rw/usrlocal/lib/python2.7/dist-packages

Any idea why I'm not able to use it?

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.