Quote:
Originally Posted by Wiggo
Hi capink,
it is possible to separate the aliases like in the normal authors (black instead of blue ampersand)?
|
Unfortunatly, this is not possible. Custom columns in calibre do not support ampersands as a separator. I opened a
bug report a while back about this issue, but it was not addressed because of technical difficulties.
Quote:
Originally Posted by Wiggo
I have a group-search "pen-names" with authors and #alias and do my similar authors search by this pen-names. If I search for "Robert Lynn Asprin" all the books with Robert Asprin & Co-Author will not be found, because the alias is e.g. "Robert Lynn Asprin & Linda Evans" and not "Robert Lynn Asprin" & "Linda Evans".
I hope I expressed it clearly
|
The solution for your problem is to do away with ampersands as separator and fall back to using commas. You can do this by modifying the template function as below
Code:
def evaluate(self, formatter, kwargs, mi, locals, val, col_name, user_cat_prefix):
new_val = ''
if hasattr(mi, '_proxy_metadata'):
all_cats = mi._proxy_metadata.user_categories
cats = {k:v for k,v in all_cats.items() if k.startswith(user_cat_prefix)}
SEP = mi.metadata_for_field(col_name)['is_multiple'].get('list_to_ui', '')
new_val = set()
if SEP:
val_ = val.split(SEP)
else:
val_ = [val]
for user_cat, v in cats.items():
repl = user_cat.lstrip(user_cat_prefix)
for user_cat_item, src_cat in v:
if src_cat == col_name:
for item in val_[:]:
if item == user_cat_item:
new_val.add(repl)
val_.remove(item)
else:
new_val.add(item)
if new_val:
return ', '.join(list(new_val))
return val
Note, however, that this will break author names with commas in them.
Edit: Alternatively, you can keep your original setup, and modify your search from:
Code:
#alias:"=Robert Lynn Asprin"
into:
Code:
#alias:"Robert Lynn Asprin"
Edit2: If search you are referring to Find Duplicates (Rather than calibre search), the advanced mode of the Find Duplicates has an option called ("composite has names"), all you have to do is to tick that option.