diff options
author | Gonzalo Odiard <godiard@sugarlabs.org> | 2011-03-18 12:58:31 (GMT) |
---|---|---|
committer | Gonzalo Odiard <godiard@sugarlabs.org> | 2011-03-18 12:58:31 (GMT) |
commit | 259c02aebd969a38860e689679a7c10aeb2e3259 (patch) | |
tree | c43e6f561ca78f8b276bc5f5f46232b22046d852 /opds.py | |
parent | f8dcf9b7c68417ef1cd1d1dbfb9144d2857752e3 (diff) |
User interface reworked.
Show cover image
Diffstat (limited to 'opds.py')
-rw-r--r-- | opds.py | 17 |
1 files changed, 17 insertions, 0 deletions
@@ -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('+'): |