michaldaniel / ebook-viewer

Modern GTK Python Ebook Reader app to easily read epub files
GNU General Public License v3.0
409 stars 47 forks source link

Several e-books cannot be opened #3

Closed ghost closed 7 years ago

ghost commented 8 years ago

I tried opening several ePub books, with limited success. Some can be displayed just fine while others cannot (the main window remains empty, with no content). Calibre can open them instead. Unfortunately I cannot share those e-books publicly, but I'm happy to send them to you in private (e-mail?) if you want.

michaldaniel commented 8 years ago

Please send those e-books to contact@michaldaniel.work, it's the only way I can have chance to debug this. Thank you for bringing this to my attention.

ghost commented 8 years ago

Done. I sent you three different e-books for testing.

michaldaniel commented 7 years ago

I think it should work now, opened all three of them working correctly.

ghost commented 7 years ago

I updated e-book viewer to latest git version, but I still can't read the three e-books I sent you...

michaldaniel commented 7 years ago

I've sent you an email. Please note that due to conflict with calibre "ebook viewer" I changed name to "Easy Ebook Viewer".

ghost commented 7 years ago

Just replied to your email.

michaldaniel commented 7 years ago

@fturco Can you update again to include last commit? It will give me just a little more output.

  1. Could I get full terminal output? Maybe as txt file?
  2. What happens when you try to use navigation? Any more output?
  3. Can you see the book files under /tmp/easy-ebook-viewer-yourusername/ ?
  4. Could you list that directory using ls -l
  5. Version of gir1.2-webkit-3.0 dependency. On ubuntu and debian dpkg -s gir1.2-webkit-3.0
michaldaniel commented 7 years ago

Could you also do cd && rm .easy-ebook-viewer.conf so my new fix (that makes sure not to save about:blank as restore point page) could be tested? I really can't reproduce this bug, whatever I do those books open fine.

ghost commented 7 years ago

I updated easy-ebook-viewer, removed ~/.easy-ebook-viewer.conf and tried again. Same problem.

easy-ebook-viewer.txt

I can see files from my ebook stored in /tmp/easy-ebook-viewer-cache-fturco/:

$ ls -l /tmp/
total 0
drwx------ 2 fturco fturco  40 Sep 18 19:35 babel-41169Bt
drwx------ 5 fturco fturco 220 Sep 18 20:38 easy-ebook-viewer-cache-fturco
drwx------ 2 root   root    40 Sep 18 18:23 pulse-PKdhtXMmr18n
drwx------ 2 fturco fturco  60 Sep 18 18:24 ssh-LuxJGPjPk1hp
drwx------ 3 root   root    60 Sep 18 18:24 systemd-private-f371e1b37f5a49659e0cc6a160584796-colord.service-N5HYZ5
drwx------ 3 root   root    60 Sep 18 18:23 systemd-private-f371e1b37f5a49659e0cc6a160584796-systemd-timesyncd.service-ZSAKjx
drwx------ 2 fturco fturco  60 Sep 18 20:42 tracker-extract-files.1000
srwxr-xr-x 1 fturco fturco   0 Sep 18 19:37 uGetIPC-fturco

When clicking on the prev/next page buttons it seems to switch page, but unfortunately I can't read it since it's blank.

On Gentoo Linux there's no gir1.2-webkit-3.0 package, but I have 3 versions of webkit-gtk installed:

$ equery list webkit-gtk
 * Searching for webkit-gtk ...
[IP-] [  ] net-libs/webkit-gtk-2.4.11-r1:3/25
[IP-] [  ] net-libs/webkit-gtk-2.4.11-r200:2
[IP-] [  ] net-libs/webkit-gtk-2.12.5:4/37

This is the list of USE flags (aka compile options) I used for webkit-gtk-2.12.5:

