Register Guidelines E-Books Search Today's Posts Mark Forums Read

Go Back   MobileRead Forums > E-Book Software > Calibre > Plugins

Notices

Reply
 
Thread Tools Search this Thread
Old 05-01-2016, 09:32 AM   #1111
davidfor
Grand Sorcerer
davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.
 
Posts: 15,085
Karma: 24708566
Join Date: Jul 2011
Location: Sydney, Australia
Device: Kobo: Touch, Glo, Aura H2O, Glo HD, Aura ONE, Clara HD
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.
Attached Files
File Type: zip KoboUtilities-beta.zip (203.3 KB, 156 views)
davidfor is offline   Reply With Quote
Old 05-01-2016, 04:25 PM   #1112
oren64
I need a chapter break
oren64 ought to be getting tired of karma fortunes by now.oren64 ought to be getting tired of karma fortunes by now.oren64 ought to be getting tired of karma fortunes by now.oren64 ought to be getting tired of karma fortunes by now.oren64 ought to be getting tired of karma fortunes by now.oren64 ought to be getting tired of karma fortunes by now.oren64 ought to be getting tired of karma fortunes by now.oren64 ought to be getting tired of karma fortunes by now.oren64 ought to be getting tired of karma fortunes by now.oren64 ought to be getting tired of karma fortunes by now.oren64 ought to be getting tired of karma fortunes by now.
 
oren64's Avatar
 
Posts: 4,033
Karma: 55233815
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.
oren64 is offline   Reply With Quote
Old 05-01-2016, 05:06 PM   #1113
jackie_w
Wizard
jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.jackie_w ought to be getting tired of karma fortunes by now.
 
Posts: 4,442
Karma: 9863419
Join Date: Sep 2009
Location: UK
Device: Sony PRS-350, Kobo AuraHD/Aura6"/H2O/GloHD/KA1/ClaraHD
Quote:
Originally Posted by oren64 View Post
How can i add a Published to the subtitle template.
When {published} I get ,EXCEPTION: Value: unknown field published.
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}
jackie_w is online now   Reply With Quote
Old 05-01-2016, 07:38 PM   #1114
davidfor
Grand Sorcerer
davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.
 
Posts: 15,085
Karma: 24708566
Join Date: Jul 2011
Location: Sydney, Australia
Device: Kobo: Touch, Glo, Aura H2O, Glo HD, Aura ONE, Clara HD
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.
davidfor is offline   Reply With Quote
Old 05-02-2016, 01:37 AM   #1115
Terisa de morgan
Wizard
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: 4,966
Karma: 5438866
Join Date: Jun 2009
Location: Madrid, Spain
Device: Kobo Clara,Kobo Aura One, XiaoMI 5, iPad, Huawei MediaPad, YotaPhone 2
I checked it yesterday (template for comments) and it worked well for me.
Terisa de morgan is online now   Reply With Quote
Old 05-02-2016, 04:06 AM   #1116
oren64
I need a chapter break
oren64 ought to be getting tired of karma fortunes by now.oren64 ought to be getting tired of karma fortunes by now.oren64 ought to be getting tired of karma fortunes by now.oren64 ought to be getting tired of karma fortunes by now.oren64 ought to be getting tired of karma fortunes by now.oren64 ought to be getting tired of karma fortunes by now.oren64 ought to be getting tired of karma fortunes by now.oren64 ought to be getting tired of karma fortunes by now.oren64 ought to be getting tired of karma fortunes by now.oren64 ought to be getting tired of karma fortunes by now.oren64 ought to be getting tired of karma fortunes by now.
 
oren64's Avatar
 
Posts: 4,033
Karma: 55233815
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}
FW 3.13.1
oren64 is offline   Reply With Quote
Old 05-02-2016, 08:03 AM   #1117
davidfor
Grand Sorcerer
davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.
 
Posts: 15,085
Karma: 24708566
Join Date: Jul 2011
Location: Sydney, Australia
Device: Kobo: Touch, Glo, Aura H2O, Glo HD, Aura ONE, Clara HD
Quote:
Originally Posted by oren64 View Post
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}
FW 3.13.1
That image was produced using the "jacket" style template. That was the only choice with the initial beta of this. The disadvantage of this style was that it is harder to not show anything with no values. This will still work with the latest version, but you need to prefix the template with "jacket:".

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>}
The "rating_as_stars()" is defined in the "Template Functions" screen of calibre. On this, you define:

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
And alternative version of this is:

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.
davidfor is offline   Reply With Quote
Old 05-02-2016, 08:38 AM   #1118
oren64
I need a chapter break
oren64 ought to be getting tired of karma fortunes by now.oren64 ought to be getting tired of karma fortunes by now.oren64 ought to be getting tired of karma fortunes by now.oren64 ought to be getting tired of karma fortunes by now.oren64 ought to be getting tired of karma fortunes by now.oren64 ought to be getting tired of karma fortunes by now.oren64 ought to be getting tired of karma fortunes by now.oren64 ought to be getting tired of karma fortunes by now.oren64 ought to be getting tired of karma fortunes by now.oren64 ought to be getting tired of karma fortunes by now.oren64 ought to be getting tired of karma fortunes by now.
 
oren64's Avatar
 
Posts: 4,033
Karma: 55233815
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}
Click image for larger version

