Register Guidelines E-Books Today's Posts Search

Go Back   MobileRead Forums > E-Book Software > Calibre > Library Management

Notices

Reply
 
Thread Tools Search this Thread
Old 02-07-2019, 04:29 PM   #16
ilovejedd
hopeless n00b
ilovejedd ought to be getting tired of karma fortunes by now.ilovejedd ought to be getting tired of karma fortunes by now.ilovejedd ought to be getting tired of karma fortunes by now.ilovejedd ought to be getting tired of karma fortunes by now.ilovejedd ought to be getting tired of karma fortunes by now.ilovejedd ought to be getting tired of karma fortunes by now.ilovejedd ought to be getting tired of karma fortunes by now.ilovejedd ought to be getting tired of karma fortunes by now.ilovejedd ought to be getting tired of karma fortunes by now.ilovejedd ought to be getting tired of karma fortunes by now.ilovejedd ought to be getting tired of karma fortunes by now.
 
ilovejedd's Avatar
 
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:
Originally Posted by Tanjamuse
Can you add another tweak to this for me?

Code:
{#meta_fandom:'re($, '\.>', '/')'}/{#story_id}/{author} - {title}
I would love the fandoms separated by & when there's more than one, like the following:

Code:
! 2 Crossovers\CSI Las Vegas & Unknown Fandom\AO3-12010
Is the hierarchical tag structure fixed? If it's not, then I think you're gonna have to create something more complicated and that's above my skillset.

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}
If I'm not mistaken, that should give you:
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.
ilovejedd is offline   Reply With Quote
Old 02-07-2019, 06:52 PM   #17
ilovejedd
hopeless n00b
ilovejedd ought to be getting tired of karma fortunes by now.ilovejedd ought to be getting tired of karma fortunes by now.ilovejedd ought to be getting tired of karma fortunes by now.ilovejedd ought to be getting tired of karma fortunes by now.ilovejedd ought to be getting tired of karma fortunes by now.ilovejedd ought to be getting tired of karma fortunes by now.ilovejedd ought to be getting tired of karma fortunes by now.ilovejedd ought to be getting tired of karma fortunes by now.ilovejedd ought to be getting tired of karma fortunes by now.ilovejedd ought to be getting tired of karma fortunes by now.ilovejedd ought to be getting tired of karma fortunes by now.
 
ilovejedd's Avatar
 
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($,',',' &'),'')'}/
ilovejedd is offline   Reply With Quote
Advert
Old 02-08-2019, 02:38 AM   #18
Tanjamuse
Wizard
Tanjamuse , Klaatu Barada Niktu!Tanjamuse , Klaatu Barada Niktu!Tanjamuse , Klaatu Barada Niktu!Tanjamuse , Klaatu Barada Niktu!Tanjamuse , Klaatu Barada Niktu!Tanjamuse , Klaatu Barada Niktu!Tanjamuse , Klaatu Barada Niktu!Tanjamuse , Klaatu Barada Niktu!Tanjamuse , Klaatu Barada Niktu!Tanjamuse , Klaatu Barada Niktu!Tanjamuse , Klaatu Barada Niktu!
 
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}
I went through my folders with old Calibre stuff and found this template which I use in other libraries, maybe this could be of some help.

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)
In this library I don't have the main or secondary fandom column, but I would like to use & to separate instead of , that's normally used when I save from Calibre.

I hope I've explained it a bit better this time?
Tanjamuse is offline   Reply With Quote
Old 02-08-2019, 03:52 AM   #19
ilovejedd
hopeless n00b
ilovejedd ought to be getting tired of karma fortunes by now.ilovejedd ought to be getting tired of karma fortunes by now.ilovejedd ought to be getting tired of karma fortunes by now.ilovejedd ought to be getting tired of karma fortunes by now.ilovejedd ought to be getting tired of karma fortunes by now.ilovejedd ought to be getting tired of karma fortunes by now.ilovejedd ought to be getting tired of karma fortunes by now.ilovejedd ought to be getting tired of karma fortunes by now.ilovejedd ought to be getting tired of karma fortunes by now.ilovejedd ought to be getting tired of karma fortunes by now.ilovejedd ought to be getting tired of karma fortunes by now.
 
ilovejedd's Avatar
 
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:
Originally Posted by Tanjamuse View Post
In this library I don't have the main or secondary fandom column, but I would like to use & to separate instead of , that's normally used when I save from Calibre.

I hope I've explained it a bit better this time?
Tip when asking for advice, always give an example of what your existing custom columns and metadata look like as well as what exactly the expected output is (and what the target is: e.g. composite column, save to disk template, metadata plugboard, etc).

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
would look even more convoluted than the template in post 16.
ilovejedd is offline   Reply With Quote
Old 02-08-2019, 04:01 AM   #20
Tanjamuse
Wizard
Tanjamuse , Klaatu Barada Niktu!Tanjamuse , Klaatu Barada Niktu!Tanjamuse , Klaatu Barada Niktu!Tanjamuse , Klaatu Barada Niktu!Tanjamuse , Klaatu Barada Niktu!Tanjamuse , Klaatu Barada Niktu!Tanjamuse , Klaatu Barada Niktu!Tanjamuse , Klaatu Barada Niktu!Tanjamuse , Klaatu Barada Niktu!Tanjamuse , Klaatu Barada Niktu!Tanjamuse , Klaatu Barada Niktu!
 
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}
and it does what I had hoped for except for not using & when separating fandoms when it's saved.

