mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Implement searching the calibre catalog in the Stanza. Fixes #3014 (Support searching from stanza)
This commit is contained in:
parent
35bc41bbbc
commit
efe4adfe48
@ -100,6 +100,7 @@ class LibraryServer(object):
|
||||
<title>calibre Library</title>
|
||||
<id>$id</id>
|
||||
<updated>${updated.strftime('%Y-%m-%dT%H:%M:%S+00:00')}</updated>
|
||||
<link rel="search" title="Search" type="application/atom+xml" href="/?search={searchTerms}"/>
|
||||
<author>
|
||||
<name>calibre</name>
|
||||
<uri>http://calibre.kovidgoyal.net</uri>
|
||||
@ -283,10 +284,12 @@ class LibraryServer(object):
|
||||
|
||||
|
||||
@expose
|
||||
def stanza(self):
|
||||
def stanza(self, search=None):
|
||||
'Feeds to read calibre books on a ipod with stanza.'
|
||||
books = []
|
||||
ids = self.db.data.parse(search) if search and search.strip() else self.db.data.universal_set()
|
||||
for record in iter(self.db):
|
||||
if record[0] not in ids: continue
|
||||
r = record[FIELD_MAP['formats']]
|
||||
r = r.upper() if r else ''
|
||||
if 'EPUB' in r or 'PDB' in r:
|
||||
@ -371,7 +374,7 @@ class LibraryServer(object):
|
||||
'The / URL'
|
||||
want_opds = cherrypy.request.headers.get('Stanza-Device-Name', 919) != \
|
||||
919 or cherrypy.request.headers.get('Want-OPDS-Catalog', 919) != 919
|
||||
return self.stanza() if want_opds else self.static('index.html')
|
||||
return self.stanza(search=kwargs.get('search', None)) if want_opds else self.static('index.html')
|
||||
|
||||
|
||||
@expose
|
||||
|
@ -48,7 +48,7 @@ recipe_modules = ['recipe_' + r for r in (
|
||||
'the_budget_fashionista', 'elperiodico_catalan',
|
||||
'elperiodico_spanish', 'expansion_spanish', 'lavanguardia',
|
||||
'marca', 'kellog_faculty', 'kellog_insight', 'noaa',
|
||||
'theeconomictimes_india', '7dias', 'buenosaireseconomico',
|
||||
'7dias', 'buenosaireseconomico',
|
||||
'diagonales', 'miradasalsur', 'newsweek_argentina', 'veintitres',
|
||||
'gva_be', 'hln', 'tijd', 'degentenaar', 'inquirer_net', 'uncrate',
|
||||
'fastcompany', 'accountancyage', 'laprensa_hn', 'latribuna',
|
||||
|
Loading…
x
Reference in New Issue
Block a user