Mobileread
Plugboard, template, and custom composite column recipes
#871  Penny_Dreadful 06-01-2020, 11:02 PM
Hello, I'm looking for some help creating a composite column combined with an advanced icon rule, to give me a column that has icons for the online libraries I can borrow that book from. I currently have columns for each of theses online libraries but I'm hoping to combine the columns into one.

The Calibre Library is my Wish-list/To Read Library so its full of empty books with full metadata. The ID field might have ids for "borrowbox", "wheelers" and "odid" which is a combined ID that might have Overdrive ID and/or a Kindle Unlimited ID. It might also not have any of those IDs in which case I'd like nothing to show in that column.

The IDs look like this:
borrowbox:AAU_779614 Three uppercase letters then an underscore then six numbers ^[A-Z]{3}_\d{6}$ is the regex I am using for the single column
wheelers:9781760873752 Yes this is the ISBN 13 of the book ^(?=(?:\D*\d){10}(?:(?:\D*\d){3})?$)[\d-]+$ ISBN regex.

and the odid can look like one of these:
odid:5426939@wapldmc.overdrive.com
odid:B088PB8T42@ak/unlimited
odid:2077018@wapldmc.overdrive.com&B00PY6CSNM@ak/unlimited

and my icons are named kunlimited.png, wheelers.png, borrowbox.png and overdrive.png

Thanks for any help!

I've created the column listing the IDs by using the template:
program:
strcat(select(field('identifiers'),'odid'),' ', select(field('identifiers'),'borrowbox'),' ', select(field('identifiers'),'wheelers'));

but getting the icons to work using an advanced rule is just confusing me.
Reply 

#872  davidfor 06-02-2020, 04:46 AM
Quote Penny_Dreadful
Hello, I'm looking for some help creating a composite column combined with an advanced icon rule, to give me a column that has icons for the online libraries I can borrow that book from. I currently have columns for each of theses online libraries but I'm hoping to combine the columns into one.

The Calibre Library is my Wish-list/To Read Library so its full of empty books with full metadata. The ID field might have ids for "borrowbox", "wheelers" and "odid" which is a combined ID that might have Overdrive ID and/or a Kindle Unlimited ID. It might also not have any of those IDs in which case I'd like nothing to show in that column.

The IDs look like this:
borrowbox:AAU_779614 Three uppercase letters then an underscore then six numbers ^[A-Z]{3}_\d{6}$ is the regex I am using for the single column
wheelers:9781760873752 Yes this is the ISBN 13 of the book ^(?=(?:\D*\d){10}(??:\D*\d){3})?$)[\d-]+$ ISBN regex.

and the odid can look like one of these:
odid:5426939@wapldmc.overdrive.com
odid:B088PB8T42@ak/unlimited
odid:2077018@wapldmc.overdrive.com&B00PY6CSNM@ak/unlimited

and my icons are named kunlimited.png, wheelers.png, borrowbox.png and overdrive.png

Thanks for any help!

I've created the column listing the IDs by using the template:
program:
strcat(select(field('identifiers'),'odid'),' ', select(field('identifiers'),'borrowbox'),' ', select(field('identifiers'),'wheelers'));

but getting the icons to work using an advanced rule is just confusing me.
The result of the advanced icon rule has to be the name of the icon to use. I can't work out how to return multiple icons in one advance rule, so, you need one rule per icon that could be displayed. If you could have only one source for each book, we could create a rule that returned a single icon name.

The following advanced rule should work to give the icon for Overdrive:

Code
program:
id = select(field('identifiers'),'odid');
contains(id, 'overdrive', 'overdrive.png','')
And for Amazon Unlimited
Code
program:
id = select(field('identifiers'),'odid');
contains(id, 'unlimited', 'kunlimited.png','')
Add each of the above as separate advanced rules with the "Kind" of either "composed icons w/text" or "composed icons w/no text". That will allow multiple icons to be shown in a single column.

For "Borrowbox" and "Wheelers", the value of the identifier shouldn't matter, just that the identifier exists. And you can use simple icon rules. The first field needs to be set to either "composed icons w/text" or "composed icons w/no text". The condition is "If the Identifiers column has id value: wheelers". And then do a similar rule for "Borrowbox".
Reply 

#873  Penny_Dreadful 06-02-2020, 05:58 AM
@davidfor Thank you so much, the big thing I was missing was "composed icons" now I know why my rules kept on overwriting each other!

The advanced rule code helped heaps too, my Wishlist library is now so much more useful now I can see all the libraries I can borrow a book from in a single column instead of having them spread across three columns.

The amount of help you give out on these forums is amazing, thank you!
Reply 

#874  chaley 06-02-2020, 06:08 AM
Quote davidfor
The result of the advanced icon rule has to be the name of the icon to use. I can't work out how to return multiple icons in one advance rule,
Return a colon-separated list of icon file names. You can construct that list icon by icon using list_union
Reply 

#875  davidfor 06-02-2020, 06:19 AM
Quote chaley
Return a colon-separated list of icon file names. You can construct that list icon by icon using list_union
Colon's of course.
Reply 

#876  Carmelocotonto 06-20-2020, 07:12 AM
Hi,
Is it possible to add the value of a custom column to the book description?, and then add the result to the epub file?
Thanks
Reply 

#877  davidfor 06-20-2020, 08:12 AM
Quote Carmelocotonto
Is it possible to add the value of a custom column to the book description?, and then add the result to the epub file?
A metadata plugboard can update the comments field when the book is sent to the device or a save to disk is done. This can include data from any column.
Reply 

#878  Carmelocotonto 06-20-2020, 09:50 AM
Quote davidfor
A metadata plugboard can update the comments field when the book is sent to the device or a save to disk is done. This can include data from any column.
Thanks. Something like...
epub:save_to_disk = ([{#words} - {comments}] -> comments)

But I don't see what happens. Where will the new 'comments' be?

I have created custom columns but I have never used templates. Any help will help me.

This is what I want (I have modified this one by hand):
show attachment »

And then, polish epub.
Reply 

#879  davidfor 06-20-2020, 10:37 AM
Quote Carmelocotonto
Thanks. Something like...
epub:save_to_disk = ([{#words} - {comments}] -> comments)

But I don't see what happens. Where will the new 'comments' be?

I have created custom columns but I have never used templates. Any help will help me.

This is what I want (I have modified this one by hand):
show attachment »

And then, polish epub.
What you have would work. But, it would be pretty ugly on the device. What I use is:

Code
{comments}{:'raw_field("tags")'|<p><b>Tags:</b> |</p>}{rating:rating_as_stars()|<p><b>Rating:</b> |</p>}{#kobo_last_read:|<p><b>Last Read:</b> |</p>}{:'test(field('#words'),'<p>',test(field('#pages'),'<p>',''))'}{#words:|<b>Word count:</b> |}{:'test(field('#words'),test(field('#pages'),' ',''),'')'}{#pages:|<b>Page count:</b> |}{:'test(field('#words'),'</p>',test(field('#pages'),'</p>',''))'}
That produces something like:
Quote
This is the book comment.

Tags: Science Fiction, Space Opera
Pages: 200 Words: 123450
The complications in the plugboard is in case any of the values are missing.

Another was posted in the Kobo forum in the last couple of days. That one puts the details first. And the post has some screenshots of what it looks like on a Kobo device.
Reply 

#880  theducks 06-20-2020, 11:01 AM
Not all devices support (can display) Comments.
Where they choose to gather what they display, might be another.
And if you use a wireless delivery, who knows what they filter/insert/replace
Reply 

 « First  « Prev   (88/88)
Today's Posts | Search this Thread | Login | Register