Register Guidelines E-Books Today's Posts Search

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

Notices

Reply
 
Thread Tools Search this Thread
Old 06-09-2024, 01:33 PM   #1006
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: 12,045
Karma: 7548549
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
Quote:
Originally Posted by maddz View Post
What it's doing is if there are entries in all 3 fields is producing the output:
'Subseries' 'Subseries Index' - 'My Shelves' 'Hugo Nominations'

What I want it to do is produce:
'Subseries' 'Subseries Index' - 'My Shelves' - 'Hugo Nominations'

Ideally, it should be:
'Subseries' 'Subseries Index'
'My Shelves'
'Hugo Nominations'

But I am not sure if the subtitle field can take more than one line...

If there is less than three entries (every title will have 'My Shelves'), the line breaks for the subseries and Hugos should be suppressed, so there is either 1 line or 2 lines:

'My Shelves'

or

'Subseries' Subseries Index'
'My Shelves'

or

'My Shelves'
'Hugo Nominations'
Putting aside the newlines, this template does what the above says you want. There might be some misspellings in the column lookup names as I don't have those columns in my database.
Code:
{#subseries}{#subseries_index:| | - }{#myshelves}{#hugonominees:| - |}
I tested it with columns I have:
Code:
{#series}{#series_index:| | - }{#genre}{tags:| - |}
EDIT: According to this post I tested newlines in the subtitle and they didn't work. The the template below isn't useful.

This GPM template does the same thing except for using newlines instead of the minus signs.
Code:
program:
# This template produces a 1-to-3 line result.
# The first line is the subseries if there is one.
# The next line is the shelves, which are always present.
# The last line is the hugo nominees, if there is one.

	if $subseries then
		ss = $#subseries & ' ' & $#subseries_index & character('newline')
	else
		ss = ''
	fi;

	if $#hugonominees then
		hugo = character('newline') & $#hugonominees
	else
		hugo = ''
	fi;

	return ss & $#myshelves & hugo
NB: I left off some of the '#' characters in the template in my last post. I tested it with columns that exist then incorrectly edited it to reference your columns.

Last edited by chaley; 06-09-2024 at 01:38 PM.
chaley is offline   Reply With Quote
Old 06-09-2024, 02:46 PM   #1007
maddz
Wizard
maddz ought to be getting tired of karma fortunes by now.maddz ought to be getting tired of karma fortunes by now.maddz ought to be getting tired of karma fortunes by now.maddz ought to be getting tired of karma fortunes by now.maddz ought to be getting tired of karma fortunes by now.maddz ought to be getting tired of karma fortunes by now.maddz ought to be getting tired of karma fortunes by now.maddz ought to be getting tired of karma fortunes by now.maddz ought to be getting tired of karma fortunes by now.maddz ought to be getting tired of karma fortunes by now.maddz ought to be getting tired of karma fortunes by now.
 
Posts: 1,348
Karma: 29573004
Join Date: Mar 2010
Location: UK
Device: Kobo Forma, Icarus, iPad Mini 2, Kobo Touch, Google Nexus 7
Ah yes - my mistake, it was you not Davidfor who helped me with the initial set-up for the subtitle field.

I think I will leave things as they are, although it's annoying not to have the separator (-) between the 'My Shelves' and 'Hugo Nominations' sections. I suspect I would need to change the order to subtitle, Hugo nominations, my shelves to get the separator working correctly.

Thanks for all your help!
maddz is offline   Reply With Quote
Old 06-09-2024, 03:18 PM   #1008
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: 12,045
Karma: 7548549
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
Quote:
Originally Posted by maddz View Post
Ah yes - my mistake, it was you not Davidfor who helped me with the initial set-up for the subtitle field.

I think I will leave things as they are, although it's annoying not to have the separator (-) between the 'My Shelves' and 'Hugo Nominations' sections. I suspect I would need to change the order to subtitle, Hugo nominations, my shelves to get the separator working correctly.

Thanks for all your help!
But as I said, your template breaks the rules, specifically the "no subtemplates in Single Function Mode" one. It it works then it is by accident. It could fail at any time.

Try the template I last posted:
Code:
{#subseries}{#subseries_index:| | - }{#myshelves}{#hugonominees:| - |}
It should produce the same result except for properly placing the hyphen, without breaking the rules.
chaley is offline   Reply With Quote
Old 06-09-2024, 03:51 PM   #1009
maddz
Wizard
maddz ought to be getting tired of karma fortunes by now.maddz ought to be getting tired of karma fortunes by now.maddz ought to be getting tired of karma fortunes by now.maddz ought to be getting tired of karma fortunes by now.maddz ought to be getting tired of karma fortunes by now.maddz ought to be getting tired of karma fortunes by now.maddz ought to be getting tired of karma fortunes by now.maddz ought to be getting tired of karma fortunes by now.maddz ought to be getting tired of karma fortunes by now.maddz ought to be getting tired of karma fortunes by now.maddz ought to be getting tired of karma fortunes by now.
 
Posts: 1,348
Karma: 29573004
Join Date: Mar 2010
Location: UK
Device: Kobo Forma, Icarus, iPad Mini 2, Kobo Touch, Google Nexus 7
Quote:
Originally Posted by chaley View Post
But as I said, your template breaks the rules, specifically the "no subtemplates in Single Function Mode" one. It it works then it is by accident. It could fail at any time.

Try the template I last posted:
Code:
{#subseries}{#subseries_index:| | - }{#myshelves}{#hugonominees:| - |}
It should produce the same result except for properly placing the hyphen, without breaking the rules.
I did. I got PLUGBOARD ERROR on the Kobo whereas my modification to the original code works apart from the missing hyphen.

This is in the Kobo Utilities plug-in? The KoboExtended driver? It doesn't seem to be possible to create a metadata plugboard to input to the subtitle field.

Last edited by maddz; 06-09-2024 at 03:54 PM.
maddz is offline   Reply With Quote
Old 06-09-2024, 04:00 PM   #1010
DNSB
Bibliophagist
DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.
 
DNSB's Avatar
 
Posts: 40,631
Karma: 157444382
Join Date: Jul 2010
Location: Vancouver
Device: Kobo Sage, Libra Colour, Lenovo M8 FHD, Paperwhite 4, Tolino epos
Quote:
Originally Posted by maddz View Post
This is in the Kobo Utilities plug-in? The KoboExtended driver? It doesn't seem to be possible to create a metadata plugboard to input to the subtitle field.
I didn't feel like creating the custom columns but I suspect it should be in the subtitle field on page 3 (Metadata, on device & advanced) of the KoboTouch/KoboTouchExtended driver configuration dialog.
DNSB is offline   Reply With Quote
Old 06-09-2024, 04:14 PM   #1011
maddz
Wizard
maddz ought to be getting tired of karma fortunes by now.maddz ought to be getting tired of karma fortunes by now.maddz ought to be getting tired of karma fortunes by now.maddz ought to be getting tired of karma fortunes by now.maddz ought to be getting tired of karma fortunes by now.maddz ought to be getting tired of karma fortunes by now.maddz ought to be getting tired of karma fortunes by now.maddz ought to be getting tired of karma fortunes by now.maddz ought to be getting tired of karma fortunes by now.maddz ought to be getting tired of karma fortunes by now.maddz ought to be getting tired of karma fortunes by now.
 
Posts: 1,348
Karma: 29573004
Join Date: Mar 2010
Location: UK
Device: Kobo Forma, Icarus, iPad Mini 2, Kobo Touch, Google Nexus 7
Quote:
Originally Posted by DNSB View Post
I didn't feel like creating the custom columns but I suspect it should be in the subtitle field on page 3 (Metadata, on device & advanced) of the KoboTouch/KoboTouchExtended driver configuration dialog.
Yes, that's where I've input it, as well as in the dialogue box when you click on the plug-in selector (the down arrow) and select the 'Update metadata in device library' option.
maddz is offline   Reply With Quote
Old 06-09-2024, 05:05 PM   #1012
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: 12,045
Karma: 7548549
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
Quote:
Originally Posted by maddz View Post
I did. I got PLUGBOARD ERROR on the Kobo whereas my modification to the original code works apart from the missing hyphen.

This is in the Kobo Utilities plug-in? The KoboExtended driver? It doesn't seem to be possible to create a metadata plugboard to input to the subtitle field.
What is the rest of the error message?

My guess is that I misspelled one of your column names. You can test this by using the template editor/tester.
chaley is offline   Reply With Quote
Old 06-09-2024, 05:47 PM   #1013
maddz
Wizard
maddz ought to be getting tired of karma fortunes by now.maddz ought to be getting tired of karma fortunes by now.maddz ought to be getting tired of karma fortunes by now.maddz ought to be getting tired of karma fortunes by now.maddz ought to be getting tired of karma fortunes by now.maddz ought to be getting tired of karma fortunes by now.maddz ought to be getting tired of karma fortunes by now.maddz ought to be getting tired of karma fortunes by now.maddz ought to be getting tired of karma fortunes by now.maddz ought to be getting tired of karma fortunes by now.maddz ought to be getting tired of karma fortunes by now.
 
Posts: 1,348
Karma: 29573004
Join Date: Mar 2010
Location: UK
Device: Kobo Forma, Icarus, iPad Mini 2, Kobo Touch, Google Nexus 7
Quote:
Originally Posted by chaley View Post
What is the rest of the error message?

My guess is that I misspelled one of your column names. You can test this by using the template editor/tester.
I amended my original code to match yours and got the error... It was the same message if I copy/pasted your code.

I'll check next time I fire up Calibre; it's nearly bedtime for me.
maddz is offline   Reply With Quote
Old 07-13-2024, 03:53 PM   #1014
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: 774
Karma: 340954
Join Date: Sep 2017
Location: Argentina
Device: moon+ reader, kindle paperwhite
Hello everyone, I have an advanced rule that I use in the emblems part to show me the author's image next to the cover.
program: rslt=''; tags = $tags;
rslt = list_item(tags, 0, '&') & '.png';
for i in range(1, list_count(tags, '&')):
if i == 4 then break fi;
rslt = rslt & ':' & list_item(tags, i, '&') & '.png'
rof;
return rslt

I thought about using it in the tags column to put one icon per label but it only shows me a single icon with the images of the other tags.
Any solution or comment would be helpful.
Attached Thumbnails
Click image for larger version

Name:	1.png
Views:	183
Size:	91.8 KB
ID:	209546  

Last edited by dunhill; 07-13-2024 at 04:05 PM.
dunhill is offline   Reply With Quote
Old 07-13-2024, 05:33 PM   #1015
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: 12,045
Karma: 7548549
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
Quote:
Originally Posted by dunhill View Post
Hello everyone, I have an advanced rule that I use in the emblems part to show me the author's image next to the cover.
program: rslt=''; tags = $tags;
rslt = list_item(tags, 0, '&') & '.png';
for i in range(1, list_count(tags, '&')):
if i == 4 then break fi;
rslt = rslt & ':' & list_item(tags, i, '&') & '.png'
rof;
return rslt

I thought about using it in the tags column to put one icon per label but it only shows me a single icon with the images of the other tags.
Any solution or comment would be helpful.
Tags use a comma as a separator, not an ampersand.
chaley is offline   Reply With Quote
Old 07-14-2024, 07:17 PM   #1016
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: 774
Karma: 340954
Join Date: Sep 2017
Location: Argentina
Device: moon+ reader, kindle paperwhite
Quote:
Originally Posted by chaley View Post
Tags use a comma as a separator, not an ampersand.
Thank Chaley, it worked!!
dunhill is offline   Reply With Quote
Old 09-06-2024, 01:15 PM   #1017
Mister L
Groupie
Mister L is the 'tall, dark, handsome stranger' all the fortune-tellers are referring to.Mister L is the 'tall, dark, handsome stranger' all the fortune-tellers are referring to.Mister L is the 'tall, dark, handsome stranger' all the fortune-tellers are referring to.Mister L is the 'tall, dark, handsome stranger' all the fortune-tellers are referring to.Mister L is the 'tall, dark, handsome stranger' all the fortune-tellers are referring to.Mister L is the 'tall, dark, handsome stranger' all the fortune-tellers are referring to.Mister L is the 'tall, dark, handsome stranger' all the fortune-tellers are referring to.Mister L is the 'tall, dark, handsome stranger' all the fortune-tellers are referring to.Mister L is the 'tall, dark, handsome stranger' all the fortune-tellers are referring to.Mister L is the 'tall, dark, handsome stranger' all the fortune-tellers are referring to.Mister L is the 'tall, dark, handsome stranger' all the fortune-tellers are referring to.
 
Posts: 173
Karma: 91148
Join Date: Jun 2010
Device: Sony 350
I am trying to create a custom column from tags to manage collections on the kobo, but no values are being added (neither in the column, nor in the collections on the device). Maybe it's because I'm trying to use regex in the program code?

When I add a book recommended by someone, I add a tag "reco [name]". So for instance "reco Martha Wells". I would like the copy this tag to the "reco" column to use as a collection column.

I created a "reco" column from other columns, acts like tags:
Code:
program:
	switch_if(
		$tags == 'reco (.*)', 'reco \1', 
		'')
But this "reco" column is never filled. Am I missing a step somewhere?



Part two, would it be possible to also, automatically add any books with a value in the "reco" column to a general collection named "friends recos"?

Could I do that with something like this, either in the column or in the collections model in the KoboTouchExtended Driver?
Code:
program:
	switch_if(
		$tags == 'reco (.*)', 'reco \1', 
		$tags == 'reco (.*)', 'recos amis', 
		'')
Mister L is offline   Reply With Quote
Old 09-06-2024, 02:13 PM   #1018
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: 12,045
Karma: 7548549
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
Quote:
Originally Posted by Mister L View Post
I am trying to create a custom column from tags to manage collections on the kobo, but no values are being added (neither in the column, nor in the collections on the device). Maybe it's because I'm trying to use regex in the program code?

When I add a book recommended by someone, I add a tag "reco [name]". So for instance "reco Martha Wells". I would like the copy this tag to the "reco" column to use as a collection column.

I created a "reco" column from other columns, acts like tags:
Code:
program:
	switch_if(
		$tags == 'reco (.*)', 'reco \1', 
		'')
But this "reco" column is never filled. Am I missing a step somewhere?



Part two, would it be possible to also, automatically add any books with a value in the "reco" column to a general collection named "friends recos"?

Could I do that with something like this, either in the column or in the collections model in the KoboTouchExtended Driver?
Code:
program:
	switch_if(
		$tags == 'reco (.*)', 'reco \1', 
		$tags == 'reco (.*)', 'recos amis', 
		'')
The expression you are using won't work in the template language. I didn't add perl syntax.

Also, if I am understanding you correctly there can be multiple 'reco XX' tags attached to a book. In this case you must process the tags one at a time. This template does that, and your case 2.
Code:
program:
	result = '';
	for t in $tags:
		if substr(t, 0, 5) == 'reco ' then
			result = list_join(',', result, ',', t & ',' & 'recos amis', ',')
		fi
	rof;
	result
Alternatively you could do it in python template mode using a list comprehension that filters out anything not starting with 'reco '. Try that if you know python.
chaley is offline   Reply With Quote
Old 09-06-2024, 04:10 PM   #1019
Mister L
Groupie
Mister L is the 'tall, dark, handsome stranger' all the fortune-tellers are referring to.Mister L is the 'tall, dark, handsome stranger' all the fortune-tellers are referring to.Mister L is the 'tall, dark, handsome stranger' all the fortune-tellers are referring to.Mister L is the 'tall, dark, handsome stranger' all the fortune-tellers are referring to.Mister L is the 'tall, dark, handsome stranger' all the fortune-tellers are referring to.Mister L is the 'tall, dark, handsome stranger' all the fortune-tellers are referring to.Mister L is the 'tall, dark, handsome stranger' all the fortune-tellers are referring to.Mister L is the 'tall, dark, handsome stranger' all the fortune-tellers are referring to.Mister L is the 'tall, dark, handsome stranger' all the fortune-tellers are referring to.Mister L is the 'tall, dark, handsome stranger' all the fortune-tellers are referring to.Mister L is the 'tall, dark, handsome stranger' all the fortune-tellers are referring to.
 
Posts: 173
Karma: 91148
Join Date: Jun 2010
Device: Sony 350
Quote:
Originally Posted by chaley View Post
The expression you are using won't work in the template language. I didn't add perl syntax.
Ha. I knew it was the regex causing trouble.

Quote:
Originally Posted by chaley View Post
Also, if I am understanding you correctly there can be multiple 'reco XX' tags attached to a book. In this case you must process the tags one at a time. This template does that, and your case 2.
Code:
program:
	result = '';
	for t in $tags:
		if substr(t, 0, 5) == 'reco ' then
			result = list_join(',', result, ',', t & ',' & 'recos amis', ',')
		fi
	rof;
	result
Excellent. Works perfectly! Thank you!
Mister L is offline   Reply With Quote
Old 10-17-2024, 12:48 AM   #1020
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: 9,586
Karma: 65099765
Join Date: Oct 2018
Location: Canada
Device: Kobo Libra H2O, formerly Aura HD
Click image for larger version

Name:	2024-10-17 00_47_43-Window.png
Views:	31
Size:	12.2 KB
ID:	211451

As I often re-read books, I like to store all my completion dates in a taglike column (e.g. 2021-03-13, 2022-04-21, 2023-04-17, 2024-05-29). I use this composite column to group them by month in the tag browser:

Code:
program:

	new_dates = '';

	for dates in '#datesread':
		converted = format_date(dates, 'yyyy.MM (MMMM)');
		new_dates = list_union(new_dates, converted, ',')
	rof

Last edited by ownedbycats; 10-17-2024 at 10:00 PM.
ownedbycats is offline   Reply With Quote
Reply

Tags
custom column, tag, tags


Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
custom column i need a little help shinken Calibre 3 09-15-2010 04:41 AM
Using Custom Metadata in Save Template EJvdH Calibre 1 07-02-2010 07:06 AM
Accessories Decalgirl Kindle 2 custom skin template srmalloy Amazon Kindle 6 04-09-2010 10:55 PM
Donations for Custom Recipes ddavtian Calibre 5 01-23-2010 05:54 PM
Help understanding custom recipes andersent Calibre 0 12-17-2009 03:37 PM


All times are GMT -4. The time now is 11:02 AM.


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