mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
pep8
This commit is contained in:
parent
233395c0d4
commit
255fcce9e5
@ -126,7 +126,7 @@ def CATALOG_ENTRY(item, item_kind, base_href, version, updated,
|
|||||||
if item.id is not None:
|
if item.id is not None:
|
||||||
iid = 'I' + str(item.id)
|
iid = 'I' + str(item.id)
|
||||||
iid += ':'+item_kind
|
iid += ':'+item_kind
|
||||||
link = NAVLINK(href = base_href + '/' + hexlify(iid))
|
link = NAVLINK(href=base_href + '/' + hexlify(iid))
|
||||||
count = (_('%d books') if item.count > 1 else _('%d book'))%item.count
|
count = (_('%d books') if item.count > 1 else _('%d book'))%item.count
|
||||||
if ignore_count:
|
if ignore_count:
|
||||||
count = ''
|
count = ''
|
||||||
@ -145,7 +145,7 @@ def CATALOG_ENTRY(item, item_kind, base_href, version, updated,
|
|||||||
def CATALOG_GROUP_ENTRY(item, category, base_href, version, updated):
|
def CATALOG_GROUP_ENTRY(item, category, base_href, version, updated):
|
||||||
id_ = 'calibre:category-group:'+category+':'+item.text
|
id_ = 'calibre:category-group:'+category+':'+item.text
|
||||||
iid = item.text
|
iid = item.text
|
||||||
link = NAVLINK(href = base_href + '/' + hexlify(iid))
|
link = NAVLINK(href=base_href + '/' + hexlify(iid))
|
||||||
return E.entry(
|
return E.entry(
|
||||||
TITLE(item.text),
|
TITLE(item.text),
|
||||||
ID(id_),
|
ID(id_),
|
||||||
@ -176,7 +176,7 @@ def ACQUISITION_ENTRY(item, version, db, updated, CFM, CKEYS, prefix):
|
|||||||
no_tag_count=True)))
|
no_tag_count=True)))
|
||||||
series = item[FM['series']]
|
series = item[FM['series']]
|
||||||
if series:
|
if series:
|
||||||
extra.append(_('SERIES: %(series)s [%(sidx)s]<br />')%\
|
extra.append(_('SERIES: %(series)s [%(sidx)s]<br />')%
|
||||||
dict(series=xml(series),
|
dict(series=xml(series),
|
||||||
sidx=fmt_sidx(float(item[FM['series_index']]))))
|
sidx=fmt_sidx(float(item[FM['series_index']]))))
|
||||||
for key in CKEYS:
|
for key in CKEYS:
|
||||||
@ -273,8 +273,8 @@ class TopLevel(Feed): # {{{
|
|||||||
updated, # datetime object in UTC
|
updated, # datetime object in UTC
|
||||||
categories,
|
categories,
|
||||||
version,
|
version,
|
||||||
id_ = 'urn:calibre:main',
|
id_='urn:calibre:main',
|
||||||
subtitle = _('Books in your library')
|
subtitle=_('Books in your library')
|
||||||
):
|
):
|
||||||
Feed.__init__(self, id_, updated, version, subtitle=subtitle)
|
Feed.__init__(self, id_, updated, version, subtitle=subtitle)
|
||||||
|
|
||||||
@ -335,7 +335,6 @@ class CategoryGroupFeed(NavFeed):
|
|||||||
self.root.append(CATALOG_GROUP_ENTRY(item, which, base_href, version, updated))
|
self.root.append(CATALOG_GROUP_ENTRY(item, which, base_href, version, updated))
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
class OPDSServer(object):
|
class OPDSServer(object):
|
||||||
|
|
||||||
def add_routes(self, connect):
|
def add_routes(self, connect):
|
||||||
@ -452,7 +451,6 @@ class OPDSServer(object):
|
|||||||
return str(CategoryFeed(items, category, id_, updated, version, offsets,
|
return str(CategoryFeed(items, category, id_, updated, version, offsets,
|
||||||
page_url, up_url, self.db))
|
page_url, up_url, self.db))
|
||||||
|
|
||||||
|
|
||||||
def opds_navcatalog(self, which=None, version=0, offset=0):
|
def opds_navcatalog(self, which=None, version=0, offset=0):
|
||||||
try:
|
try:
|
||||||
offset = int(offset)
|
offset = int(offset)
|
||||||
@ -563,7 +561,8 @@ class OPDSServer(object):
|
|||||||
raise cherrypy.HTTPError(404, 'Non id categories not supported')
|
raise cherrypy.HTTPError(404, 'Non id categories not supported')
|
||||||
|
|
||||||
q = category
|
q = category
|
||||||
if q == 'news': q = 'tags'
|
if q == 'news':
|
||||||
|
q = 'tags'
|
||||||
ids = self.db.get_books_for_category(q, which)
|
ids = self.db.get_books_for_category(q, which)
|
||||||
sort_by = 'series' if category == 'series' else 'title'
|
sort_by = 'series' if category == 'series' else 'title'
|
||||||
|
|
||||||
@ -573,7 +572,6 @@ class OPDSServer(object):
|
|||||||
|
|
||||||
# }}}
|
# }}}
|
||||||
|
|
||||||
|
|
||||||
def opds(self, version=0):
|
def opds(self, version=0):
|
||||||
version = int(version)
|
version = int(version)
|
||||||
if version not in BASE_HREFS:
|
if version not in BASE_HREFS:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user