Register Guidelines E-Books Search Today's Posts Mark Forums Read

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

Notices

Reply
 
Thread Tools Search this Thread
Old 05-04-2022, 06:33 AM   #391
dunhill
Evangelist
dunhill can program the VCR without an owner's manual.dunhill can program the VCR without an owner's manual.dunhill can program the VCR without an owner's manual.dunhill can program the VCR without an owner's manual.dunhill can program the VCR without an owner's manual.dunhill can program the VCR without an owner's manual.dunhill can program the VCR without an owner's manual.dunhill can program the VCR without an owner's manual.dunhill can program the VCR without an owner's manual.dunhill can program the VCR without an owner's manual.dunhill can program the VCR without an owner's manual.
 
dunhill's Avatar
 
Posts: 479
Karma: 196652
Join Date: Sep 2017
Location: Argentina
Device: moon+ reader, kindle paperwhite
Quote:
Originally Posted by dunhill View Post
With a template it worked wonders, thank you very much.
What if I wanted to count the words of the title?
dunhill is offline   Reply With Quote
Old 05-04-2022, 07:50 AM   #392
davidfor
Grand Sorcerer
davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.
 
Posts: 24,217
Karma: 45345576
Join Date: Jul 2011
Location: Sydney, Australia
Device: Kobo:Touch,Glo, AuraH2O, GloHD,AuraONE, ClaraHD, Libra H2O; tolinoepos
Quote:
Originally Posted by dunhill View Post
What if I wanted to count the words of the title?
Apart from us wondering what you are up to?

Try:

Code:
program:
count($$title, ' ');
davidfor is online now   Reply With Quote
Old 05-04-2022, 05:12 PM   #393
dunhill
Evangelist
dunhill can program the VCR without an owner's manual.dunhill can program the VCR without an owner's manual.dunhill can program the VCR without an owner's manual.dunhill can program the VCR without an owner's manual.dunhill can program the VCR without an owner's manual.dunhill can program the VCR without an owner's manual.dunhill can program the VCR without an owner's manual.dunhill can program the VCR without an owner's manual.dunhill can program the VCR without an owner's manual.dunhill can program the VCR without an owner's manual.dunhill can program the VCR without an owner's manual.
 
dunhill's Avatar
 
Posts: 479
Karma: 196652
Join Date: Sep 2017
Location: Argentina
Device: moon+ reader, kindle paperwhite
First I thought of title, but now I'm going to use it with author.
The authors column has three possibilities.

The first is that you only have a last name, like Aristotle or Anonymous, for example.
In this case I add a comma and a hyphen at the end of the name.
Aristotle,-

The second consists of a first name and a last name. If I jointly select all the authors of this type, I can transform them jointly, which is what I want.
I can transform all these authors directly into APE, NOM through the PlugIn QualityCheck

The third option would imply either two names and a surname, which would select and transform them in the same way, or one or two names and two surnames, in which case I would change them manually one by one, managing Authors, as before.

As you can see, I am only looking for a way to simplify the process of incorporating the periodic updates of the •LIBRARY

—————
With the column I'm looking to implement, I'd get a 1 for the second case. Then I would sort it, and select all the ones that had 1.

I hope I have explained myself well
dunhill is offline   Reply With Quote
Old 05-09-2022, 05:20 AM   #394
ownedbycats
Wizard
ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.
 
ownedbycats's Avatar
 
Posts: 4,026
Karma: 17333086
Join Date: Oct 2018
Location: Canada
Device: Kobo Aura HD (retired), Kobo Libra H2O
Question: How would I check whether the values of identifier: and identifier2: (in this case, mobi-asin: and amazon: ) are identical?
ownedbycats is online now   Reply With Quote
Old 05-09-2022, 05:39 AM   #395
chaley
Grumpy old git
chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.
 
chaley's Avatar
 
Posts: 10,380
Karma: 3933793
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
Quote:
Originally Posted by ownedbycats View Post
Question: How would I check whether the values of identifier: and identifier2: (in this case, mobi-asin: and amazon: ) are identical?
Use the select() function. Example:
Code:
program:
	select($identifiers, 'x') == select($identifiers, 'z')
