View Single Post
Old 02-22-2023, 07:36 AM   #1023
Dfaure
Enthusiast
Dfaure began at the beginning.
 
Posts: 31
Karma: 10
Join Date: Jan 2013
Device: Kobo Libra 2 & Aura HD, Cybook Muse
Some issues with action chains and template language

Hi,

I'm used to managing several readers (mostly Kobos) from a single Calibre library instance. To keep track of which reader has transferred which book, I maintain an extra tag-like user column to store this data, and I wanted to automate the process using Action Chains.

So, I created a chain of one Single Field Edit action targeting my custom column, to be triggered manually as needed:

Code:
Choosen column: #extra_tags
Code:
program:
	tag_field = '#extra_tags';
	s = ',';
	fname = 'ondevice';
	device = connected_device_name('main');
	if field_exists(fname) then
		test(field(fname),
			list_union(field(tag_field), device, s),
			list_difference(field(tag_field), device, s))
	fi
This works globally, but I'm stuck on some annoyances or features that I miss in the plugin, the template language definition or even in Calibre itself:
  • Cf. the tag_field initialization, what is the way to get the name of the selected column in the template code without being forced to redefine it again in the template code?
  • When setting up the feature, I noticed that when dealing with Kobo readers, the device name reported was one of those I had specified via the Kobo Utilities plugin. I was wondering how I could get a similar customization for other device brands?
  • Given the previous consideration, what would be the best way to handle a bunch of associations between a <tag_text> and a <device_name> in my action chain, i.e. how could I use Chain Variables for that ?
Anyway, I also want to thank you for the quality of the tools and the environment they rely on.

Last edited by Dfaure; 02-22-2023 at 08:25 AM. Reason: broken title and completed questions
Dfaure is offline   Reply With Quote