mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-08-11 09:13:57 -04:00
Allow searching for tags in the device view. Works for books on the device that came from calibre or have matched a calibre book in the past.
This commit is contained in:
parent
da1648b94d
commit
352ee20933
@ -1104,7 +1104,8 @@ class OnDeviceSearch(SearchQueryParser): # {{{
|
|||||||
'format',
|
'format',
|
||||||
'formats',
|
'formats',
|
||||||
'title',
|
'title',
|
||||||
'inlibrary'
|
'inlibrary',
|
||||||
|
'tags'
|
||||||
]
|
]
|
||||||
|
|
||||||
def __init__(self, model):
|
def __init__(self, model):
|
||||||
@ -1142,7 +1143,8 @@ class OnDeviceSearch(SearchQueryParser): # {{{
|
|||||||
'author': lambda x: ' & '.join(getattr(x, 'authors')).lower(),
|
'author': lambda x: ' & '.join(getattr(x, 'authors')).lower(),
|
||||||
'collections':lambda x: ','.join(getattr(x, 'device_collections')).lower(),
|
'collections':lambda x: ','.join(getattr(x, 'device_collections')).lower(),
|
||||||
'format':lambda x: os.path.splitext(x.path)[1].lower(),
|
'format':lambda x: os.path.splitext(x.path)[1].lower(),
|
||||||
'inlibrary':lambda x : getattr(x, 'in_library')
|
'inlibrary':lambda x : getattr(x, 'in_library'),
|
||||||
|
'tags':lambda x : getattr(x, 'tags')
|
||||||
}
|
}
|
||||||
for x in ('author', 'format'):
|
for x in ('author', 'format'):
|
||||||
q[x+'s'] = q[x]
|
q[x+'s'] = q[x]
|
||||||
@ -1169,6 +1171,8 @@ class OnDeviceSearch(SearchQueryParser): # {{{
|
|||||||
else:
|
else:
|
||||||
m = matchkind
|
m = matchkind
|
||||||
|
|
||||||
|
vals = accessor(row)
|
||||||
|
if not isinstance(vals, list):
|
||||||
if locvalue == 'collections':
|
if locvalue == 'collections':
|
||||||
vals = accessor(row).split(',')
|
vals = accessor(row).split(',')
|
||||||
else:
|
else:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user