chaley is offline   Reply With Quote
Old 05-09-2022, 05:44 AM   #396
ownedbycats
Wizard
ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.
 
ownedbycats's Avatar
 
Posts: 4,026
Karma: 17333086
Join Date: Oct 2018
Location: Canada
Device: Kobo Aura HD (retired), Kobo Libra H2O
Thanks
ownedbycats is online now   Reply With Quote
Old 05-10-2022, 02:07 AM   #397
ownedbycats
Wizard
ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.
 
ownedbycats's Avatar
 
Posts: 4,026
Karma: 17333086
Join Date: Oct 2018
Location: Canada
Device: Kobo Aura HD (retired), Kobo Libra H2O
Question:

Code:
program:
	ids = $identifiers;
	mobi = select(ids, 'mobi-asin');
	amazon = select(ids, 'amazon');

	if 
		mobi && !amazon
	then 
		n = re(mobi, '(.*)', '\1');
		ids = list_union(ids, strcat('amazon:', n), ',')
	else
		ids
	fi;


	if 
		mobi == amazon
	then
		ids = list_difference(ids, strcat('mobi-asin:', mobi), ',')
	else
		ids
	fi
I have two books. Book #1 has only the mobi-asin identifier, while Book #2 has identical mobi-asin and amazon ids.

The results are this:

Click image for larger version

Name:	2022-05-10 03_11_37-Template tester.png
Views:	142
Size:	50.2 KB
ID:	193744

Aside from either separating the two parts into separate templates or running it twice, is there any way to tell it "do part A (copy mobi-asin to amazon), and then also do part B (remove mobi-asin)"?

EDIT: See my post in the while loop thread.

Last edited by ownedbycats; 05-10-2022 at 03:12 AM.
ownedbycats is online now   Reply With Quote
Old 05-10-2022, 04:37 AM   #398
chaley
Grumpy old git
chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.
 
chaley's Avatar
 
Posts: 10,380
Karma: 3933793
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
Quote:
Originally Posted by ownedbycats View Post
Question:

Code:
program:
	ids = $identifiers;
	mobi = select(ids, 'mobi-asin');
	amazon = select(ids, 'amazon');

	if 
		mobi && !amazon
	then 
		n = re(mobi, '(.*)', '\1');
		ids = list_union(ids, strcat('amazon:', n), ',')
	else
		ids
	fi;


	if 
		mobi == amazon
	then
		ids = list_difference(ids, strcat('mobi-asin:', mobi), ',')
	else
		ids
	fi
I have two books. Book #1 has only the mobi-asin identifier, while Book #2 has identical mobi-asin and amazon ids.

The results are this:

Attachment 193744

Aside from either separating the two parts into separate templates or running it twice, is there any way to tell it "do part A (copy mobi-asin to amazon), and then also do part B (remove mobi-asin)"?

EDIT: See my post in the while loop thread.
I don't understand the question. As you have it, both clauses will be executed. What do you want that is different from that?

Aside: what is the "n = re(mobi, '(.*)', '\1');" for? That (almost) copies mobo to n. Except there will be problems with the .*, which can copy the empty string. Why not just use 'mobi' in the list_union()?
chaley is offline   Reply With Quote
Old 05-10-2022, 04:45 AM   #399
ownedbycats
Wizard
ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.
 
ownedbycats's Avatar
 
Posts: 4,026
Karma: 17333086
Join Date: Oct 2018
Location: Canada
Device: Kobo Aura HD (retired), Kobo Libra H2O
Lines 6-13: If there's no amazon identifier, copy the contents of mobi-asin to it.

Lines 16-22: If mobi-asin and amazon are identical, remove mobi-asin.

As it currently is, if there's only mobi-asin, it will copy it to amazon but then not remove it afterwards, and I need to run it a second time.

I think one of the ids in the second section is checking the original state of the column and not the updated one.

