Register Guidelines E-Books Today's Posts Search

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

Notices

Reply
 
Thread Tools Search this Thread
Old 04-19-2022, 02:58 PM   #2716
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,450
Karma: 8012886
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
Quote:
Originally Posted by Terisa de morgan View Post
Just out of curiosity, which values will be used for updating these fields? Custom columns? So, a nice relationship with CountPages?
Quote:
Originally Posted by ownedbycats View Post
Interestingly, I was considering dropping the word count column as I found it less useful than page and chapter counts. But now I have a reason to keep it.
@davidfor is implementing all of these with templates not column keys, giving you the choice of returning the value of a column or calculating something. If so then you can produce a word count "pages * something" where "something" is some average words per page. Isn't as accurate but it lets you get rid of the column.

[OPINION]I think his choice to move to templates for things is inspired. It doesn't take away any functionality, but adds many possibilities. Of course some basic "recipes" will need to be provided, specifically how to return a column value ("{column_key}"), but that isn't hard.[/OPINION]
Attached Thumbnails
Click image for larger version

Name:	Clipboard02.jpg
Views:	398
Size:	83.7 KB
ID:	193346  

Last edited by chaley; 04-19-2022 at 03:05 PM. Reason: Added OPINION
chaley is offline   Reply With Quote
Old 04-19-2022, 03:38 PM   #2717
JSWolf
Resident Curmudgeon
JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.
 
JSWolf's Avatar
 
Posts: 79,796
Karma: 146391129
Join Date: Nov 2006
Location: Roslindale, Massachusetts
Device: Kobo Libra 2, Kobo Aura H2O, PRS-650, PRS-T1, nook STR, PW3
Quote:
Originally Posted by chaley View Post
@davidfor is implementing all of these with templates not column keys, giving you the choice of returning the value of a column or calculating something. If so then you can produce a word count "pages * something" where "something" is some average words per page. Isn't as accurate but it lets you get rid of the column.

[OPINION]I think his choice to move to templates for things is inspired. It doesn't take away any functionality, but adds many possibilities. Of course some basic "recipes" will need to be provided, specifically how to return a column value ("{column_key}"), but that isn't hard.[/OPINION]
Can we get the formula that Kobo uses for time to read added in as a default?
JSWolf is offline   Reply With Quote
Old 04-19-2022, 03:41 PM   #2718
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,450
Karma: 8012886
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
Quote:
Originally Posted by JSWolf View Post
Can we get the formula that Kobo uses for time to read added in as a default?
Perhaps, if you figure out what the formula is and where it gets the input numbers.
chaley is offline   Reply With Quote
Old 04-19-2022, 04:12 PM   #2719
ownedbycats
Custom User Title
ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.
 
ownedbycats's Avatar
 
Posts: 11,025
Karma: 75555555
Join Date: Oct 2018
Location: Canada
Device: Kobo Libra H2O, formerly Aura HD
If Kobo adjusts the speed from the user's activity—I don't quite remember if this is done—it might not even be a 'default.'
ownedbycats is online now   Reply With Quote
Old 04-19-2022, 04:19 PM   #2720
JSWolf
Resident Curmudgeon
JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.JSWolf ought to be getting tired of karma fortunes by now.
 
JSWolf's Avatar
 
Posts: 79,796
Karma: 146391129
Join Date: Nov 2006
Location: Roslindale, Massachusetts
Device: Kobo Libra 2, Kobo Aura H2O, PRS-650, PRS-T1, nook STR, PW3
Quote:
Originally Posted by chaley View Post
Perhaps, if you figure out what the formula is and where it gets the input numbers.
Here is the post where I saw the formula.

Quote:
Originally Posted by geek1011 View Post
BTW, the algorithm kobo.com uses for calculating the read time range is:

Code:
HoursMax = round(WordCount / 200 / 60)
HoursMin = HoursMax - 1
if (HoursMax >= 10) {
        HoursMax += round((HoursMax + .5) / 10) - 1)
}
The word count and page number are from https://kobostats.azurewebsites.net/bookstats/{ISBN}. The word count seems to exclude front/back matter (but it includes tables and code blocks) (I'll try to figure out the details of this later), and the page count seems to have a linear relationship with the word count. Based on the data from a few hundred books, it seems to be the floor of the word count divided by 272 (this is perfect for nearly all of the books, and ~20-40 pages too large for some older ones, which makes me think they were either calculated differently at that time or manually overridden).

