You are not logged in.

#1 2011-10-27 17:35:14

sakisds
Member
From: Athens, Greece
Registered: 2011-10-03
Posts: 105

pPub - A light ePub reader made with pygtk

Hello everyone,
I got my hands on some epub files two days ago but I didn't find any reader I liked so I decided to write my own. And here it is:

Screenshot
Git Repository
PKGBUILD

Dependencies:
-python2
-unzip
-gobject-introspection
-python2-gobject
-gtk3
-libwebkit3

Bookmarks are matched with the MD5 hash of each book so they are valid even if you rename or move your books.
In case you have a book that is not working, please extract your epub file like a zip and send me any .opf and .ncx files it has inside. I will do my best to fix the problem then.

So far it's perfectly usable but it could use more features, so please post your ideas here.

Thanks for trying!

Changelog:

21 Nov:
-Now using python's zipfile instead of unzip.
-Updated PKGBUILD for new dependencies.

19 Nov:
-Better error handling.

7 Nov:
-Added icons and a .desktop file.
-Updated PKGBUILD.

6 Nov:
-Added content menu listing all chapters.
-Fixed some minor bugs.

3 Nov:
-Added config validation.
-Added night mode.
-Added User CSS support.

2 Nov:
-Fixed PKGBUILD
-Replaced most menu items with stock ones (for icons)
-Added the ability to enable/disable javascript.
-Fixed menu separators.

1 Nov:
-Switch to GI dynamic bindings and gtk3 support (by Laurent Bigonville)
-Now it cleans the cache on exit.
-Added limit to zoom level.
-The default cache path includes user's name (so multiple users can use it on the same time)
-Changed permissions for cache (700)
-Updated PKGBUILD (new dependencies)

31 Oct:
-Fixed license (by Psycojoker)
-Fixed a bug that prevented ppub from running when using an older version of webkit (by Psycojoker)

29 Oct:
-Added zoom controls
-Added caret mode
-Changed keyboard shortcuts for chapter navigation:
--Next chapter: Right instead of Control+Right
--Previous chapter: Left instead of Control+Left
-Minor bugfix (with .css)
-Disabled more useless webkit features

28 Oct:
-Fixed PKGBUILD
-Added support for non-standard .opf paths
-Fixed opening files containing 'bad' characters in their filenames.
-Disabled some browser-related features webkit was loading.

Known bugs:
-Cover pages don't work.
-Links inside book pages work but they mess up the current chapter value. The chapter changes but the application is unaware of it, so it changes back later.

Last edited by sakisds (2011-11-21 14:01:10)

Offline

#2 2011-10-27 21:34:05

lowph
Member
From: NL
Registered: 2011-10-14
Posts: 24

Re: pPub - A light ePub reader made with pygtk

When I try to run ppub I get the following error:

  File "/usr/bin/ppub", line 56
    return u'{%s}' % ', '.join([u'%s:%s' % (k,repr(v)) for k,v in items])
                 ^
SyntaxError: invalid syntax

Offline

#3 2011-10-27 21:46:03

frabjous
Member
Registered: 2010-07-13
Posts: 367

Re: pPub - A light ePub reader made with pygtk

Same problem as lowph.

I was going to ask whether it supported embedded fonts.

Offline

#4 2011-10-28 13:34:32

sakisds
Member
From: Athens, Greece
Registered: 2011-10-03
Posts: 105

Re: pPub - A light ePub reader made with pygtk

Sorry about that, I forgot that python 2.7 is in the python2 package, I updated the PKGBUILD, should work now.

@frabjous: I am sure fonts work if they are installed system-wide but I don't have a book that has embedded fonts to try (not exactly sure how epub packs them). Please try and if they don't work, I will see what I can do.

Offline

#5 2011-10-28 14:00:48

frabjous
Member
Registered: 2010-07-13
Posts: 367

Re: pPub - A light ePub reader made with pygtk

It doesn't seem to work at all, at least with the ones I tried. Now, a screen comes up, but it's blank and none of the navigation commands seem to do anything.

Here's an epub I created that has embedded fonts. (The work is public domain.) I made this by hand by hand-writing the XHTML and XML files and hand-zipping them up (in the appropriate way for the epub spec.) It passes epubcheck, so should work:
tlp.epub

Here's another one I made, but not by hand, but instead by converting through calibre (another public domain title). This one doesn't have embedded fonts, and doesn't pass epubcheck. (I don't think calibre's ever do, though... still, you'll want to support them.)
imp.epub

When I try to open that one, it says "Error opening file: No such file or directory" in the ppub window.

