Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/opds.py
diff options
context:
space:
mode:
authorGonzalo Odiard <godiard@sugarlabs.org>2011-03-18 12:58:31 (GMT)
committer Gonzalo Odiard <godiard@sugarlabs.org>2011-03-18 12:58:31 (GMT)
commit259c02aebd969a38860e689679a7c10aeb2e3259 (patch)
treec43e6f561ca78f8b276bc5f5f46232b22046d852 /opds.py
parentf8dcf9b7c68417ef1cd1d1dbfb9144d2857752e3 (diff)
User interface reworked.
Show cover image
Diffstat (limited to 'opds.py')
-rw-r--r--opds.py17
1 files changed, 17 insertions, 0 deletions
diff --git a/opds.py b/opds.py
index 210eaea..34f7f9e 100644
--- a/opds.py
+++ b/opds.py
@@ -30,6 +30,7 @@ _FEEDBOOKS_URI = 'http://feedbooks.com/books/search.atom?query='
_INTERNETARCHIVE_URI = 'http://bookserver.archive.org/catalog/opensearch?q='
_REL_OPDS_ACQUISTION = u'http://opds-spec.org/acquisition'
+_REL_OPDS_COVER = u'http://opds-spec.org/image'
gobject.threads_init()
@@ -124,6 +125,22 @@ class Book(object):
return ret
+ def get_image_url(self):
+ try:
+ ret = {}
+ for link in self._entry['links']:
+ if link['rel'] == _REL_OPDS_COVER:
+ if self._basepath is not None and \
+ not (link['href'].startswith('http') or \
+ link['href'].startswith('ftp')):
+ ret[link['type']] = 'file://' \
+ + os.path.join(self._basepath, link['href'])
+ else:
+ ret[link['type']] = link['href']
+ except KeyError:
+ ret = 'Unknown'
+ return ret
+
def match(self, terms):
#TODO: Make this more comprehensive
for term in terms.split('+'):