$ equery uses webkit-gtk
[ Legend : U - final flag setting for installation]
[        : I - package is installed with flag     ]
[ Colors : set, unset                             ]
 * Found these USE flags for net-libs/webkit-gtk-2.12.5:
 U I
 - - coverage      : Enable code coverage support
 - - doc           : Add extra documentation (API, Javadoc, etc). It is recommended to enable per package instead of globally
 + + egl           : Enable EGL support.
 + + geolocation   : Enable physical position determination
 - - gles2         : Enable GLESv2 support.
 + + gnome-keyring : Enable support for storing passwords via gnome-keyring
 + + gstreamer     : Add support for media-libs/gstreamer (Streaming media)
 + + introspection : Add support for GObject based introspection
 + + jit           : Enable just-in-time compilation for improved performance. May prevent use of some PaX memory protection features in
                     Gentoo Hardened.
 + + libnotify     : Enable desktop notification support
 - - nsplugin      : Build plugin for browsers supporting the Netscape plugin architecture (that is almost any modern browser)
 + + opengl        : Add support for OpenGL (3D graphics)
 - - spell         : Add dictionary support
 - - test          : Workaround to pull in packages needed to run with FEATURES=test. Portage-2.1.2 handles this internally, so don't set
                     it in make.conf/package.use anymore
 - - wayland       : Enable dev-libs/wayland backend
 + + webgl         : Build support for the WebGL HTML API using virtual/opengl
ghost commented 7 years ago

According to https://packages.debian.org/sid/amd64/gir1.2-webkit-3.0/filelist I need to have /usr/lib/x86_64-linux-gnu/girepository-1.0/WebKit-3.0.typelib. I don't have that file on my system. The right location for Gentoo Linux is probably /usr/lib64/girepository-1.0/WebKit-3.0.typelib:

$ equery belongs /usr/lib64/girepository-1.0/WebKit-3.0.typelib
 * Searching for /usr/lib64/girepository-1.0/WebKit-3.0.typelib ... 
net-libs/webkit-gtk-2.4.11-r1 (/usr/lib64/girepository-1.0/WebKit-3.0.typelib)

In other words that file belongs to package webkit-gtk-2.4.11-r1, which is correctly installed on my system.

michaldaniel commented 7 years ago

Hmm. Normally navigating around should produce output like this

Loaded uri: file:///tmp/easy-ebook-viewer-cache-michal///text/part0010.html
Loading file: file:///tmp/easy-ebook-viewer-cache-michal///text/part0010.html
Loaded uri: file:///tmp/easy-ebook-viewer-cache-michal///text/part0011.html
Loading file: file:///tmp/easy-ebook-viewer-cache-michal///text/part0011.html

First I call load_uri on WebKit.WebView and then load-finished event handler should print out Loading file before doing some position saving logic and what not. It would seem that webkit never fires 'load-finished' on those files.

I will try to dive into this again next weekend and test it against most recent webkit but right now I can only offer this insight.

ghost commented 7 years ago

With certain e-books I obtain the behaviour you just specified: Loaded uri followed by Loaded file. But on several problematic e-books I get only the Loaded uri messages.

michaldaniel commented 7 years ago

@fturco It seems to be very webkit specific thing, I can already sense it's going to be massive pain in the ass to narrow down. But you gave me version and compilation flags so I'll set up some VM and try to reproduce it. Until I can test this bug against my build it's all guess work. Thanks for all the info.

michaldaniel commented 7 years ago

One more thing, could go download pPub and give it a try? https://github.com/sakisds/pPub

ghost commented 7 years ago

pPub can't open any of the three ebooks I sent you. Same problem: blank window. It can successfully open other e-books I have, just like Easy E-book Viewer.

ghost commented 7 years ago

If you want I can try a different webkit-gtk version, for example one of the following ones:

I can also try installing some ebuild from 3rd-party overlay from here.

Please tell me which version I should test. I don't want to choose a random one myself because webkit-gtk takes a lot of time to compile on my system.

michaldaniel commented 7 years ago

@fturco I'm sporting 2.4.10, we could establish that it works on that version and then try newest 2.12.5. If it does work on 2.4.10 and breaks on 2.12.5 we have something solid to work with ie. it's about changes between versions not some config/building tricks. And I really appreciate you going forward with this proposition, I know how long webkit-gtk takes to compile, done it once.

ghost commented 7 years ago

On my system I currently have three webkit-gtk versions:

# equery list webkit-gtk
 * Searching for webkit-gtk ...
[IP-] [  ] net-libs/webkit-gtk-2.4.11-r1:3/25
[IP-] [  ] net-libs/webkit-gtk-2.4.11-r200:2
[IP-] [  ] net-libs/webkit-gtk-2.12.5:4/37

As you can see there are three parallel slots:

