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-01-2021, 04:28 PM   #91
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,537
Karma: 61120499
Join Date: Oct 2018
Location: Canada
Device: Kobo Libra H2O, formerly Aura HD
Thanks

Any ideas why the second part of this template isn't removing the URIs?

Click image for larger version

Name:	2021-05-01 17_27_30-Template tester.png
Views:	235
Size:	43.5 KB
ID:	186872

Code:
program:
	publisher = $publisher;
	ids = $identifiers;
	u = select(ids, 'uri');
	g = select(ids, 'gutenberg');

	if publisher == 'Project Gutenberg' && u != g then
		n = re(u, '^http://www.gutenberg.org/(\d+)', '\1');
		ids = list_union(ids, strcat('gutenberg:', n), ',')
	fi;

	if publisher == 'Project Gutenberg' && u && g then
		ids = list_difference(ids, strcat('uri:', u), ',')
	fi;
	ids
ownedbycats is online now   Reply With Quote
Old 05-01-2021, 05:19 PM   #92
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

Any ideas why the second part of this template isn't removing the URIs?

Attachment 186872

Code:
program:
	publisher = $publisher;
	ids = $identifiers;
	u = select(ids, 'uri');
	g = select(ids, 'gutenberg');

	if publisher == 'Project Gutenberg' && u != g then
		n = re(u, '^http://www.gutenberg.org/(\d+)', '\1');
		ids = list_union(ids, strcat('gutenberg:', n), ',')
	fi;

	if publisher == 'Project Gutenberg' && u && g then
		ids = list_difference(ids, strcat('uri:', u), ',')
	fi;
	ids
Are you certain that the conditions in the second 'if' are all True, that both 'ids' are set when the template starts? Run it using breakpoints to check (and record) the values.

Also, both conditions check for "publisher == 'Project Gutenberg'". You could test that once and put the other tests as nested ifs.
chaley is offline   Reply With Quote
Old 05-01-2021, 05:30 PM   #93
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,537
Karma: 61120499
Join Date: Oct 2018
Location: Canada
Device: Kobo Libra H2O, formerly Aura HD
Actually I think it's a mistake of what I thought template tester was doing; I was testing with books that only had uri. If I add gutenberg: and test again it removes the uri: identifier.
ownedbycats is online now   Reply With Quote
Old 05-01-2021, 09:33 PM   #94
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,537
Karma: 61120499
Join Date: Oct 2018
Location: Canada
Device: Kobo Libra H2O, formerly Aura HD
Also, preferably I would just skip the Publisher and check for a uri: contains http://www.gutenberg.org/ but I'm not sure how to do that.
ownedbycats is online now   Reply With Quote
Old 05-02-2021, 05:18 AM   #95
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
Also, preferably I would just skip the Publisher and check for a uri: contains http://www.gutenberg.org/ but I'm not sure how to do that.
Something like this should work:
Code:
if '^http://www.gutenberg.org/' in u then 'foo' fi
chaley is offline   Reply With Quote
Old 05-08-2021, 06:02 PM   #96
capink
Wizard
capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.
 
Posts: 1,085
Karma: 1948136
Join Date: Aug 2015
Device: Kindle
@chaley: Running the following template returns true i.e "1"

Code:
program:
	'' inlist 'first,second'
Is this intentional?

Last edited by capink; 05-08-2021 at 06:07 PM.
capink is offline   Reply With Quote
Old 05-08-2021, 06:24 PM   #97
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 capink View Post
@chaley: Running the following template returns true i.e "1"

Code:
program:
	'' inlist 'first,second'
Is this the intentional?
Yes. It uses python regex where a zero-length pattern matches any string.

It isn't clear to me what the expression is looking for. If you looking for an empty list then there are several ways to do that, such as a == '' or list_count() == 0. If you are looking for an item in a list then you must explicitly decide what happens if the item is empty. Does it match, or does it fail? If you know you want the left-hand expression to match *something* then you can use
Code:
substr('^', value, '$') inlist whatever
or perhaps clearer, str_in_list()
chaley is offline   Reply With Quote
Old 05-08-2021, 07:03 PM   #98
capink
Wizard
capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.
 
Posts: 1,085
Karma: 1948136
Join Date: Aug 2015
Device: Kindle
I think str_in_list() is a good answer.

Quote:
Originally Posted by chaley View Post
It isn't clear to me what the expression is looking for.
I was using it in action chains conditions where some variables can return empty values, so I had to nest the value in if statment to make sure it is not an empty string:

