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-28-2025, 04:12 AM   #1
Terisa de morgan
Grand Sorcerer
Terisa de morgan ought to be getting tired of karma fortunes by now.Terisa de morgan ought to be getting tired of karma fortunes by now.Terisa de morgan ought to be getting tired of karma fortunes by now.Terisa de morgan ought to be getting tired of karma fortunes by now.Terisa de morgan ought to be getting tired of karma fortunes by now.Terisa de morgan ought to be getting tired of karma fortunes by now.Terisa de morgan ought to be getting tired of karma fortunes by now.Terisa de morgan ought to be getting tired of karma fortunes by now.Terisa de morgan ought to be getting tired of karma fortunes by now.Terisa de morgan ought to be getting tired of karma fortunes by now.Terisa de morgan ought to be getting tired of karma fortunes by now.
 
Terisa de morgan's Avatar
 
Posts: 6,627
Karma: 12595249
Join Date: Jun 2009
Location: Madrid, Spain
Device: Kobo Clara/Aura One/Forma,XiaoMI 5, iPad, Huawei MediaPad, YotaPhone 2
Problem with template in Kobo Driver

I've got this template for subtitle in the Kobo Driver, and it has been working till now (it works indeed when I send the books):
Code:
program:
	pags = field ("#pag");
	subDes = field ("#subd_enc");
	miVal = field ("#mi_val");
     mediaStar = field ("#media_s");
	
	subTitle = pags ;
	if (subDes)
	then
		subTitle = subTitle & "-" & subDes
	fi;

	if (miVal > 0)
	then
		subTitle = subTitle & " (" & rating_to_stars(miVal, 0);
		if (fractional_part (miVal) !=# 0)
		then
			subTitle = subTitle & "½" & ")"
		else
			subTitle = subTitle & ")"
		fi
	fi;
	subTitle
Now, just out of the blue, I try to modify another configuration in the driver and I get this message:

Spoiler:
calibre, version 8.5.0
ERROR: Invalid template for Subtitle: <p>The template "program:
pags = field ("#pag");
subDes = field ("#subd_enc");
miVal = field ("#mi_val");
mediaStar = field ("#media_s");

subTitle = pags ;
if (subDes)
then
subTitle = subTitle & "-" & subDes
fi;

if (miVal > 0)
then
subTitle = subTitle & " (" & rating_to_stars(miVal, 0);
if (fractional_part (miVal) !=# 0)
then
subTitle = subTitle & "½" & ")"
else
subTitle = subTitle & ")"
fi
fi;
subTitle" is invalid:<br>The rating must be a number between 0 and 5



What has changed? As I haven't touched it since the Kobo Extended driver was deprecated.
Additional info: I see the json file has as date: Jun 5, 2025, that I added another collection to ignore, and the change was fine. I've been up to date with 8 version, so I would be running the latest release at that moment. And, furthermore, it has just worked when I've sent books to the device.

Last edited by Terisa de morgan; 06-28-2025 at 04:24 AM. Reason: Adding new info.
Terisa de morgan is offline   Reply With Quote
Old 06-28-2025, 05:26 AM   #2
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,443
Karma: 8012886
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
What changed is that from 11 May the kobo driver now checks templates. Unfortunately it doesn't have a real book so it uses "fake" metadata. This can cause the problem you are seeing.

I think I will take out the validations. They seem to cause more problems than help.

Last edited by chaley; 06-28-2025 at 07:01 AM. Reason: Grammar
chaley is offline   Reply With Quote
Advert
Old 06-28-2025, 07:10 AM   #3
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,443
Karma: 8012886
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
I've submitted a fix to Kovid.

The specific problem is that the fake metadata for your rating column is text, which can't convert to a number. You can work around the problem until my fix is released by changing
Code:
miVal = field ("#mi_val");
to
Code:
miVal = format_number($#mi_val, 'd');
The format_number() function changes invalid text to the empty string, which is interpreted as 0 in a numeric context.
chaley is offline   Reply With Quote
Old 06-28-2025, 11:22 AM   #4
Terisa de morgan
Grand Sorcerer
Terisa de morgan ought to be getting tired of karma fortunes by now.Terisa de morgan ought to be getting tired of karma fortunes by now.Terisa de morgan ought to be getting tired of karma fortunes by now.Terisa de morgan ought to be getting tired of karma fortunes by now.Terisa de morgan ought to be getting tired of karma fortunes by now.Terisa de morgan ought to be getting tired of karma fortunes by now.Terisa de morgan ought to be getting tired of karma fortunes by now.Terisa de morgan ought to be getting tired of karma fortunes by now.Terisa de morgan ought to be getting tired of karma fortunes by now.Terisa de morgan ought to be getting tired of karma fortunes by now.Terisa de morgan ought to be getting tired of karma fortunes by now.
 
Terisa de morgan's Avatar
 
Posts: 6,627
Karma: 12595249
Join Date: Jun 2009
Location: Madrid, Spain
Device: Kobo Clara/Aura One/Forma,XiaoMI 5, iPad, Huawei MediaPad, YotaPhone 2
Quote:
Originally Posted by chaley View Post
What changed is that from 11 May the kobo driver now checks templates. Unfortunately it doesn't have a real book so it uses "fake" metadata. This can cause the problem you are seeing.

I think I will take out the validations. They seem to cause more problems than help.
If fake metadata doesn't take into account real types... yes, I see it
Terisa de morgan is offline   Reply With Quote
Old 06-28-2025, 11:26 AM   #5
Terisa de morgan
Grand Sorcerer
Terisa de morgan ought to be getting tired of karma fortunes by now.Terisa de morgan ought to be getting tired of karma fortunes by now.Terisa de morgan ought to be getting tired of karma fortunes by now.Terisa de morgan ought to be getting tired of karma fortunes by now.Terisa de morgan ought to be getting tired of karma fortunes by now.Terisa de morgan ought to be getting tired of karma fortunes by now.Terisa de morgan ought to be getting tired of karma fortunes by now.Terisa de morgan ought to be getting tired of karma fortunes by now.Terisa de morgan ought to be getting tired of karma fortunes by now.Terisa de morgan ought to be getting tired of karma fortunes by now.Terisa de morgan ought to be getting tired of karma fortunes by now.
 
Terisa de morgan's Avatar
 
Posts: 6,627
Karma: 12595249
Join Date: Jun 2009
Location: Madrid, Spain
Device: Kobo Clara/Aura One/Forma,XiaoMI 5, iPad, Huawei MediaPad, YotaPhone 2
Quote:
Originally Posted by chaley View Post
I've submitted a fix to Kovid.

The specific problem is that the fake metadata for your rating column is text, which can't convert to a number. You can work around the problem until my fix is released by changing
Code:
miVal = field ("#mi_val");
to
Code:
miVal = format_number($#mi_val, 'd');
The format_number() function changes invalid text to the empty string, which is interpreted as 0 in a numeric context.
Thank you, I've changed it and it works Anyway, I'd already solved my problem, as it was a small change, and notepad++ over json complains less
Terisa de morgan is offline   Reply With Quote
Advert
Old 06-28-2025, 11:53 AM   #6
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,443
Karma: 8012886
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
Quote:
Originally Posted by Terisa de morgan View Post
If fake metadata doesn't take into account real types... yes, I see it
The changes I submitted solve exactly this problem, constructing a Metadata object by looking at the types of the fields in the database. I used the same solution as I did for the Template Tester some years ago. Once the change is accepted, if the template works in the template tester called from the Kobo driver then it will also work when the driver does validatation.

A side benefit: constructing a "model" metadata instance, one with all fields defined and set to plausible values, is now done by the API function get_model_metadata_instance() in calibre.ebooks.metadata.base.
chaley is offline   Reply With Quote
Old 06-29-2025, 03:09 AM   #7
Terisa de morgan
Grand Sorcerer
Terisa de morgan ought to be getting tired of karma fortunes by now.Terisa de morgan ought to be getting tired of karma fortunes by now.Terisa de morgan ought to be getting tired of karma fortunes by now.Terisa de morgan ought to be getting tired of karma fortunes by now.Terisa de morgan ought to be getting tired of karma fortunes by now.Terisa de morgan ought to be getting tired of karma fortunes by now.Terisa de morgan ought to be getting tired of karma fortunes by now.Terisa de morgan ought to be getting tired of karma fortunes by now.Terisa de morgan ought to be getting tired of karma fortunes by now.Terisa de morgan ought to be getting tired of karma fortunes by now.Terisa de morgan ought to be getting tired of karma fortunes by now.
 
Terisa de morgan's Avatar
 
Posts: 6,627
Karma: 12595249
Join Date: Jun 2009
Location: Madrid, Spain
Device: Kobo Clara/Aura One/Forma,XiaoMI 5, iPad, Huawei MediaPad, YotaPhone 2
Thank you, I'll test the original templatge again when the changes are in the official realese.
Terisa de morgan is offline   Reply With Quote
Reply


Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Problem with template function JohnAndJane Library Management 1 03-16-2025 01:35 PM
Save template problem antoon Library Management 12 08-17-2012 12:47 PM
Driver Problem imsoawesome Kobo Reader 6 07-22-2012 12:57 AM
New Calibre Kobo Driver allows deleting of Kobo Free books timlegge Kobo Reader 46 08-27-2011 10:16 PM
Problem installing driver zander_nyrond Calibre 11 08-02-2008 05:18 PM


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


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