mirror of
https://github.com/evilhero/mylar
synced 2025-02-08 15:24:45 +00:00
OPDS Publisher Indexing
This commit is contained in:
parent
2ae50b5401
commit
07b0ad3565
1 changed files with 11 additions and 2 deletions
|
@ -158,6 +158,9 @@ class OPDS(object):
|
||||||
return
|
return
|
||||||
|
|
||||||
def _Publishers(self, **kwargs):
|
def _Publishers(self, **kwargs):
|
||||||
|
index = 0
|
||||||
|
if 'index' in kwargs:
|
||||||
|
index = int(kwargs['index'])
|
||||||
myDB = db.DBConnection()
|
myDB = db.DBConnection()
|
||||||
feed = {}
|
feed = {}
|
||||||
feed['title'] = 'Mylar OPDS - Publishers'
|
feed['title'] = 'Mylar OPDS - Publishers'
|
||||||
|
@ -167,7 +170,6 @@ class OPDS(object):
|
||||||
entries=[]
|
entries=[]
|
||||||
links.append(getLink(href='/opds',type='application/atom+xml;profile=opds-catalog;kind=navigation', rel='start', title='Home'))
|
links.append(getLink(href='/opds',type='application/atom+xml;profile=opds-catalog;kind=navigation', rel='start', title='Home'))
|
||||||
links.append(getLink(href='/opds?cmd=Publishers',type='application/atom+xml;profile=opds-catalog;kind=navigation',rel='self'))
|
links.append(getLink(href='/opds?cmd=Publishers',type='application/atom+xml;profile=opds-catalog;kind=navigation',rel='self'))
|
||||||
links.append(getLink(href='/opds?cmd=search', type='application/opensearchdescription+xml',rel='search',title='Search'))
|
|
||||||
publishers = myDB.select("SELECT ComicPublisher from comics GROUP BY ComicPublisher")
|
publishers = myDB.select("SELECT ComicPublisher from comics GROUP BY ComicPublisher")
|
||||||
comics = mylar.helpers.havetotals()
|
comics = mylar.helpers.havetotals()
|
||||||
for publisher in publishers:
|
for publisher in publishers:
|
||||||
|
@ -186,8 +188,15 @@ class OPDS(object):
|
||||||
'kind': 'navigation',
|
'kind': 'navigation',
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
if len(entries) > (index + 30):
|
||||||
|
links.append(
|
||||||
|
getLink(href='/opds?cmd=Publishers&index=%s' % (index+30), type='application/atom+xml;profile=opds-catalog;kind=navigation', rel='next'))
|
||||||
|
if index >= 30:
|
||||||
|
links.append(
|
||||||
|
getLink(href='/opds?cmd=Publishers&index=%s' % (index-30), type='application/atom+xml;profile=opds-catalog;kind=navigation', rel='previous'))
|
||||||
|
|
||||||
feed['links'] = links
|
feed['links'] = links
|
||||||
feed['entries'] = entries
|
feed['entries'] = entries[index:(index+30)]
|
||||||
self.data = feed
|
self.data = feed
|
||||||
return
|
return
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue