mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Add the possibility to make an 'all by something' collection. Syntax: abs:collection_name. If there is an entry in the tweak sony_sort_collections_by, then that controls the sorting, otherwise the collection name is assumed to be a field. Sorts by title_sort within sort_field
This commit is contained in:
parent
47168fa3f3
commit
e98f14292a
@ -140,11 +140,19 @@ class CollectionsBookList(BookList):
|
||||
all_by_author = ''
|
||||
all_by_title = ''
|
||||
ca = []
|
||||
all_by_something = []
|
||||
for c in collection_attributes:
|
||||
if c.startswith('aba:') and c[4:]:
|
||||
if c.startswith('aba:') and c[4:].strip():
|
||||
all_by_author = c[4:].strip()
|
||||
elif c.startswith('abt:') and c[4:]:
|
||||
elif c.startswith('abt:') and c[4:].strip():
|
||||
all_by_title = c[4:].strip()
|
||||
elif c.startswith('abs:') and c[4:].strip():
|
||||
name = c[4:].strip()
|
||||
sby = self.in_category_sort_rules(name)
|
||||
if sby is None:
|
||||
sby = name
|
||||
if name and sby:
|
||||
all_by_something.append((name, sby))
|
||||
else:
|
||||
ca.append(c.lower())
|
||||
collection_attributes = ca
|
||||
@ -251,6 +259,10 @@ class CollectionsBookList(BookList):
|
||||
if all_by_title not in collections:
|
||||
collections[all_by_title] = {}
|
||||
collections[all_by_title][lpath] = (book, tsval, asval)
|
||||
for (n, sb) in all_by_something:
|
||||
if n not in collections:
|
||||
collections[n] = {}
|
||||
collections[n][lpath] = (book, book.get(sb, ''), tsval)
|
||||
|
||||
# Sort collections
|
||||
result = {}
|
||||
|
Loading…
x
Reference in New Issue
Block a user