___

The device (i.e., storeapi) seems to use the same algorithm, except that the max hour adjustment is floored instead of rounded (is this a bug?):

Code:
HoursMax = round(WordCount / 200 / 60)
HoursMin = HoursMax - 1
if (HoursMax >= 10) {
        HoursMax += floor((HoursMax + .5) / 10) - 1)
}
Also note that the on-device KEPUB word counter (i.e., HtmlUtility::countWords) counts differently than the Kobo Store.
JSWolf is offline   Reply With Quote
Old 04-19-2022, 04:29 PM   #2721
ownedbycats
Custom User Title
ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.ownedbycats ought to be getting tired of karma fortunes by now.
 
ownedbycats's Avatar
 
Posts: 11,025
Karma: 75555555
Join Date: Oct 2018
Location: Canada
Device: Kobo Libra H2O, formerly Aura HD
Ah, i missed (or forgot—brain's not good today) that post. That looks easy enough to turn into template.
ownedbycats is online now   Reply With Quote
Old 04-19-2022, 05:48 PM   #2722
fogice
Addict
fogice possesses cleverness exceeding the boundaries of Space and Timefogice possesses cleverness exceeding the boundaries of Space and Timefogice possesses cleverness exceeding the boundaries of Space and Timefogice possesses cleverness exceeding the boundaries of Space and Timefogice possesses cleverness exceeding the boundaries of Space and Timefogice possesses cleverness exceeding the boundaries of Space and Timefogice possesses cleverness exceeding the boundaries of Space and Timefogice possesses cleverness exceeding the boundaries of Space and Timefogice possesses cleverness exceeding the boundaries of Space and Timefogice possesses cleverness exceeding the boundaries of Space and Timefogice possesses cleverness exceeding the boundaries of Space and Time
 
Posts: 258
Karma: 49504
Join Date: May 2014
Device: Kobo Libra 2
I'm testing the new beta, and I've crashed it twice. The first two transfers were fine (1 book, a handful of books), then crashed at (100 books, 20 books). I have attached the logs from Calibre, as well as the crash reports generated by MacOS. I'm back to only transferring 8 books at a time, which is working so far.

If there's anything more you would like me to test, let me know.
Attached Files
File Type: zip fogice.zip (1.11 MB, 250 views)
fogice is online now   Reply With Quote
Old 04-19-2022, 10:13 PM   #2723
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: 24,905
Karma: 47303824
Join Date: Jul 2011
Location: Sydney, Australia
Device: Kobo:Touch,Glo, AuraH2O, GloHD,AuraONE, ClaraHD, Libra H2O; tolinoepos
Quote:
Originally Posted by chaley View Post
@davidfor is implementing all of these with templates not column keys, giving you the choice of returning the value of a column or calculating something. If so then you can produce a word count "pages * something" where "something" is some average words per page. Isn't as accurate but it lets you get rid of the column.

[OPINION]I think his choice to move to templates for things is inspired. It doesn't take away any functionality, but adds many possibilities. Of course some basic "recipes" will need to be provided, specifically how to return a column value ("{column_key}"), but that isn't hard.[/OPINION]
I don't know about "inspired", but, the choice was a template or some way to specify a column name. Using a template just seemed to be the best for flexibility. And any amusement I get from @ownedbycats attempts to break the template system are just a bonus.

When I announced this in the firmware thread, I put what I was using. Though they were program mode rather than the simpler that you have used.

@JSWolf: No, I will not be adding anything as defaults. Anything is dependent on the column names people use. Not everyone just uses "#pages". And the calculations for the reading times that Kobo supplies are far to simple to bother with, especially as the range is just 1 hour. And I am surprised that you are suggesting using these as you have been critical of the reading estimates that Kobo uses on the device.
davidfor is offline   Reply With Quote
Old 04-20-2022, 05:28 AM   #2724
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,450
Karma: 8012886
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
Quote:
Originally Posted by fogice View Post
I'm testing the new beta, and I've crashed it twice. The first two transfers were fine (1 book, a handful of books), then crashed at (100 books, 20 books). I have attached the logs from Calibre, as well as the crash reports generated by MacOS. I'm back to only transferring 8 books at a time, which is working so far.

If there's anything more you would like me to test, let me know.
I looked at the crash reports. In both cases it crashed in libxml2 with a SEGV. That raises the question: are lxml and libxml2 thread safe? This document says libxml2 is but with caveats. I don't know what versions are being used nor can I determine if xmlInitParser() is called as directed.

I also noticed that both crashes happened when serializing the tree for output. Some notes:
  • This happens when container.flush_cache() is called. flush_cache() is called from within a thread pool worker. That means that one thread pool is creating a second thread pool. I can easily imagine that this isn't a good thing.
  • Because multiple threads can call flush_cache(), more than one thread can call commit_item() on the same tree. Does this write the file twice?
  • Because multiple threads can call flush_cache on the same dirtied set, trees can be committed at the same time. I don't know what happens if the two threads attempt to write the same file.
Two suggestions:
  • Change flush_cache() to do the work directly without creating threads. This avoids nesting thread pools.
  • Put generating the set of dirtied trees and calling commit_item() into a locked with. This avoids possibly committing the same item more than once at the same time.
Something like this:
Code:
# This goes in __init__
        super(KEPubContainer, self).__init__(epub_path, log, *args, **kwargs)
        self.flush_lock = threading.Lock() # New code
        self.log = log
        self.log.debug(f"Creating KePub Container for ePub at {epub_path}")

# This replaces flush_cache()
    def flush_cache(self) -> None:
        with self.flush_lock.acquire():
            for name in list(self.dirtied):
                self.commit_item(name, keep_parsed=True)

#    def __flush_cache_impl(self, name: str) -> None:
#       """Flush the cache, writing all cached values to disk."""
#       self.commit_item(name, keep_parsed=True)
EDIT: Looking further in the code in calibre, it seems to me that committing all the dirty items while threads are running is very dangerous. The calibre ebook container frequently sets an item as dirty before doing its work. Some other thread could then attempt to commit changes that are concurrently being made.

Personally, I would choose either
  • to remove the threading, or
  • ensure that:
    • no threaded item calls flush_cache()
    • the thread controller (__run_async()) runs all the threads, then after the "with" exits calls flush_cache().
The goal is to guarantee that no thread can affect the processing of another thread via the dirty settings.

My first choice would be to remove the threading to see if the problems go away. If they do then look at how threading can be put back safely. If they don't then back to the drawing board.

[EDIT 2]@davidfor: see the PM I sent you.

Last edited by chaley; 04-21-2022 at 10:31 AM. Reason: 1) Made the for loop use a copy of self.dirtied to avoid set changed size errors 2) added the EDIT section
chaley is offline   Reply With Quote
Old 04-21-2022, 10:29 AM   #2725
fogice
Addict
fogice possesses cleverness exceeding the boundaries of Space and Timefogice possesses cleverness exceeding the boundaries of Space and Timefogice possesses cleverness exceeding the boundaries of Space and Timefogice possesses cleverness exceeding the boundaries of Space and Timefogice possesses cleverness exceeding the boundaries of Space and Timefogice possesses cleverness exceeding the boundaries of Space and Timefogice possesses cleverness exceeding the boundaries of Space and Timefogice possesses cleverness exceeding the boundaries of Space and Timefogice possesses cleverness exceeding the boundaries of Space and Timefogice possesses cleverness exceeding the boundaries of Space and Timefogice possesses cleverness exceeding the boundaries of Space and Time
 