What's suppose to do:
Code:
Angel The Series & Buffy The Vampire Slayer/Test/69131/_jamjar (phizzle) - Stay A Little
What it does:

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.
Tanjamuse is offline   Reply With Quote
Advert
Old 02-08-2019, 04:21 AM   #21
ilovejedd
hopeless n00b
ilovejedd ought to be getting tired of karma fortunes by now.ilovejedd ought to be getting tired of karma fortunes by now.ilovejedd ought to be getting tired of karma fortunes by now.ilovejedd ought to be getting tired of karma fortunes by now.ilovejedd ought to be getting tired of karma fortunes by now.ilovejedd ought to be getting tired of karma fortunes by now.ilovejedd ought to be getting tired of karma fortunes by now.ilovejedd ought to be getting tired of karma fortunes by now.ilovejedd ought to be getting tired of karma fortunes by now.ilovejedd ought to be getting tired of karma fortunes by now.ilovejedd ought to be getting tired of karma fortunes by now.
 
ilovejedd's Avatar
 
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:
Originally Posted by Tanjamuse View Post
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}
and it does what I had hoped for except for not using & when separating fandoms when it's saved.

What's suppose to do:
Code:
Angel The Series & Buffy The Vampire Slayer/Test/69131/_jamjar (phizzle) - Stay A Little
What it does:

Code:
Angel The Series,Buffy The Vampire Slayer/Test/69131/_jamjar (phizzle) - Stay A Little.epub
Again, it would help if you posted what your custom column values actually looked like... (particularly ones that include special characters: .,/\[]|'")

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.
ilovejedd is offline   Reply With Quote
Old 02-08-2019, 04:33 AM   #22
Tanjamuse
Wizard
Tanjamuse , Klaatu Barada Niktu!Tanjamuse , Klaatu Barada Niktu!Tanjamuse , Klaatu Barada Niktu!Tanjamuse , Klaatu Barada Niktu!Tanjamuse , Klaatu Barada Niktu!Tanjamuse , Klaatu Barada Niktu!Tanjamuse , Klaatu Barada Niktu!Tanjamuse , Klaatu Barada Niktu!Tanjamuse , Klaatu Barada Niktu!Tanjamuse , Klaatu Barada Niktu!Tanjamuse , Klaatu Barada Niktu!
 
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
Attached Thumbnails
Click image for larger version

Name:	Capture.PNG
Views:	72
Size:	11.9 KB
ID:	169574  
Tanjamuse is offline   Reply With Quote
Old 02-08-2019, 05:09 AM   #23
ilovejedd
hopeless n00b
ilovejedd ought to be getting tired of karma fortunes by now.ilovejedd ought to be getting tired of karma fortunes by now.ilovejedd ought to be getting tired of karma fortunes by now.ilovejedd ought to be getting tired of karma fortunes by now.ilovejedd ought to be getting tired of karma fortunes by now.ilovejedd ought to be getting tired of karma fortunes by now.ilovejedd ought to be getting tired of karma fortunes by now.ilovejedd ought to be getting tired of karma fortunes by now.ilovejedd ought to be getting tired of karma fortunes by now.ilovejedd ought to be getting tired of karma fortunes by now.ilovejedd ought to be getting tired of karma fortunes by now.
 
ilovejedd's Avatar
 
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:
Originally Posted by Tanjamuse View Post
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
I'm still somewhat confused. A complete, full value of #meta_fandom would be helpful.

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}
Mind you, I have no idea how using "contains names" custom columns would affect the above templates.
ilovejedd is offline   Reply With Quote
Old 02-08-2019, 05:16 AM   #24
Tanjamuse
Wizard
Tanjamuse , Klaatu Barada Niktu!Tanjamuse , Klaatu Barada Niktu!Tanjamuse , Klaatu Barada Niktu!Tanjamuse , Klaatu Barada Niktu!Tanjamuse , Klaatu Barada Niktu!Tanjamuse , Klaatu Barada Niktu!Tanjamuse , Klaatu Barada Niktu!Tanjamuse , Klaatu Barada Niktu!Tanjamuse , Klaatu Barada Niktu!Tanjamuse , Klaatu Barada Niktu!Tanjamuse , Klaatu Barada Niktu!
 
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.
Tanjamuse is offline   Reply With Quote
Old 02-08-2019, 05:30 AM   #25
ilovejedd
hopeless n00b
ilovejedd ought to be getting tired of karma fortunes by now.ilovejedd ought to be getting tired of karma fortunes by now.ilovejedd ought to be getting tired of karma fortunes by now.ilovejedd ought to be getting tired of karma fortunes by now.ilovejedd ought to be getting tired of karma fortunes by now.ilovejedd ought to be getting tired of karma fortunes by now.ilovejedd ought to be getting tired of karma fortunes by now.ilovejedd ought to be getting tired of karma fortunes by now.ilovejedd ought to be getting tired of karma fortunes by now.ilovejedd ought to be getting tired of karma fortunes by now.ilovejedd ought to be getting tired of karma fortunes by now.
 
ilovejedd's Avatar
 
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:
Originally Posted by Tanjamuse View Post
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.
You're welcome.

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.
ilovejedd is offline   Reply With Quote
Reply


Forum Jump

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


All times are GMT -4. The time now is 04:36 AM.


MobileRead.com is a privately owned, operated and funded community.