View Full Version : read epub from a shell


farvardin
07-25-2011, 10:28 AM
I was just wondering if there was a tool to read ebooks (epub) in the (unix) console.
It's still possible to export to html and read them with links for example, but a tool dedicated to ebooks, with bookmarks and such would be great.

DiapDealer
07-25-2011, 10:59 AM
As much as I love—and rely on—the bash prompt, I really can't see this happening. Someone out there somewhere might spend time developing their own console epub reader... maybe. But even then, I doubt it would be easy to find.

Maybe start with the source for Lynx, if someone wanted to take a stab at it?

farvardin
12-02-2011, 01:31 PM
there is this now : http://www.emacswiki.org/emacs/epubmode.el

Namekuseijin
12-02-2011, 03:54 PM
considering epub is basically some sort of compiled html, this would be a natural choice for lynx or elinks to receive a patch.

AZdave
12-07-2011, 05:02 PM
You can try this.
unzip -x -C your.epub
lynx -image_links ./content/
it is somewhat tedious.

Jellby
12-08-2011, 05:33 AM
Well, you could try with this script (http://www.mobileread.com/forums/showthread.php?t=51267), and then open with lynx.

SBT
12-08-2011, 08:48 AM
Oooh! Nice...:2thumbsup
Even if it doesn't seem to work straight out of the box with lynx.
lynx apparently does not respect the 'xml:base="{dir}"' attribute, so that has to be set explicitly in the links in indexAAA.xhtml, I think.
Lynx does not handle <meta .... charset=.../>, I had to remove those lines from the book chapter xhtml files to get it to show anything but pure ascii.
Just a couple of minor modifications in the script should fix those. Maybe have a specific -shellepubreader option?

And of course one has to set up lynx to handle xhtml files (http://kolpackov.net/projects/lynx/xhtml.xhtml) in the first place.

AZdave
12-09-2011, 01:06 AM
@Jellby: Thanks.

@SBT

Please post your modifications. This is neat.

SBT
12-09-2011, 07:27 AM
I've posted a patch (http://www.mobileread.com/forums/showpost.php?p=1870493&postcount=5) at the original thread for the script.
Hope it works for you too.

AZdave
12-09-2011, 03:33 PM
SBT:

Thanks. Just to be clear for others. I had to

patch epub-read.sh epub-read_lynxviewer.patch
epub-read.sh -v Oz_Omnibus.epub

The -v switch uses lynx
I also turned images on in the lynx.conf file by adding the following.

XLOADIMAGE_COMMAND:xv %s &
MAKE_LINKS_FOR_ALL_IMAGES:TRUE

Thanks

SBT
12-13-2011, 01:22 PM
Having got this far, a thought struck me... lynx has been popular among the visually impaired because it has been simple to integrate with text-to-speech tools. While we're at it, maybe add an option to pipe output from lynx to the festival TTS?
BTW, anybody know about epub-to-speech converters? Or user interface guidelines for the blind?

AZdave
12-15-2011, 03:39 PM
Having got this far, a thought struck me... lynx has been popular among the visually impaired because it has been simple to integrate with text-to-speech tools. While we're at it, maybe add an option to pipe output from lynx to the festival TTS?
BTW, anybody know about epub-to-speech converters? Or user interface guidelines for the blind?

Luckily my linux box at work has festival on it. It is pretty easy.


PRINTER:TTS:festival --tts %s:80
DOWNLOADER:TTS:festival --tts %s


The speech is low to medium quality.
p and select TTS . the number 80 is optional but it read the whole file.

The DOWNLOADER reads the html tags to you so it is not needed.

or

lynx -cfg=lynx.config indexAAA.html | festival --tts

But then I'm lost trying to select the links.

farvardin
12-16-2011, 04:02 AM
thank you for all those tips!

SBT
12-16-2011, 07:10 PM
@AZDave: That's neat... I thought about something along the lines of your second solution, but defining the TTS as a printer is much more elegant.
I wonder if it is possible to implement a pause/play functionality? I can't think of a particularly good solution, sending STOP/CONT signals to festival seems the only feasible option, and I'm not sure how to do that in a sensible manner through lynx.

Jellby
12-17-2011, 04:35 AM
Maybe through system-wide hotkeys?

AZdave
12-20-2011, 11:16 PM
@AZDave:
...
I wonder if it is possible to implement a pause/play functionality? I can't think of a particularly good solution, sending STOP/CONT signals to festival seems the only feasible option, and I'm not sure how to do that in a sensible manner through lynx.

I'm on Holiday. My linux box at home doesn't have sound hooked up (yet). But this more or less should work. If Lynx can not handle pipes, wrapping more and festival into a simple shell script should also work.

But now you would have to hit the space bar to read a chapter. And the reading could occur mid-line.

PRINTER:TTSpause:more %s|festival --tts :80

Last Edited 13Jan2012: This does not pause the sound. It plays sound the same as not using more.

SBT
12-28-2011, 05:49 PM
... or maybe it is possible to pipe festival to a music player - preferably a non-gui one. Both vlc and mplayer could do it.

AZdave
01-13-2012, 09:28 PM
But now you would have to hit the space bar to read a chapter. And the reading could occur mid-line.

PRINTER:TTSpause:more %s|festival --tts :80

Last Edited 13Jan2012: This does not pause the sound. It plays sound the same as not using more.

Just to let you know this DOES NOT work.

SBT
01-23-2012, 04:14 PM
Grmf... Tried various ways of piping output from festival to some kind of music player, but no can do.
However, you could use festival's txt2wave to do a conversion of the entire chapter to a sound file. But then it becomes rather pointless to use lynx in the first place.