Posts: 258
Karma: 49504
Join Date: May 2014
Device: Kobo Libra 2
Chaley, thanks so much for researching my issue!
fogice is online now   Reply With Quote
Old 04-21-2022, 12:33 PM   #2726
BiliBug
Connoisseur
BiliBug ought to be getting tired of karma fortunes by now.BiliBug ought to be getting tired of karma fortunes by now.BiliBug ought to be getting tired of karma fortunes by now.BiliBug ought to be getting tired of karma fortunes by now.BiliBug ought to be getting tired of karma fortunes by now.BiliBug ought to be getting tired of karma fortunes by now.BiliBug ought to be getting tired of karma fortunes by now.BiliBug ought to be getting tired of karma fortunes by now.BiliBug ought to be getting tired of karma fortunes by now.BiliBug ought to be getting tired of karma fortunes by now.BiliBug ought to be getting tired of karma fortunes by now.
 
Posts: 96
Karma: 374269
Join Date: Nov 2012
Location: Stockton, NJ
Device: Kobo Sage (Formerly KKB, PW1, PW3, KV, OA3)
I installed the new beta version (3.5.7), have the Count Pages plugin working correctly with custom columns, but I don't see the options in the Kobo Extended Driver configuration to sync these fields, as per post 2717. Any ideas? Calibre version is 5.40, running on macOS 12.4.
BiliBug is offline   Reply With Quote
Old 04-21-2022, 12:44 PM   #2727
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,450
Karma: 8012886
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
Quote:
Originally Posted by BiliBug View Post
I installed the new beta version (3.5.7), have the Count Pages plugin working correctly with custom columns, but I don't see the options in the Kobo Extended Driver configuration to sync these fields, as per post 2717. Any ideas? Calibre version is 5.40, running on macOS 12.4.
Those changes will be in the next calibre release. I see them because I always run from up to date source.

