mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
...
This commit is contained in:
parent
a1edb22898
commit
f907da1433
@ -407,6 +407,8 @@ class BrowseServer(object):
|
|||||||
category_name = category_meta[category]['name']
|
category_name = category_meta[category]['name']
|
||||||
datatype = category_meta[category]['datatype']
|
datatype = category_meta[category]['datatype']
|
||||||
|
|
||||||
|
# See if we have any sub-categories to display. As we find them, add
|
||||||
|
# them to the displayed set to avoid showing the same item twice
|
||||||
uc_displayed = set()
|
uc_displayed = set()
|
||||||
cats = []
|
cats = []
|
||||||
for ucat in sorted(categories.keys(), key=sort_key):
|
for ucat in sorted(categories.keys(), key=sort_key):
|
||||||
@ -422,16 +424,19 @@ class BrowseServer(object):
|
|||||||
cat_len = len(category)
|
cat_len = len(category)
|
||||||
if not (len(ucat) > cat_len and ucat.startswith(category+'.')):
|
if not (len(ucat) > cat_len and ucat.startswith(category+'.')):
|
||||||
continue
|
continue
|
||||||
cat_len += 1
|
|
||||||
icon = category_icon_map['user:']
|
icon = category_icon_map['user:']
|
||||||
|
# we have a subcategory. Find any further dots (further subcats)
|
||||||
|
cat_len += 1
|
||||||
cat = ucat[cat_len:]
|
cat = ucat[cat_len:]
|
||||||
dot = cat.find('.')
|
dot = cat.find('.')
|
||||||
if dot > 0:
|
if dot > 0:
|
||||||
|
# More subcats
|
||||||
cat = cat[:dot]
|
cat = cat[:dot]
|
||||||
if cat not in uc_displayed:
|
if cat not in uc_displayed:
|
||||||
cats.append((cat, ucat[:cat_len+dot], icon))
|
cats.append((cat, ucat[:cat_len+dot], icon))
|
||||||
uc_displayed.add(cat)
|
uc_displayed.add(cat)
|
||||||
else:
|
else:
|
||||||
|
# This is the end of the chain
|
||||||
cats.append((cat, ucat, icon))
|
cats.append((cat, ucat, icon))
|
||||||
uc_displayed.add(cat)
|
uc_displayed.add(cat)
|
||||||
|
|
||||||
@ -450,6 +455,7 @@ class BrowseServer(object):
|
|||||||
else:
|
else:
|
||||||
script = 'true'
|
script = 'true'
|
||||||
|
|
||||||
|
# Now do the category items
|
||||||
items = categories[category]
|
items = categories[category]
|
||||||
sort = self.browse_sort_categories(items, sort)
|
sort = self.browse_sort_categories(items, sort)
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user