Last edited by ownedbycats; 05-10-2022 at 04:55 AM.
ownedbycats is online now   Reply With Quote
Old 05-10-2022, 04:56 AM   #400
ownedbycats
Wizard
ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.
 
ownedbycats's Avatar
 
Posts: 4,026
Karma: 17333086
Join Date: Oct 2018
Location: Canada
Device: Kobo Aura HD (retired), Kobo Libra H2O
Quote:
Originally Posted by ownedbycats View Post
I think one of the ids in the second section is checking the original state of the column and not the updated one.
I figured it out! I added two lines between the clauses, and it updated the variables. I suppose this might be a case where using variables as a typing shortcut wasn't a good idea.

Code:
program:
	ids = $identifiers;
	mobi = select(ids, 'mobi-asin');
	amazon = select(ids, 'amazon');

	if 
		mobi && !amazon
	then 
		n = re(mobi, '(.*)', '\1');
		ids = list_union(ids, strcat('amazon:', n), ',')
	else
		ids
	fi;

	mobi = select(ids, 'mobi-asin');
	amazon = select(ids, 'amazon');

	if 
		mobi == amazon
	then
		ids = list_difference(ids, strcat('mobi-asin:', mobi), ',')
	else
		ids
	fi

Last edited by ownedbycats; 05-10-2022 at 04:59 AM.
ownedbycats is online now   Reply With Quote
Old 05-10-2022, 05:10 AM   #401
chaley
Grumpy old git
chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.
 
chaley's Avatar
 
Posts: 10,380
Karma: 3933793
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
Quote:
Originally Posted by ownedbycats View Post
I figured it out! I added two lines between the clauses, and it updated the variables. I suppose this might be a case where using variables as a typing shortcut wasn't a good idea.

Code:
program:
	ids = $identifiers;
	mobi = select(ids, 'mobi-asin');
	amazon = select(ids, 'amazon');

	if 
		mobi && !amazon
	then 
		n = re(mobi, '(.*)', '\1');
		ids = list_union(ids, strcat('amazon:', n), ',')
	else
		ids
	fi;

	mobi = select(ids, 'mobi-asin');
	amazon = select(ids, 'amazon');

	if 
		mobi == amazon
	then
		ids = list_difference(ids, strcat('mobi-asin:', mobi), ',')
	else
		ids
	fi
Instead of redoing the select you could add after the list_union() line
Code:
amazon = mobi
chaley is offline   Reply With Quote
Old 05-14-2022, 08:40 PM   #402
ownedbycats
Wizard
ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.
 
ownedbycats's Avatar
 
Posts: 4,026
Karma: 17333086
Join Date: Oct 2018
Location: Canada
Device: Kobo Aura HD (retired), Kobo Libra H2O
Thanks

Question: When exactly does a stored template re-calc?

Example: Suppose I have a stored template that I use in an action chain to modify a column. Does it only calculate when I run the chain?
ownedbycats is online now   Reply With Quote
Old 05-15-2022, 05:00 AM   #403
chaley
Grumpy old git
chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.
 
chaley's Avatar
 
Posts: 10,380
Karma: 3933793
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
Quote:
Originally Posted by ownedbycats View Post
Thanks

Question: When exactly does a stored template re-calc?

Example: Suppose I have a stored template that I use in an action chain to modify a column. Does it only calculate when I run the chain?
I assume "calculate" means "run". It runs when it is used no matter the context. In an action chains context it will be the chain template that calls the stored template.
chaley is offline   Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
A few questions... (template language, mainly) Clem2605 Library Management 2 12-30-2020 03:25 AM
Questions on Kobo [Interfered with another thread topic] spdavies Kobo Reader 8 10-12-2014 11:37 AM
[OLD Thread] Some questions before buying the fire. darthreader13 Kindle Fire 7 05-10-2013 09:19 PM
[Old Thread] Save Template not working TGinAZ Calibre 7 01-18-2012 01:03 AM
Thread management questions meme Feedback 6 01-31-2011 05:07 PM


All times are GMT -4. The time now is 12:05 AM.


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