(I'm actually mostly interested in your viewer to make sure that epubs I make are compatible with it.)

I also tried it with the NET bible epub, with no luck. (No, before you ask, I'm not religious... I just figured that was probably a fairly standard book people will want it to work with.) It has embedded fonts, and passes epubcheck.

Last edited by frabjous (2011-10-28 14:04:26)

Offline

#6 2011-10-28 15:11:51

lowph
Member
From: NL
Registered: 2011-10-14
Posts: 24

Re: pPub - A light ePub reader made with pygtk

With the new PKGBUILD it works.
I was looking for a nice and simple epub viewer, thanks.


When the path or filename contains a round bracket ( it will crash giving:

sh: -c: line 0: syntax error near unexpected token `('
sh: -c: line 0: `unzip -d /tmp/ppub-cache/ '/home/username/ebookfilename (epub).epub''

It's a bit it annoying to switch between chapters using the menu or ctrl+right. I would prefer it to automatically go to the next chapter when reaching the end of a chapter.

Offline

#7 2011-10-28 15:16:15

sakisds
Member
From: Athens, Greece
Registered: 2011-10-03
Posts: 105

Re: pPub - A light ePub reader made with pygtk

I tried these files, both tlp.epub and the bible work fine but without the embedded fonts. After a bit of searching it seems that .css files can declare fonts that browsers use even if they are not installed on the machine. Theoretically, if I 'fix' the book's .css file to contain these declarations at extraction time the custom fonts should render without problems. I am trying to code this in meantime.

Also, after some changed the file made with calibre opens file (and more files should work too) but the chapters are in a wrong order. It seems the files are listed randomly in the .opf file. This will be fixed after I add support for table of contents (the .ncx file), but fonts take priority.

On a side note, it seems the links inside the book at the bible file mess up the current chapter value. They work, but when you try to change the chapter using the application you are back to where you were.

Offline

#8 2011-10-28 15:17:30

sakisds
Member
From: Athens, Greece
Registered: 2011-10-03
Posts: 105

Re: pPub - A light ePub reader made with pygtk

lowph wrote:

With the new PKGBUILD it works.
I was looking for a nice and simple epub viewer, thanks.


When the path or filename contains a round bracket ( it will crash giving:

sh: -c: line 0: syntax error near unexpected token `('
sh: -c: line 0: `unzip -d /tmp/ppub-cache/ '/home/username/ebookfilename (epub).epub''

It's a bit it annoying to switch between chapters using the menu or ctrl+right. I would prefer it to automatically go to the next chapter when reaching the end of a chapter.

Hm, thanks for noting, I will add code to sanitize the filenames. Also I will add more keyboard shortcuts.

Edit: Fixed, files with brackets (or other 'bad' characters) should work now.

Last edited by sakisds (2011-10-28 15:35:28)

Offline

#9 2011-10-28 15:28:42

lowph
Member
From: NL
Registered: 2011-10-14
Posts: 24

Re: pPub - A light ePub reader made with pygtk

That was fast.

Edit: Works like a charm.

Last edited by lowph (2011-10-28 15:34:03)

Offline

#10 2011-10-28 16:22:21

frabjous
Member
Registered: 2010-07-13
Posts: 367

Re: pPub - A light ePub reader made with pygtk

I still can't get either the net bible or tlp.epub to work at all. Same symptom as before: ppub opens but with a blank window.

imp.epub works, but as you say, with the chapters in the wrong order.

The output on the command line reads, after the stuff about extracting the files:

ERROR: Invalid browser function table. Some functionality may be restricted.
Picked up _JAVA_OPTIONS: -Dswing.defaultlaf=com.sun.java.swing.plaf.gtk.GTKLookAndFeel
java version "1.6.0_22"
OpenJDK Runtime Environment (IcedTea6 1.10.4) (ArchLinux-6.b22_1.10.4-1-x86_64)
OpenJDK 64-Bit Server VM (build 19.0-b09, mixed mode)

Offline

#11 2011-10-28 16:50:51

sakisds
Member
From: Athens, Greece
Registered: 2011-10-03
Posts: 105

Re: pPub - A light ePub reader made with pygtk

That's strange, Java shouldn't be there. I think webkit was trying to load browser plugins for some reason. Anyway I pushed a new version with plugins and javascript disabled (and some other browser-related features), both for security and because they are useless in epubs. Can you try and see if it works now?

Offline

#12 2011-10-29 01:15:34

frabjous
Member
Registered: 2010-07-13
Posts: 367

Re: pPub - A light ePub reader made with pygtk

No luck. Nothing on the command line now except the stuff about inflating the zipped files.

Offline

#13 2011-10-29 15:47:39

sakisds
Member
From: Athens, Greece
Registered: 2011-10-03
Posts: 105

Re: pPub - A light ePub reader made with pygtk

@frabjous: After some changes and testing, I managed to get the same output with Calibre on tlp.epub. On the same file lucidor defaulted to the system font. With the Bible all 3 viewers used the system font and with imp.epub all viewers used the embedded font. So I mark embedded fonts as supported.

The reason that these books doesn't load on your system is surely something else, I am trying to find the cause.

Offline

#14 2011-10-30 18:56:15

Nic0
Member
From: France
Registered: 2009-05-10
Posts: 29
Website

Re: pPub - A light ePub reader made with pygtk

Nice app, KISS as we like. It worked fine for me.
There are few more comments on Hacker News, that might give you some ideas.
Thanks for pPub.

Offline

#15 2011-10-31 12:43:40

sakisds
Member
From: Athens, Greece
Registered: 2011-10-03
Posts: 105

Re: pPub - A light ePub reader made with pygtk

Thanks, I will look into these suggestions when I got some time (temporary away from home).

Offline

#16 2011-11-01 23:10:13

kyla
Member
From: Arlington, VA
Registered: 2011-03-12
Posts: 112
Website

Re: pPub - A light ePub reader made with pygtk

I think the new version is missing some dependencies, until I installed python2-gobject ppub was refusing to launch and throwing  errors about how there was no module called gi.repository

Offline

#17 2011-11-02 13:10:25

sakisds
Member
From: Athens, Greece
Registered: 2011-10-03
Posts: 105

Re: pPub - A light ePub reader made with pygtk

Thanks for noting, fixed.

Offline

Board footer

Powered by FluxBB