View Single Post
Old 03-24-2023, 01:36 PM   #21
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,465
Karma: 8025600
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
Quote:
Originally Posted by kovidgoyal View Post
I hope the illness has passed.
Not totally, but my brain has defogged enough where I am doing fewer silly things.
Quote:
I myself, had my leg badly burned with boiling water these past few weeks.
Burns are not fun. I hope you are healing without scarring.

As for the proposal: I decided to look at adding a links column to normalized tables in the database. With this I can get rid of the new template function and the calibre://book-details-search link.

If a link for an item is defined then it shows like this example:
Click image for larger version

Name:	Clipboard01.jpg
Views:	113
Size:	17.1 KB
ID:	200587

There are two links there shown as '(item link)'. The item does what it normally does in calibre. The 'item link' opens whatever the link says.

The API in db.cache is:

Code:
    @read_api
    def get_links_for_field(self, field, values):
        '''
        field: the lookup name
        values: singleton, list or tuple of field values.

        returns dict(field_value:link_value, ...)
        '''

    @write_api
    def set_link_for_field(self, field, value_to_link_map):
        '''
        field: the lookup name
        value_to_link_map: dict(field_value:link, ...)

        returns books changed by setting the link
        '''
I don't yet have any UI to manage these. I will probably change the category editor used for tags etc, adding a link column to the table.
chaley is offline   Reply With Quote