Last edited by chaley; 04-21-2022 at 01:01 PM.
chaley is offline   Reply With Quote
Old 04-21-2022, 12:47 PM   #2728
BiliBug
Connoisseur
BiliBug ought to be getting tired of karma fortunes by now.BiliBug ought to be getting tired of karma fortunes by now.BiliBug ought to be getting tired of karma fortunes by now.BiliBug ought to be getting tired of karma fortunes by now.BiliBug ought to be getting tired of karma fortunes by now.BiliBug ought to be getting tired of karma fortunes by now.BiliBug ought to be getting tired of karma fortunes by now.BiliBug ought to be getting tired of karma fortunes by now.BiliBug ought to be getting tired of karma fortunes by now.BiliBug ought to be getting tired of karma fortunes by now.BiliBug ought to be getting tired of karma fortunes by now.
 
Posts: 96
Karma: 374269
Join Date: Nov 2012
Location: Stockton, NJ
Device: Kobo Sage (Formerly KKB, PW1, PW3, KV, OA3)
Quote:
Originally Posted by chaley View Post
Those changes will be in the next calibre release. I see them because I always fun from up to date source.
Ah. Got it. Thanks!
BiliBug is offline   Reply With Quote
Old 04-21-2022, 04:52 PM   #2729
fogice
Addict
fogice possesses cleverness exceeding the boundaries of Space and Timefogice possesses cleverness exceeding the boundaries of Space and Timefogice possesses cleverness exceeding the boundaries of Space and Timefogice possesses cleverness exceeding the boundaries of Space and Timefogice possesses cleverness exceeding the boundaries of Space and Timefogice possesses cleverness exceeding the boundaries of Space and Timefogice possesses cleverness exceeding the boundaries of Space and Timefogice possesses cleverness exceeding the boundaries of Space and Timefogice possesses cleverness exceeding the boundaries of Space and Timefogice possesses cleverness exceeding the boundaries of Space and Timefogice possesses cleverness exceeding the boundaries of Space and Time
 
Posts: 258
Karma: 49504
Join Date: May 2014
Device: Kobo Libra 2
On the positive side, I've checked about 30 books, and I don't see any missing chapters in them. Previously, about 1/3 of my books were showing missing chapters.
fogice is online now   Reply With Quote
Old 04-22-2022, 03:41 AM   #2730
giddie
Member
giddie began at the beginning.
 
giddie's Avatar
 
Posts: 19
Karma: 10
Join Date: Jan 2017
Location: Birmingham, UK
Device: Kobo Aura H2O
Quote:
Originally Posted by davidfor View Post
I don't know about "inspired", but, the choice was a template or some way to specify a column name. Using a template just seemed to be the best for flexibility. And any amusement I get from @ownedbycats attempts to break the template system are just a bonus.
I'm excited about the added flexibility here. Any chance you could apply the same approach to collection management to address the issues raised the post linked below?

https://www.mobileread.com/forums/sh...postcount=2678
giddie is offline   Reply With Quote
Reply

Tags
error, kobo aura one


Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Kobo Device Driver Update davidfor Devices 284 05-24-2019 05:24 PM
[Device Plugin] Kindle 2, 3, 4, Touch Device Interface MBP Update Mod cryzed Plugins 7 10-28-2012 04:58 PM
[Device Interface Plugin] Update for Nook Color Driver jmricker Plugins 0 10-22-2011 10:11 AM
Touch Kobo Touch Extended 2 Year Warranty - Is it worth the $34.99? EverC Kobo Reader 11 08-31-2011 11:47 PM
Touch Kobo Touch Extended Warranty Program SensualPoet Kobo Reader 1 07-17-2011 04:08 AM


All times are GMT -4. The time now is 04:46 PM.


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