Code:
program:
	clicked_column = list_item(globals(_event_args), 1, ',');
	if clicked_column then
		if clicked_column inlist field_names('is_multiple:true,is_names:false') then
			'true'
		fi
	fi
Turns out there are other problems with the above code that I did not take into consideration: if variable is not anchored, #my_custom_col passes for #my_custom_col_1

Edit: The below code is working well

Code:
program:
	clicked_column = list_item(globals(_event_args), 1, ',');
	tag_like = field_names('is_multiple:true,is_names:false');
	str_in_list(tag_like, ',', clicked_column, 'true', '')

Last edited by capink; 05-08-2021 at 07:11 PM.
capink is offline   Reply With Quote
Old 05-10-2021, 07:05 PM   #99
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,537
Karma: 61120499
Join Date: Oct 2018
Location: Canada
Device: Kobo Libra H2O, formerly Aura HD
To work around another FanFicFare issue, I want to make a template that removes either 'In-Progress' or 'Complete' from tags if #fanficstatus is 'Anthology.'

Code:
program:
	status = $#fanficstatus;
	tags = $tags;
	
	if 
		status == 'Anthology'
	then
		tags = list_difference(tags, strcat('In-Progress', 'Complete'), ',')		
	else
		tags
	fi
This just returned the original list. Should I have used something other than list_difference?

Last edited by ownedbycats; 05-10-2021 at 07:08 PM.
ownedbycats is online now   Reply With Quote
Old 05-10-2021, 07:18 PM   #100
capink
Wizard
capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.capink ought to be getting tired of karma fortunes by now.
 
Posts: 1,085
Karma: 1948136
Join Date: Aug 2015
Device: Kindle
Try this:

Code:
program:
	status = $#fanficstatus;
	tags = $tags;
	
	if 
		status == 'Anthology'
	then
		tags = list_difference(tags, 'In-Progress,Complete', ',')		
	else
		tags
	fi
The problem in your code was this line:

Code:
strcat('In-Progress', 'Complete')
which returns a new string that is not present in your tags

Code:
In-ProgressComplete
Edit: strcat() is only needed if you are concatenating variables. If all you are using is plain text you can still use strcat(), but you do not need to.

Last edited by capink; 05-10-2021 at 07:20 PM.
capink is offline   Reply With Quote
Old 05-10-2021, 07:36 PM   #101
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,537
Karma: 61120499
Join Date: Oct 2018
Location: Canada
Device: Kobo Libra H2O, formerly Aura HD
Thank you
ownedbycats is online now   Reply With Quote
Old 05-13-2021, 08:32 PM   #102
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,537
Karma: 61120499
Join Date: Oct 2018
Location: Canada
Device: Kobo Libra H2O, formerly Aura HD
This resets the time to 12:00:00. Did I make a mistake?
Attached Thumbnails
Click image for larger version

Name:	2021-05-13 21_30_02-Editing metadata for one book.png
Views:	145
Size:	44.0 KB
ID:	187111  
ownedbycats is online now   Reply With Quote
Old 05-14-2021, 03:01 AM   #103
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
This resets the time to 12:00:00. Did I make a mistake?
That S&R doesn't do anything. Templates are not evaluated as search expressions; they are interpreted as plain text. A template is evaluated only if you use "Template" as the source field, and then only if you put it in the "Template" box.

The replacement of /1 is also plain text. I suspect you wanted \1.

What are you trying to do?
chaley is offline   Reply With Quote
Old 05-14-2021, 03:08 AM   #104
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,537
Karma: 61120499
Join Date: Oct 2018
Location: Canada
Device: Kobo Libra H2O, formerly Aura HD
I accidentally wiped out my Audit Log while troubleshooting plugins so I was copying the column to itself so that AL had a record of the original values. I figured out what I had to do though.
Attached Thumbnails
Click image for larger version

Name:	2021-05-14 04_06_58-Editing metadata for 2 books.png
Views:	126
Size:	46.6 KB
ID:	187119   Click image for larger version

Name:	2021-05-14 04_08_32-Audit Log Activity Detail_ 1233 Rows.png
Views:	126
Size:	35.8 KB
ID:	187120  
ownedbycats is online now   Reply With Quote
Old 05-14-2021, 03:12 AM   #105
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 accidentally wiped out my Audit Log so I was copying the values to themselves so that AL had a record of them. I figured out what I had to do though.
It works by accident.

Searching for /1 finds nothing because that character sequence doesn't exist in an ISO date. Replacing with /1 would replace with exactly that text, /1, but since nothing was found, nothing was replaced.

You probably wanted search for ^(.*)$ and replace with \1. This matches the entire source and replaces it with itself
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
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 02:24 PM.


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