|
|
#16 | |
|
hopeless n00b
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 5,126
Karma: 19597086
Join Date: Jan 2009
Location: in the middle of nowhere
Device: PW4, PW3, Libra H2O, iPad 10.5, iPad 11, iPad 12.9
|
Moving from PM to public forum. Better this way to share the knowledge and so people more knowledgeable than I could help with crafting the solution.
Quote:
This template will replace all ".>" after the first one with " & ": Code:
{#meta_fandom:'re(strcat(sublist($,0,1,'.>'),'.>',re(sublist($,1,0,'.>'),'\.>',' & ')), '\.>', '/')'}/{#story_id}/{author} - {title}
Code:
Fandom 1 => Fandom 1/ 2 Xover.>Fandom 1.>Fandom 2 => 2 Xover/Fandom 1 & Fandom 2/ 3 Xover.>Fandom 1.>Fandom 2.>Fandom 3 => 3 Xover/Fandom 1 & Fandom 2 & Fandom 3/ Multi Xover.>Fandom 1 => Multi Xover/Fandom 1/ Last edited by ilovejedd; 02-07-2019 at 06:47 PM. |
|
|
|
|
|
|
#17 |
|
hopeless n00b
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 5,126
Karma: 19597086
Join Date: Jan 2009
Location: in the middle of nowhere
Device: PW4, PW3, Libra H2O, iPad 10.5, iPad 11, iPad 12.9
|
Mind, if I were you, I wouldn't store fanfic type and fandom info as hierarchical tags. I'd keep them separate.
#type -> empty for regular fics, then 2 Crossovers, 3 Crossovers, etc. #fandom -> comma separated list, behaves like tags (not hierarchical) Makes templates easier, too. Code:
{#type}/{#fandom:'re($, ", ", " & ")'}/{#story_id}/{author} - {title}
Or if you want something like: Fandom/ Crossover/Fandom 1 & Fandom 2/ Multi-Crossover/ where #type is either empty, Crossover (for 2 fandoms) or Multi-Crossover (more than 2 fandoms) Code:
{#type}/{#fandom:'cmp(count($,','),2,$,re($,',',' &'),'')'}/
|
|
|
|
| Advert | |
|
|
|
|
#18 |
|
Wizard
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 1,327
Karma: 5306
Join Date: Jan 2014
Device: none
|
I tried this but I don't think it worked, or maybe I didn't explain it properly.
Code:
{#meta_fandom:'re(strcat(sublist($,0,1,'.>'),'.>',re(sublist($,1,0,'.>'),'\.>',' & ')), '\.>', '/')'}/{#story_id}/{author} - {title}
Code:
"program: tmp1 = template('{#fandoms:sublist(0,2,&)}{#fandom_secondary:sublist(0,2,\\,)}/{author}/{title} ({#story_id})'); tmp2 = template('_ Crossovers/{#fandoms:sublist(0,2,&)}{#fandom_secondary:sublist(0,2,&)}/{author}/{title} ({#story_id})'); tmp3 = template('_ Multiple Crossovers/{author}/{title} ({#story_id})'); cmp(count(field('#fandoms'), ','), 2, re(re(tmp1,': ',' '),',',' & '), re(re(tmp2,': ',' '),',',' & '), tmp3)
I hope I've explained it a bit better this time? |
|
|
|
|
|
#19 | |
|
hopeless n00b
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 5,126
Karma: 19597086
Join Date: Jan 2009
Location: in the middle of nowhere
Device: PW4, PW3, Libra H2O, iPad 10.5, iPad 11, iPad 12.9
|
Quote:
Honestly, it's unclear to me what you're trying to achieve and it seems your source metadata looks different compared to your earlier examples? The template in post 16 only works for something that's formatted as shown in the example from that post (.> separator). If your metadata is formatted differently, then it won't work. Please note, as far as Calibre tags (and custom columns that behave like tags), the comma , is the only accepted separator. You can replace it in save to disk, send to device, etc. templates but for tag browser, etc, other separators won't work. Now if the target is just a save to disk template or similar, then one of the templates from post 17 might work. I highly recommend separating the crossover designation from the fandoms to make template creation easier. Also, standardize your metadata. A template that can handle both: Code:
foo.>bar.>Hello, World => foo/bar/Hello & World foo, bar, Hello, World => foo/bar/Hello & World |
|
|
|
|
|
|
#20 |
|
Wizard
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 1,327
Karma: 5306
Join Date: Jan 2014
Device: none
|
I'm sorry that was very confusing, I didn't think it properly through before I had pressed Submit reply.
I'm very sorry. I tried what you posted for me last night: Code:
{#meta_fandom:'re(strcat(sublist($,0,1,'.>'),'.>',re(sublist($,1,0,'.>'),'\.>',' & ')), '\.>', '/')'}/{#story_id}/{author} - {title}
What's suppose to do: Code:
Angel The Series & Buffy The Vampire Slayer/Test/69131/_jamjar (phizzle) - Stay A Little Code:
Angel The Series,Buffy The Vampire Slayer/Test/69131/_jamjar (phizzle) - Stay A Little.epub Last edited by Tanjamuse; 02-08-2019 at 04:03 AM. |
|
|
|
| Advert | |
|
|
|
|
#21 | |
|
hopeless n00b
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 5,126
Karma: 19597086
Join Date: Jan 2009
Location: in the middle of nowhere
Device: PW4, PW3, Libra H2O, iPad 10.5, iPad 11, iPad 12.9
|
Quote:
Where did the comma come from? Your original example was simply: Test.\Test2 and based on subsequent posts in this thread, I was expecting something formatted like one of these: Fandom 1 2 Xover.>Fandom 1.>Fandom 2 3 Xover.>Fandom 1.>Fandom 2.>Fandom 3 Multi Xover.>Fandom 1 The template I gave you would replace the .> after the first occurrence with & but it obviously won't work if your metadata is formatted differently. |
|
|
|
|
|
|
#22 |
|
Wizard
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 1,327
Karma: 5306
Join Date: Jan 2014
Device: none
|
The attached screenshot is my meta_fandom column.
The fandoms are separated by & because if I don't it will automatically be sorted alphabetically when I add metadata. When I save a book standard in Calibre it changes the & in Calibre to ,. Which means if there's more than one fandom in my meta_fandom column as shown in this example it will separate them with , and no space instead of &. Angel The Series & Buffy The Vampire Slayer becomes Angel The Series,Buffy The Vampire Slayer |
|
|
|
|
|
#23 | |
|
hopeless n00b
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 5,126
Karma: 19597086
Join Date: Jan 2009
Location: in the middle of nowhere
Device: PW4, PW3, Libra H2O, iPad 10.5, iPad 11, iPad 12.9
|
Quote:
For example, is it Crossover.>Buffy The Vampire Slayer.>Angel or Crossover.>Buffy The Vampire Slayer,Angel or Crossover.>Buffy The Vampire Slayer & Angel or just Buffy The Vampire Slayer,Angel Is the #meta_fandom column hierarchical like you showed earlier or not? If #meta_fandom is not hierarchical, then one of the templates on post 17 might work. Just remove #type and replace #fandom with #meta_fandom (and add author, title, etc as needed). If it is hierarchical, is the .> always supposed to denote folders while commas can always be replaced with &? If so, then the template from post 16 is completely wrong for what you want. Try this one instead (modified from post 14, doing this on iPad so I haven't verified with template tester): Code:
{#meta_fandom:'re(re($, '\.>', '/'), ',[ ]*', ' & ')'}/{#story_id}/{author} - {title}
|
|
|
|
|
|
|
#24 |
|
Wizard
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 1,327
Karma: 5306
Join Date: Jan 2014
Device: none
|
This is what I wanted. Something that would have more than one sub-folder and still separate fandoms with & no matter in which combination.
Thank you so much for your patience. |
|
|
|
|
|
#25 | |
|
hopeless n00b
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 5,126
Karma: 19597086
Join Date: Jan 2009
Location: in the middle of nowhere
Device: PW4, PW3, Libra H2O, iPad 10.5, iPad 11, iPad 12.9
|
Quote:
Again, though, for future reference, give concrete examples of your existing metadata (type and actual values) and your desired output. I have no doubt @chaley or @Kovid could have given you the solution 4 days ago if you had provided specific/detailed examples. |
|
|
|
|
![]() |
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Custom column built from word count column | Montana Harper | Library Management | 3 | 10-04-2018 10:57 PM |
| Move selected data from series column to a new custom column | fvdham | Library Management | 3 | 06-02-2017 04:49 PM |
| Custom column returns value based on value of another custom column? | calvin-c | Calibre | 3 | 09-14-2013 03:24 PM |
| Custom yes/no column built from long text column | Philantrop | Library Management | 7 | 03-23-2013 08:44 PM |
| how to move value(s) of tag column to a custom made column | zoorakhan | Library Management | 0 | 12-08-2012 04:53 AM |