View Single Post
Old 09-07-2023, 12:03 AM   #13
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: 11,160
Karma: 77304081
Join Date: Oct 2018
Location: Canada
Device: Kobo Libra H2O, formerly Aura HD
I use this template to convert uri: identifiers to gutenberg: ones.

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
To use this, get the Action Chains plugin and make a chain that applies a single-field template edit to the identifier field.

Click image for larger version

Name:	2023-09-07 01_04_55-Window.png
Views:	64
Size:	43.0 KB
ID:	203603

If you prefer different identifier, change 'gutenberg' in lines 5 and 12. You can also change the checks in line 8 and 16 to something like 'Gutenberg' inlist $tags.

Last edited by ownedbycats; 09-07-2023 at 12:09 AM.
ownedbycats is online now   Reply With Quote