I found old ebuilds for both net-libs/webkit-gtk-2.4.10 (slot 3) and for webkit-gtk-2.4.10-r200 (slot 2). Which version does Easy E-book Viewer need?

michaldaniel commented 7 years ago

It's really hard to tell. It should support all webkits as long as GTK-3 api doesn't change. I'll test things in weekend myself, I am using webkit 2.4.10 so I know it works with this version but it shouldn't need it, it just might be worth to check if it does work using that specific one for you.

ghost commented 7 years ago

OK, I'm going to build both of them. Wish me luck! ;-)

michaldaniel commented 7 years ago

I really do. And I really hope it works, it will narrow it a lot.

ghost commented 7 years ago

I finished installing both packages. This is my setup now:

$ equery list webkit-gtk
 * Searching for webkit-gtk ...
[I-O] [  ] net-libs/webkit-gtk-2.4.10:3/25
[I-O] [  ] net-libs/webkit-gtk-2.4.10-r200:2
[IP-] [  ] net-libs/webkit-gtk-2.12.5:4/37

Unfortunately I haven't noticed changes from Easy E-book Viewer or pPub. In other words, the problems remain.

joelobrecht commented 7 years ago

Hello. Thanks for your promising viewer. I tried to install it on archlinux, but it doesn't work. I can't open any ebook (for instance O'Reilly ebooks) that open fine with other viewers. I guess that somehow I might have missed some dependencies (see the depends section in the PKGBUILD file code below), since their naming was for your system (debian ?). If you can take a look in the code below to see if I'm correct.

Actually, the [bug|error] is quite the same than in pPub that I've tried to install (and removed).

I took the time to create a PKGBUILD and an .install file in order to create an archlinux package to properly install / upgrade / remove it from my system. Other arch users can use those scripts too, so I post them here.

PKGBUILD

# Maintainer: myself <firstname.name@gmail.com>
pkgname=Ebook-Viewer
pkgver=0.1
pkgrel=1
epoch=
pkgdesc="Modern GTK Python app to easily read ePub files"
arch=('i686' 'x86_64')
url="https://github.com/michaldaniel/Ebook-Viewer"
license=('GPL-3.0')
groups=()
depends=('webkitgtk' 'gobject-introspection' 'python-gobject' 'python3' 'gtk3')
makedepends=('git' 'make')
checkdepends=()
optdepends=()
provides=('Ebook-Viewer')
conflicts=('Ebook-Viewer')
replaces=()
backup=()
options=()
install=$pkgname.install
changelog=
source=("$pkgname::git+https://github.com/michaldaniel/Ebook-Viewer")
noextract=()
md5sums=('SKIP')
validpgpkeys=()

prepare() {
     cd $pkgname
   sed -i '/gtk-update-icon-cache/d' Makefile
    }

build() {
    cd "$pkgname"
    make 
}

package() {
    cd "$pkgname"
    make PREFIX="$pkgdir/usr" install 
}

Ebook-Viewer.install

post_install() {
  gtk-update-icon-cache -q -t -f usr/share/icons/gnome
}

post_upgrade() {
  post_install
}

post_remove() {
  post_install
}
michaldaniel commented 7 years ago

@quatrecouleurs That seemed about right with python3 exception, you listed python2, the app relies on python3. I edited your post.

@quatrecouleurs Also I can see you are using name "Ebook Viewer" it's now "Easy eBook Viewer" and the app doesn't handle prefixes well with some hard coded paths in it. I'm going to change that sooner or later but right now it has those set in stone:

PREFIX = /usr
EBOOKVIEWER_DIR = ${PREFIX}/share/easy-ebook-viewer
BINDIR = ${PREFIX}/bin
PYTHON = ${BINDIR}/python3

PS. I'm going to looking into this today and report back later.

michaldaniel commented 7 years ago

Should be working fine now. Thanks to help from my friend @bookletchoir we were able to narrow it down. Turns out is might be issue that needs to be taken upstream but for now we can use load_html_string webview method instead of load_uri that fails for certain html files.

ghost commented 7 years ago

I can open my three e-books now! Thank you both!

michaldaniel commented 7 years ago

@fturco Thank you for taking time to report this and helping with all that debug process.

joelobrecht commented 7 years ago

Thanks with your edits now it works perfectly well :)