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 04-17-2014, 08:27 PM   #1
rbroberts
Junior Member
rbroberts began at the beginning.
 
Posts: 5
Karma: 10
Join Date: Jun 2011
Location: Brooklyn, NY
Device: Nook Color, Kindle 3G
Bogus error in save template from custom column

I have a Samsung Galaxy Note 10.1 (2014) that I'm trying to get files onto. I've defined a couple of custom columns pretty much out of the help pages on the calibre web site

series_stripped: {series:re(^(A|The|An)\s+,)||}
series_initials: {#stripped_series:re(([^\s])[^\s]+(\s|$),\1)}

But when I attempt to "Configure this device" for and use #series_initials in the template, I get an exception

{series:'ifempty($,field('author'))'||/}{#series_initials:|| }{title}
EXCEPTION: Value: unknown field #series_initials

I finally just saved it anyway. It worked.

Calibre 1.32, Fedora 20, x86-64
rbroberts is offline   Reply With Quote
Old 04-18-2014, 03:41 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: 11,734
Karma: 6690881
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
@kovid: the problem is that the MTP driver does not pass field metadata to the template editor dialog, so the editor has no idea what custom columns exist. I don't know if it can get the field metadata at that point in its life cycle.
chaley is offline   Reply With Quote
Advert
Old 04-18-2014, 04:00 AM   #3
kovidgoyal
creator of calibre
kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.
 
kovidgoyal's Avatar
 
Posts: 43,843
Karma: 22666666
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
You should certainly be able to get field metadata for the current library with get_gui().current_db.new_api.field_metadata

However, since the template setting is not per library, perhaps the proper fix is to no validate field names at all? I dont know if that's possible with validation_formatter however.
kovidgoyal is offline   Reply With Quote
Old 04-18-2014, 04:20 AM   #4
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,734
Karma: 6690881
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
The problem isn't the validation formatter. It already indicates that any desired field exists.

The template editor uses the normal formatter so that it can show sample values for the template when editing composite column templates. Perhaps when it is in a no-book context it should use the validation formatter and not attempt show any sample values. That would be relatively easy to do.
chaley is offline   Reply With Quote
Old 04-18-2014, 04:54 AM   #5
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,734
Karma: 6690881
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
Pushed a fix that grabs a copy of field metadata. Turned out not to be feasible to use the validation formatter because it doesn't parse general program mode templates.

This should be OK even in a non per-library context. If the user enters a custom column lookup key then it should be in the current library so that the template can be tested.
chaley is offline   Reply With Quote
Advert
Reply


Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Custom Column with sub-folder template Tanjamuse Library Management 6 01-13-2014 12:22 AM
Template for custom column BeeTee-Ess Library Management 5 10-04-2013 08:55 PM
[Custom Column - Composite] Template Help Requested Ealdwulf Library Management 2 06-16-2012 04:58 AM
Help with template for custom column from tags africalass Library Management 2 07-16-2011 11:47 AM
Using Custom Metadata in Save Template EJvdH Calibre 1 07-02-2010 06:06 AM


All times are GMT -4. The time now is 07:14 PM.


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