Name:	screen_001.png
Views:	547
Size:	104.7 KB
ID:	148376

Last edited by oren64; 05-09-2016 at 05:30 AM.
oren64 is offline   Reply With Quote
Old 05-02-2016, 08:46 AM   #1119
Terisa de morgan
Wizard
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: 4,966
Karma: 5438866
Join Date: Jun 2009
Location: Madrid, Spain
Device: Kobo Clara,Kobo Aura One, 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
Terisa de morgan is online now   Reply With Quote
Old 05-02-2016, 10:01 AM   #1120
davidfor
Grand Sorcerer
davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.
 
Posts: 15,085
Karma: 24708566
Join Date: Jul 2011
Location: Sydney, Australia
Device: Kobo: Touch, Glo, Aura H2O, Glo HD, Aura ONE, Clara HD
Quote:
Originally Posted by oren64 View Post
Excellent, thanks David.

I like more the rating_as_stars(r), i also patch the info-book and increase the details.

Attachment 148376
That looks pretty good. Could you post the template you are using? I might collect a few into one of the early posts in the thread as examples.
davidfor is offline   Reply With Quote
Old 05-02-2016, 10:32 AM   #1121
oren64
I need a chapter break
oren64 ought to be getting tired of karma fortunes by now.oren64 ought to be getting tired of karma fortunes by now.oren64 ought to be getting tired of karma fortunes by now.oren64 ought to be getting tired of karma fortunes by now.oren64 ought to be getting tired of karma fortunes by now.oren64 ought to be getting tired of karma fortunes by now.oren64 ought to be getting tired of karma fortunes by now.oren64 ought to be getting tired of karma fortunes by now.oren64 ought to be getting tired of karma fortunes by now.oren64 ought to be getting tired of karma fortunes by now.oren64 ought to be getting tired of karma fortunes by now.
 
oren64's Avatar
 
Posts: 4,033
Karma: 55233815
Join Date: Mar 2015
Location: Israel
Device: Kobo Glo
Quote:
Originally Posted by davidfor View Post
That looks pretty good. Could you post the template you are using? I might collect a few into one of the early posts in the thread as examples.

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}
oren64 is offline   Reply With Quote
Old 05-03-2016, 04:42 AM   #1122
anacreon
Guru
anacreon ought to be getting tired of karma fortunes by now.anacreon ought to be getting tired of karma fortunes by now.anacreon ought to be getting tired of karma fortunes by now.anacreon ought to be getting tired of karma fortunes by now.anacreon ought to be getting tired of karma fortunes by now.anacreon ought to be getting tired of karma fortunes by now.anacreon ought to be getting tired of karma fortunes by now.anacreon ought to be getting tired of karma fortunes by now.anacreon ought to be getting tired of karma fortunes by now.anacreon ought to be getting tired of karma fortunes by now.anacreon ought to be getting tired of karma fortunes by now.
 
anacreon's Avatar
 
Posts: 639
Karma: 778430
Join Date: May 2012
Location: France
Device: Glo HD, H2o2, One, Clara
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.
anacreon is offline   Reply With Quote
Old 05-03-2016, 06:23 AM   #1123
davidfor
Grand Sorcerer
davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.
 
Posts: 15,085
Karma: 24708566
Join Date: Jul 2011
Location: Sydney, Australia
Device: Kobo: Touch, Glo, Aura H2O, Glo HD, Aura ONE, Clara HD
Quote:
Originally Posted by anacreon View Post
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.
Um, yes, that's how it works. The functions in the plugin are separate from the driver. And its the point of the plugin. There are things that the driver can't do, or are out of scope for the driver. I do intend to add metadata updating to the driver, but it won't be as flexible as the plugin. It will be a straight update from the library metadata using a plugboard if you have one configured. This is what happens when you send a book to the device.

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.
davidfor is offline   Reply With Quote
Old 05-16-2016, 10:02 AM   #1124
davidfor
Grand Sorcerer
davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.davidfor ought to be getting tired of karma fortunes by now.
 
Posts: 15,085
Karma: 24708566
Join Date: Jul 2011
Location: Sydney, Australia
Device: Kobo: Touch, Glo, Aura H2O, Glo HD, Aura ONE, Clara HD
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.
davidfor is offline   Reply With Quote
Old 05-18-2016, 01:57 AM   #1125
DNSB
Bibliophagist
DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.DNSB ought to be getting tired of karma fortunes by now.
 
DNSB's Avatar
 
Posts: 4,934
Karma: 21680642
Join Date: Jul 2010
Location: Vancouver
Device: Kobo Aura One, Aura H2O, Aura HD, Nexus 7 HD, iPad Air, 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
Things that make you go hmmmm....
DNSB is offline   Reply With Quote
Reply

Tags
kobo

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
[GUI Plugin] EpubSplit JimmXinu Plugins 276 09-11-2018 07:04 PM
[GUI Plugin] KindleUnpack - The Plugin DiapDealer Plugins 412 04-24-2018 06:07 PM
[GUI Plugin] Hyphenate This! SauliusP. Plugins 326 03-27-2018 03:29 AM
[GUI Plugin] Wordpress frescogamba Plugins 11 04-06-2015 09:09 PM
[GUI Plugin] Plugin Updater **Deprecated** kiwidude Plugins 159 06-19-2011 12:27 PM


All times are GMT -4. The time now is 09:58 AM.


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