05-01-2016, 09:32 AM | #1111 |
Grand Sorcerer
Posts: 24,905
Karma: 47303822
Join Date: Jul 2011
Location: Sydney, Australia
Device: Kobo:Touch,Glo, AuraH2O, GloHD,AuraONE, ClaraHD, Libra H2O; tolinoepos
|
Beta - Template editor
Attached is a beta for the plugin with changes in how the comments and subtitles are handled. The changes are to add an entry field for the two templates. Each template also has a button to open the calibre template editor.
The existing template for the comments is still supported. If it exists and no template is entered in the dialog, the template from the file will be used. One important thing here is if the results of evaluating the template is empty, the unchanged comments from the calibre library will be used. For the subtitle, using a template will give more flexibility for what it can be set to. If you just want a custom column, the the template is "{#custom_column_name}". And if the template evaluates to an empty string, the subtitle will be cleared. So, if you simply want to remove the subtitle, leave the template empty. As usual, please test and tell me if there are any problems. |
05-01-2016, 04:25 PM | #1112 |
I need a chapter break
Posts: 4,042
Karma: 56058267
Join Date: Mar 2015
Location: Israel
Device: Kobo Glo
|
How can i add a Published to the subtitle template.
When {published} I get ,EXCEPTION: Value: unknown field published. Last edited by oren64; 05-01-2016 at 05:12 PM. |
05-01-2016, 05:06 PM | #1113 |
Grand Sorcerer
Posts: 6,212
Karma: 16534894
Join Date: Sep 2009
Location: UK
Device: Kobo: KA1, ClaraHD, Forma, Libra2, Clara2E. PocketBook: TouchHD3
|
If you hover your mouse in the Published column heading you'll see its fieldname is pubdate not published. Hence the correct template field would be {pubdate}
|
05-01-2016, 07:38 PM | #1114 |
Grand Sorcerer
Posts: 24,905
Karma: 47303822
Join Date: Jul 2011
Location: Sydney, Australia
Device: Kobo:Touch,Glo, AuraH2O, GloHD,AuraONE, ClaraHD, Libra H2O; tolinoepos
|
Or, if you want to see all the available column names, go to the "Add your own columns" page of the calibre preferences. The list of columns also shows these details.
|
05-02-2016, 01:37 AM | #1115 |
Grand Sorcerer
Posts: 6,329
Karma: 12117215
Join Date: Jun 2009
Location: Madrid, Spain
Device: Kobo Clara/Aura One/Forma,XiaoMI 5, iPad, Huawei MediaPad, YotaPhone 2
|
I checked it yesterday (template for comments) and it worked well for me.
|
05-02-2016, 04:06 AM | #1116 |
I need a chapter break
Posts: 4,042
Karma: 56058267
Join Date: Mar 2015
Location: Israel
Device: Kobo Glo
|
The rating shows in numeral (1,2,3...) in template for the comments, and not like here that the stars is show.
Code:
{pubdate:|<p>Published: |</p>}{rating:|<p>Rating: |</p>}{#pages:|<p>Pages count: |} \ {#words:|Word count: |</p>}{tags:|<p>Tags: |</p>}<hr/>{comments} |
05-02-2016, 08:03 AM | #1117 | |
Grand Sorcerer
Posts: 24,905
Karma: 47303822
Join Date: Jul 2011
Location: Sydney, Australia
Device: Kobo:Touch,Glo, AuraH2O, GloHD,AuraONE, ClaraHD, Libra H2O; tolinoepos
|
Quote:
With the "plugboard" style template, there doesn't seem to be a way to display the stars directly. I had to write a template function to do it. My template is: Code:
{comments}{tags:|<p>Tags: |</p>}{rating:rating_as_stars()|<p>Rating: |</p>}{#kobo_last_read:|<p>Last Read: |</p>}{#words:|<p>Word count: |</p>} Function: rating_as_stars Arg count: 1 Documentation: rating_as_stars(x) -- returns x number of stars. And the code: Code:
def evaluate(self, formatter, kwargs, mi, locals, r): try: x = int(r) * '★' except: x = '' return x Documentation: rating_as_stars(r) -- returns r number of filled stars followed by 5-r empty stars. And the code: Code:
def evaluate(self, formatter, kwargs, mi, locals, r): if r: try: i = int(r) except: i = 0 x = i * unichr(9733) + (5-i) * unichr(9734) else: x = '' return x I haven't been able to decide which of these I like better. |
|
05-02-2016, 08:38 AM | #1118 |
I need a chapter break
Posts: 4,042
Karma: 56058267
Join Date: Mar 2015
Location: Israel
Device: Kobo Glo
|
Excellent, thanks David.
I like more the rating_as_stars(r), i also made a patch to increase the details container. Code:
{pubdate:|<div>Published: |</div>}{rating:rating_as_stars()|<div>Rating: |</div>}{#pages:|<div>Pages count: |} \ {#words:|Word count: |</div>}{tags:|<div>Tags: |</div>}<hr/>{comments} Last edited by oren64; 05-09-2016 at 05:30 AM. |
05-02-2016, 08:46 AM | #1119 |
Grand Sorcerer
Posts: 6,329
Karma: 12117215
Join Date: Jun 2009
Location: Madrid, Spain
Device: Kobo Clara/Aura One/Forma,XiaoMI 5, iPad, Huawei MediaPad, YotaPhone 2
|
Thank you for the function [rating_as_stars(x)+, it's very useful as the origin for my half star rating
|
05-02-2016, 10:01 AM | #1120 | |
Grand Sorcerer
Posts: 24,905
Karma: 47303822
Join Date: Jul 2011
Location: Sydney, Australia
Device: Kobo:Touch,Glo, AuraH2O, GloHD,AuraONE, ClaraHD, Libra H2O; tolinoepos
|
Quote:
|
|
05-02-2016, 10:32 AM | #1121 | |
I need a chapter break
Posts: 4,042
Karma: 56058267
Join Date: Mar 2015
Location: Israel
Device: Kobo Glo
|
Quote:
Code:
{pubdate:|<div>Published: |</div>}{rating:rating_as_stars()|<div>Rating: |</div>}{#pages:|<div>Pages count: |} \ {#words:|Word count: |</div>}{tags:|<div>Tags: |</div>}<hr/>{comments} |
|
05-03-2016, 04:42 AM | #1122 |
Guru
Posts: 965
Karma: 3475832
Join Date: May 2012
Location: France
Device: Elipsa, Sage
|
Thank you David: at long last I have the tags in the comments, instead of having to explore the collections to find those a book belonged to.
Edit: I've noticed that transferring new books, the pre-registered search and replace info get stripped, while the other metadata (blurb) are there. Also the usual disconnect / connect again is not enough to get it and the new info, I must also update the metada. Last edited by anacreon; 05-03-2016 at 06:00 AM. |
05-03-2016, 06:23 AM | #1123 | |
Grand Sorcerer
Posts: 24,905
Karma: 47303822
Join Date: Jul 2011
Location: Sydney, Australia
Device: Kobo:Touch,Glo, AuraH2O, GloHD,AuraONE, ClaraHD, Libra H2O; tolinoepos
|
Quote:
Most of the functions of the plugin are manual. You select the books you want to act on and then select the function. The metadata update is one of the manual functions. |
|
05-16-2016, 10:02 AM | #1124 |
Grand Sorcerer
Posts: 24,905
Karma: 47303822
Join Date: Jul 2011
Location: Sydney, Australia
Device: Kobo:Touch,Glo, AuraH2O, GloHD,AuraONE, ClaraHD, Libra H2O; tolinoepos
|
Update to version 2.3.0
I have just uploaded version 2.3.0 of the plugin. This is the official release of the beta from earlier in the month. The change from version 2.2.0 is to add template edit fields for the comments/synopsis and the subtitle. Each field also has a button to open the template editor to help edit and debug the template.
The existing template for the comments is still supported. If it exists and no template is entered in the dialog, the template from the file will be used. One important thing here is if the results of evaluating the template is empty, the unchanged comments from the calibre library will be used. For the subtitle, using a template will give more flexibility for what it can be set to. If you just want a custom column, the the template is "{#custom_column_name}". And if the template evaluates to an empty string, the subtitle will be cleared. So, if you simply want to remove the subtitle, leave the template empty. Calibre should present the update in the next hour or so. As usual, if there are any problems, please report them here. Edit: Sorry, I uploaded the wrong version. The code was the same, but it didn't have the updated version number. I have fixed that now. Last edited by davidfor; 05-16-2016 at 06:24 PM. |
05-18-2016, 01:57 AM | #1125 |
Bibliophagist
Posts: 39,241
Karma: 153111226
Join Date: Jul 2010
Location: Vancouver
Device: Kobo Sage, Libra Colour, Lenovo M8 FHD, Paperwhite 4, Tolino epos
|
version 2.3.0 issue
After updating to 2.3.0, I got the following error message attempting to update the metadata on a dozen books:
Code:
calibre, version 2.56.0 ERROR: Unhandled exception: <b>UnboundLocalError</b>:local variable 'new_comments' referenced before assignment calibre 2.56 [64bit] embedded-python: True is64bit: True Windows-8-6.2.9200 Windows ('64bit', 'WindowsPE') ('Windows', '8', '6.2.9200') Python 2.7.9 Windows: ('8', '6.2.9200', '', 'Multiprocessor Free') Successfully initialized third party plugins: DeDRM && Obok DeDRM && Fantastic Fiction && Open With && FictionDB && Barnes & Noble && Find Duplicates && Extract ISBN && Webscription && Goodreads && Quality Check && Kobo Utilities && SmartEject && Modify ePub Traceback (most recent call last): File "calibre_plugins.koboutilities.action", line 863, in update_metadata File "calibre_plugins.koboutilities.action", line 3558, in _update_metadata UnboundLocalError: local variable 'new_comments' referenced before assignment |
Tags |
calibre, kobo, kobo utilities, kobo-utilities, plugins |
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
[GUI Plugin] Manga plugin | mastertea | Plugins | 6 | 01-06-2022 02:43 AM |
[GUI Plugin] Save Virtual Libraries To Column (GUI) | chaley | Plugins | 14 | 04-04-2021 05:25 AM |
Kobo Utilities Plugin Question | nikev | Kobo Reader | 10 | 09-25-2018 11:55 PM |
[GUI Plugin] Plugin Updater **Deprecated** | kiwidude | Plugins | 159 | 06-19-2011 12:27 PM |