![]() |
#1 |
Junior Member
![]() Posts: 8
Karma: 10
Join Date: Jun 2017
Device: Onyx Boox Poke2, 3 & 5 / OnePlus 5T / Amazon Fire HD 10
|
New Tag Browser Hierarchy from Existing Columns
Hi,
I would like to create a new Tag browser Hierarchy based upon Authors and Series - with each author listed once at the top level, similar to the Author(s) group, and all the series that they either authored or co-authored at the second level. Authors should be shown in lastname order I've played around with the template language in order to try an get this working, but the closest I've come to a solution is a hierarchy that only includes the first author of the series using this template I found via Google :- {author_sort:'re(sublist($, 0, 1, '&'), '\.', '')'}.{series} I'm not much good with Python - does anyone have some more pointers?Thanks in advance, sllewji |
![]() |
![]() |
![]() |
#2 |
Grand Sorcerer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 24,905
Karma: 47303824
Join Date: Jul 2011
Location: Sydney, Australia
Device: Kobo:Touch,Glo, AuraH2O, GloHD,AuraONE, ClaraHD, Libra H2O; tolinoepos
|
As a first pass, the following will produce a value that is the first author plus the series:
Code:
program: if $series then strcat(sublist($author_sort, 0, 1, '&'), '.', $series) fi Code:
Butcher, Jim.The Dresden Files If you want to simply use the full author sort, then remove the use of the sublist function. To get an entry for each author: Code:
program: program: if $series then val = list_re($author_sort, ' & ', '^(.*)$', strcat('\1.', $series)); val = re(val, ',', '_'); val = re(val, ' & ', ','); val = re(val, '\.\.', '.') fi The "re"s are to change the commas to underscores so the tags don't get split there. Then the ampersand to commas so they do. Then, if there a two dots together, change it to one so that you will get the hierarchy. This was a problem for authors like "Firstname I. Surname" which will be "Surname, Firstname I." and when the ".Series Name" is added, the hierarchy split doesn't happen. It looks ugly, but is seems to work. |
![]() |
![]() |
Advert | |
|
![]() |
#3 |
Junior Member
![]() Posts: 8
Karma: 10
Join Date: Jun 2017
Device: Onyx Boox Poke2, 3 & 5 / OnePlus 5T / Amazon Fire HD 10
|
Thank you for your proposed solution, and the detailed explanation was very helpful indeed.
This does indeed get a lot farther along than my attempts. I've removed all full-stops from my authors to avoid the initials issue. This works perfectly for single authored books, but is still not quite there for co-authored ones. Dual authored books, I get a three level hierarchy looking like this :- -Anderson_ Kevin J - Dune Caladan, Herbert_ Brian - Dune Caladan and under the author Herbert_ Brian there is no hierarchy including Dune Caladan. It seems as if the list is not being separated at the comma into the two separate hierarchy entries. Triple authored books, such as Road to Dune by Frank Herbert, Brian Herbert and Kevin J Anderson don't appear anywhere in the hierarchy which is again, I guess, associated by the extra comma. I've tried messing around with subitem() to see if it would help, but then I lost single authored series all together. I'd be most grateful if you had any further pointers or ideas. |
![]() |
![]() |
![]() |
#4 |
Grand Sorcerer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 24,905
Karma: 47303824
Join Date: Jul 2011
Location: Sydney, Australia
Device: Kobo:Touch,Glo, AuraH2O, GloHD,AuraONE, ClaraHD, Libra H2O; tolinoepos
|
I might have missed what you want. Or, I need to see some examples of the data to make sure we are discussing the same thing. For example, with the last template and a book:
Title: Road to Dune Authors: Frank Herbert & Brian Herbert & Kevin J Anderson Author Sort: Herbert, Frank & Herbert, Brian & Anderson, Kevin J Series: Dune With that, the result of the template is: Herbert_ Frank.Dune,Herbert_ Brian.Dune,Anderson_ Kevin J.Dune That gives me three entries in the tag browser: Herbert_ Frank.Dune Herbert_ Brian.Dune Anderson_ Kevin J.Dune Each containing the book. If I create a book with two authors: Title: Dune Caladan book 1 Authors: Kevin J Anderson & Brian Herbert Author Sort: Anderson, Kevin J & Herbert, Brian Series: Dune Caladan With that, the result of the template is: Anderson_ Kevin J.Dune Caladan,Herbert_ Brian.Dune Caladan That gives me three entries in the tag browser: Anderson_ Kevin J.Dune Caladan Herbert_ Brian.Dune Caladan With the book in both. And for all numbers of authors, if there is no series, the result of the template is empty, and the book will not be in the tags browser. I think the above is what you are after. But, if it isn't, some examples of both the book metadata and what you expect to see. |
![]() |
![]() |
![]() |
#5 |
Grand Sorcerer
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 12,446
Karma: 8012886
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
|
This template produces a similar answer as @davidfor's but using a different technique.
Code:
program: series = re($series, '\.', '_'); if series then res = ''; for aut in $author_sort separator '&': res = strcat(res, (if res then ',' fi), re(aut, ',', ';'), '.', series) rof fi For these templates to work the destination column must be "built from other columns, behaves like tags" and the lookup key must be added to the hierarchical columns box. |
![]() |
![]() |
Advert | |
|
![]() |
#6 |
Junior Member
![]() Posts: 8
Karma: 10
Join Date: Jun 2017
Device: Onyx Boox Poke2, 3 & 5 / OnePlus 5T / Amazon Fire HD 10
|
I tried @chaley's solution, but was getting the same issues as with @davidfor's
I've dropped then re-added the #author_series custom column to the Categories the hierarchical items option in the Tag browser settings and now both proposed solutions are working perfectly. Thank you both so much for spending time and effort to address this requirement, I am indebted to you both! |
![]() |
![]() |
![]() |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
Why are all text columns shown in tag browser? (And changing column types?) | ownedbycats | Library Management | 0 | 12-29-2020 09:16 PM |
column from other columns with hierarchy and names | DBorG | Library Management | 1 | 10-01-2018 04:03 PM |
Hierarchy columns | mezme | Calibre | 7 | 03-07-2016 01:10 PM |
suggestion: tag groups should use Calibre tag hierarchy | comox | Calibre Companion | 53 | 05-25-2015 07:22 PM |
Tag browser Series hierarchy | Dopedangel | Library Management | 4 | 06-15-2012 06:20 AM |