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
Guru
dunhill ought to be getting tired of karma fortunes by now.dunhill ought to be getting tired of karma fortunes by now.dunhill ought to be getting tired of karma fortunes by now.dunhill ought to be getting tired of karma fortunes by now.dunhill ought to be getting tired of karma fortunes by now.dunhill ought to be getting tired of karma fortunes by now.dunhill ought to be getting tired of karma fortunes by now.dunhill ought to be getting tired of karma fortunes by now.dunhill ought to be getting tired of karma fortunes by now.dunhill ought to be getting tired of karma fortunes by now.dunhill ought to be getting tired of karma fortunes by now.
 
dunhill's Avatar
 
Posts: 720
Karma: 228142
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,907
Karma: 47303748
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 offline   Reply With Quote
Old 05-04-2022, 05:12 PM   #393
dunhill
Guru
dunhill ought to be getting tired of karma fortunes by now.dunhill ought to be getting tired of karma fortunes by now.dunhill ought to be getting tired of karma fortunes by now.dunhill ought to be getting tired of karma fortunes by now.dunhill ought to be getting tired of karma fortunes by now.dunhill ought to be getting tired of karma fortunes by now.dunhill ought to be getting tired of karma fortunes by now.dunhill ought to be getting tired of karma fortunes by now.dunhill ought to be getting tired of karma fortunes by now.dunhill ought to be getting tired of karma fortunes by now.dunhill ought to be getting tired of karma fortunes by now.
 
dunhill's Avatar
 
Posts: 720
Karma: 228142
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
Custom User Title
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: 8,530
Karma: 61120499
Join Date: Oct 2018
Location: Canada
Device: Kobo Libra H2O, formerly Aura HD
Question: How would I check whether the values of identifier: and identifier2: (in this case, mobi-asin: and amazon: ) are identical?
ownedbycats is offline   Reply With Quote
Old 05-09-2022, 05:39 AM   #395
chaley
Grand Sorcerer
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.
 
Posts: 11,728
Karma: 6690881
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
Custom User Title
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: 8,530
Karma: 61120499
Join Date: Oct 2018
Location: Canada
Device: Kobo Libra H2O, formerly Aura HD
Thanks
ownedbycats is offline   Reply With Quote
Old 05-10-2022, 02:07 AM   #397
ownedbycats
Custom User Title
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: 8,530
Karma: 61120499
Join Date: Oct 2018
Location: Canada
Device: Kobo Libra H2O, formerly Aura HD
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:	212
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 offline   Reply With Quote
Old 05-10-2022, 04:37 AM   #398
chaley
Grand Sorcerer
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.
 
Posts: 11,728
Karma: 6690881
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
Custom User Title
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: 8,530
Karma: 61120499
Join Date: Oct 2018
Location: Canada
Device: Kobo Libra H2O, formerly Aura HD
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 offline   Reply With Quote
Old 05-10-2022, 04:56 AM   #400
ownedbycats
Custom User Title
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: 8,530
Karma: 61120499
Join Date: Oct 2018
Location: Canada
Device: Kobo Libra H2O, formerly Aura HD
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 offline   Reply With Quote
Old 05-10-2022, 05:10 AM   #401
chaley
Grand Sorcerer
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.
 
Posts: 11,728
Karma: 6690881
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
Custom User Title
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: 8,530
Karma: 61120499
Join Date: Oct 2018
Location: Canada
Device: Kobo Libra H2O, formerly Aura HD
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 offline   Reply With Quote
Old 05-15-2022, 05:00 AM   #403
chaley
Grand Sorcerer
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.
 
Posts: 11,728
Karma: 6690881
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
Old 05-24-2022, 10:37 PM   #404
Vespero
Junior Member
Vespero began at the beginning.
 
Vespero's Avatar
 
Posts: 6
Karma: 10
Join Date: May 2022
Device: Kindle Paperwhite 5
Is there a way to change the template based on the format of the book being sent?"

I send both .epub and .cbz to my device and prefer different naming schemes for them.

With .epub, I like
books/{author_sort}/{series}/{title}

But with .cbz, I want
books/{author_sort}/{series}/{title}
(being comics, each chapter/volume is already named {series}{series_index})

Currently, I either have to manually edit the template each time I switch formats (which also requires restarting Calibre and remounting the folder), or I have to switch how the device is mounted (Connect to Folder for .cbz and Wireless Connection for .epub)

There's got to be an easier way though, right?
Vespero is offline   Reply With Quote
Old 05-25-2022, 04:55 AM   #405
ownedbycats
Custom User Title
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: 8,530
Karma: 61120499
Join Date: Oct 2018
Location: Canada
Device: Kobo Libra H2O, formerly Aura HD
I may be wrong on this, I don't believe variations can be done with a basic template.

I have a similar case, and what I did was create a composite column and use a GPM template. Try working off this -- I'm a bit foggy on how to do the 'stuff here' though :

Code:
program:

	if 
		'cbz' in approximate_formats() 
	then
		'(some stuff here)'

	else	
		'(other stuff here)'

	fi
Then just put {#yourcompositecolumn} into the save template field.

For reference, here's my templates:

Code:
program:

# Returns 'Fanfiction/Fandom' for fanfics
	if $$#fanficcat then
		list_re($tags, ',', '^Fanfiction.(.*)$', 'Fanfiction/\1')

# Returns 'Kobo' for Kobo store books (in the rare case I need to sideload one)
	elif '\[Kobo Store\]' in $#kobostatus then 
		'Kobo Store' 

# Returns 'PDF' if PDF is only format
	elif $formats == 'PDF' then
		'PDF'

# Returns 'Loans' for Loans
	elif 'Loans' in $#vls then
		'Loans'

# Returns topmost tag for all other books
	else
		re(sublist($tags, 0, 1, ','), '^(.*?)($|\..*$)', '\1')

	fi
Code:
{#kobopath}/{author_sort:sublist(0,1,&)}/{title} - {authors}

Last edited by ownedbycats; 05-25-2022 at 05:04 AM.
ownedbycats 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
Library Management: various questions not worth their own thread ownedbycats Library Management 130 04-13-2024 10:02 PM
[Metadata Source Plugin] Questions regarding parse select, docs and ref templates Boilerplate4U Development 13 07-07-2020 02:35 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
Thread management questions meme Feedback 6 01-31-2011 05:07 PM


All times are GMT -4. The time now is 01:29 AM.


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