Hi new to linux, I can't get fbreader installed via fbreader repo

50 views
Skip to first unread message

brad kelley

unread,
Jul 21, 2010, 12:48:51 AM7/21/10
to FBReader
I am new to linux and recently bought an n900 to learn plus a kindle
and some oreilly books. anyway, I love how the oreilly epub technical
books format (much better then their .mobi) on the n900. but the .mobi
has the table of contents working and the epub just takes me to a
blank page that has a blue hyperlink to "cover" when I hit the table
of contents tab. that is a real bummer as I really can't navigate the
oreilly books with no toc especially on a 3 1/2 device (n900) but the
epub formatting is just so much better then the .mobi.

anyway I tried installing the latest version of fbreader on my ubuntu
via the instructions on the web site. I put the repos in /etc/apt/
sources.list and then I get kind of lost. what I did was wget
http://www.fbreader.org/desktop/debian/geometer.fbreader.org.asc to my
user home and then run ....

brad@ubnuntu:~$ sudo apt-key add geometer.fbreader.org.asc
gpg: [don't know]: invalid packet (ctb=0a)
gpg: keydb_get_keyblock failed: eof
gpg: [don't know]: invalid packet (ctb=0a)
gpg: /etc/apt/trusted.gpg: copy to `/etc/apt/trusted.gpg.tmp' failed:
invalid packet
gpg: error writing keyring `/etc/apt/trusted.gpg': invalid packet
gpg: error reading `geometer.fbreader.org.asc': invalid packet
gpg: import from `geometer.fbreader.org.asc' failed: invalid packet

i have no idea if I am doing this right (again I am new to linux) but
in the end I can't get the repos working. I was able to do a regular
apt-get install fbreader after commenting out the fbreader repo in /
etc/apt/sources.list and it installed the app from a ubuntu repo
(0.12.10) with no issue. and from there I still could not see the toc
on my oreilly epub book....:(

so I guess it is really 2 issues.

1) am I doing something wrong that the apt-key add command fails?

2) is there any way that toc can be made to work on the oreilly.com
epub books? sadly I see the n900 is on fbreader 0.10.7-13 so that is
lagging, but if I knew that it was working on the newest version on my
ubuntu computer I would have some hope that it would get upgraded on
the n900.

I am avoiding buying a sony pocket reader till i make certain that toc
will not work on the oreilly.

thanks so much for listening, the second issue (getting toc working or
oreilly is most important, but as a new linux user I really wanted to
know if i am just totally not getting how to add a repo and import a
public key...

dannym

unread,
Jul 24, 2010, 2:32:48 PM7/24/10
to FBReader
Hi,

The book in question contains the namespace
xmlns:ncx="http://www.daisy.org/z3986/2005/ncx/"
in the subfile "toc.ncx" - however, the FBReader OEB NCX parser did
not care about namespaces at all and so you will get tagName
"ncx:navMap" which is not equal to "navMap".

To fix that, I suggest to change the following (I've also made the
functions protected since their original definition in the ZLIbrary
core is protected as well, not private):

diff -upr orig/fbreader-0.12.10/fbreader/src/formats/oeb/NCXReader.cpp
fbreader-0.12.10/fbreader/src/formats/oeb/NCXReader.cpp
--- orig/fbreader-0.12.10/fbreader/src/formats/oeb/NCXReader.cpp
2010-04-01 15:14:24.000000000 +0200
+++ fbreader-0.12.10/fbreader/src/formats/oeb/NCXReader.cpp 2010-07-24
20:19:27.000000000 +0200
@@ -32,27 +32,41 @@ static const std::string TAG_NAVLABEL =
static const std::string TAG_CONTENT = "content";
static const std::string TAG_TEXT = "text";

+bool NCXReader::processNamespaces() const {
+ return true;
+}
+
+void NCXReader::namespaceListChangedHandler() {
+ const std::map<std::string,std::string>& namespaces = this-
>namespaces();
+ for (std::map<std::string,std::string>::const_iterator it =
namespaces.begin(); it != namespaces.end(); ++it) {
+ if (it->second == "http://www.daisy.org/z3986/2005/ncx/") {
+ myNCXNamespacePrefix = it->first + ":";
+ }
+ }
+
+}
+
void NCXReader::startElementHandler(const char *tag, const char
**attributes) {
switch (myReadState) {
case READ_NONE:
- if (TAG_NAVMAP == tag) {
+ if (myNCXNamespacePrefix + TAG_NAVMAP == tag) {
myReadState = READ_MAP;
}
break;
case READ_MAP:
- if (TAG_NAVPOINT == tag) {
+ if (myNCXNamespacePrefix + TAG_NAVPOINT == tag) {
const char *order = attributeValue(attributes, "playOrder");
myPointStack.push_back(NavPoint((order != 0) ? atoi(order) :
myPlayIndex++, myPointStack.size()));
myReadState = READ_POINT;
}
break;
case READ_POINT:
- if (TAG_NAVPOINT == tag) {
+ if (myNCXNamespacePrefix + TAG_NAVPOINT == tag) {
const char *order = attributeValue(attributes, "playOrder");
myPointStack.push_back(NavPoint((order != 0) ? atoi(order) :
myPlayIndex++, myPointStack.size()));
- } else if (TAG_NAVLABEL == tag) {
+ } else if (myNCXNamespacePrefix + TAG_NAVLABEL == tag) {
myReadState = READ_LABEL;
- } else if (TAG_CONTENT == tag) {
+ } else if (myNCXNamespacePrefix + TAG_CONTENT == tag) {
const char *src = attributeValue(attributes, "src");
if (src != 0) {
myPointStack.back().ContentHRef = MiscUtil::decodeHtmlURL(src);
@@ -60,7 +74,7 @@ void NCXReader::startElementHandler(cons
}
break;
case READ_LABEL:
- if (TAG_TEXT == tag) {
+ if (myNCXNamespacePrefix + TAG_TEXT == tag) {
myReadState = READ_TEXT;
}
break;
@@ -74,12 +88,12 @@ void NCXReader::endElementHandler(const
case READ_NONE:
break;
case READ_MAP:
- if (TAG_NAVMAP == tag) {
+ if (myNCXNamespacePrefix + TAG_NAVMAP == tag) {
myReadState = READ_NONE;
}
break;
case READ_POINT:
- if (TAG_NAVPOINT == tag) {
+ if (myNCXNamespacePrefix + TAG_NAVPOINT == tag) {
if (myPointStack.back().Text.empty()) {
myPointStack.back().Text = "...";
}
@@ -88,12 +102,12 @@ void NCXReader::endElementHandler(const
myReadState = myPointStack.empty() ? READ_MAP : READ_POINT;
}
case READ_LABEL:
- if (TAG_NAVLABEL == tag) {
+ if (myNCXNamespacePrefix + TAG_NAVLABEL == tag) {
myReadState = READ_POINT;
}
break;
case READ_TEXT:
- if (TAG_TEXT == tag) {
+ if (myNCXNamespacePrefix + TAG_TEXT == tag) {
myReadState = READ_LABEL;
}
break;
diff -upr orig/fbreader-0.12.10/fbreader/src/formats/oeb/NCXReader.h
fbreader-0.12.10/fbreader/src/formats/oeb/NCXReader.h
--- orig/fbreader-0.12.10/fbreader/src/formats/oeb/NCXReader.h
2010-04-01 15:14:24.000000000 +0200
+++ fbreader-0.12.10/fbreader/src/formats/oeb/NCXReader.h 2010-07-24
20:18:38.000000000 +0200
@@ -44,16 +44,21 @@ public:
NCXReader(BookReader &modelReader);
const std::map<int,NavPoint> &navigationMap() const;

-private:
+protected:
void startElementHandler(const char *tag, const char **attributes);
void endElementHandler(const char *tag);
void characterDataHandler(const char *text, size_t len);
+ void namespaceListChangedHandler();
+ bool processNamespaces() const;
+
+private:
const std::vector<std::string> &externalDTDs() const;

private:
BookReader &myModelReader;
std::map<int,NavPoint> myNavigationMap;
std::vector<NavPoint> myPointStack;
+ std::string myNCXNamespacePrefix;

enum {
READ_NONE,
-----here ends this patch----
Reply all
Reply to author
Forward
0 new messages