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 03-13-2025, 11:20 PM   #136
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: 43,304
Karma: 165170674
Join Date: Jul 2010
Location: Vancouver
Device: Kobo Sage, Libra Colour, Lenovo M8 FHD, Paperwhite 4, Tolino epos
I was tempted to do another edit but with 7.26.104 running from source, the error when ejecting a Kobo no longer occurs. Looking at the source for the Kobo driver.py file, it appears to be due to changes in the def device_version_info section now handling None properly.
DNSB is offline   Reply With Quote
Old Yesterday, 09:27 AM   #137
p@perm0nk
Junior Member
p@perm0nk began at the beginning.
 
Posts: 5
Karma: 10
Join Date: Mar 2025
Device: Kobo Clara BW
Quote:
Originally Posted by Majutsushi View Post
Time Spent Reading / Rest of Book Estimate formatting

If you want to show the "Time Spent Reading" and "Rest of Book Estimate" values in anything other than seconds, you will have to create two new columns that are based on the "seconds" columns and format the value differently.

Here is how you can do this:
  • Open the Calibre preferences.
  • Click on "Add your own columns".
  • Click on "Add custom column" or the green "+" sign on the right.
  • Enter a lookup name, like "#my_time_spent_reading".
  • Enter a column heading, like "Time Spent Reading".
  • For column type, choose "Column built from other columns".
  • Right-click in the "Template" entry field and click "Open template editor".
  • Enter the code to format the seconds to something else.

    Here is an example:
    Code:
    program:
    
    total = $#kobo_time_spent_reading;
    hours = floor(total/3600);
    minutes = round((total-hours*3600)/60);
    
    def format(v, str):
        if v == 0 then return '' fi;
        return v & ' ' & str & ' '
    fed;
    format(hours, 'hr') & format(minutes, 'min')
    This will format the time as something like "3 hr 27 min".

    Make sure to replace "#kobo_time_spent_reading" with the actual lookup name of the seconds column you want to reference.
  • Press "OK"/"Apply" to close all the dialogs and restart Calibre.
For more information about writing such a template check out https://manual.calibre-ebook.com/template_lang.html.
I have a stupid question. So, I created a custom column using this code and I have my Kobo Clara BW device connected. However, I cannot see any values for the books that I have finished reading. How are those values (total time spent reading a book) populated? Like automatically or do I need to do something else?
p@perm0nk is offline   Reply With Quote
Old Yesterday, 10:15 AM   #138
p@perm0nk
Junior Member
p@perm0nk began at the beginning.
 
Posts: 5
Karma: 10
Join Date: Mar 2025
Device: Kobo Clara BW
Quote:
Originally Posted by p@perm0nk View Post
I have a stupid question. So, I created a custom column using this code and I have my Kobo Clara BW device connected. However, I cannot see any values for the books that I have finished reading. How are those values (total time spent reading a book) populated? Like automatically or do I need to do something else?
Never mind. I found the answer from here: https://www.mobileread.com/forums/sh...9&postcount=28 and now I can see the stats )
p@perm0nk is offline   Reply With Quote
Old Yesterday, 10:13 PM   #139
Majutsushi
Connoisseur
Majutsushi got an A in P-Chem.Majutsushi got an A in P-Chem.Majutsushi got an A in P-Chem.Majutsushi got an A in P-Chem.Majutsushi got an A in P-Chem.Majutsushi got an A in P-Chem.Majutsushi got an A in P-Chem.Majutsushi got an A in P-Chem.Majutsushi got an A in P-Chem.Majutsushi got an A in P-Chem.Majutsushi got an A in P-Chem.
 
Posts: 50
Karma: 6306
Join Date: Aug 2023
Location: New Zealand
Device: Kobo Clara HD, Kobo Libra Colour
Quote:
Originally Posted by DNSB View Post
I was tempted to do another edit but with 7.26.104 running from source, the error when ejecting a Kobo no longer occurs. Looking at the source for the Kobo driver.py file, it appears to be due to changes in the def device_version_info section now handling None properly.
Thanks for the investigation. This does look like it was a bug in the driver, since the only thing the plugin is doing is calling a driver function. I'm glad it seems to be fixed now.

I have no idea about the garbage in the config file, please let me know if you find anything reproducible.
Majutsushi is offline   Reply With Quote
Old Yesterday, 10:19 PM   #140
Majutsushi
Connoisseur
Majutsushi got an A in P-Chem.Majutsushi got an A in P-Chem.Majutsushi got an A in P-Chem.Majutsushi got an A in P-Chem.Majutsushi got an A in P-Chem.Majutsushi got an A in P-Chem.Majutsushi got an A in P-Chem.Majutsushi got an A in P-Chem.Majutsushi got an A in P-Chem.Majutsushi got an A in P-Chem.Majutsushi got an A in P-Chem.
 
Posts: 50
Karma: 6306
Join Date: Aug 2023
Location: New Zealand
Device: Kobo Clara HD, Kobo Libra Colour
Quote:
Originally Posted by p@perm0nk View Post
Never mind. I found the answer from here: https://www.mobileread.com/forums/sh...9&postcount=28 and now I can see the stats )
Note that you can also set this to be done automatically by going to "Calibre Preferences" -> "Sending books to devices" and setting the metadata management to "Automatic management". I'll make a not to add this to the plugin docs.
Majutsushi is offline   Reply With Quote
Old Yesterday, 10:55 PM   #141
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: 43,304
Karma: 165170674
Join Date: Jul 2010
Location: Vancouver
Device: Kobo Sage, Libra Colour, Lenovo M8 FHD, Paperwhite 4, Tolino epos
Quote:
Originally Posted by Majutsushi View Post
Thanks for the investigation. This does look like it was a bug in the driver, since the only thing the plugin is doing is calling a driver function. I'm glad it seems to be fixed now.
The driver function was not happy with being passed a None in the version that errored. Earlier versions and the current version had code that did not allow None to pass through.

Quote:
Originally Posted by Majutsushi View Post
I have no idea about the garbage in the config file, please let me know if you find anything reproducible.
I reverted to the saved file with the garbage at the end and it seemed to make no difference to 7.26.104. So ghod alone knows when it was added. As to why it seems to work once when I rebuilt the config file? There are some answers the minds of mere mortals are not meant to know.
DNSB is offline   Reply With Quote
Old Yesterday, 11:16 PM   #142
Majutsushi
Connoisseur
Majutsushi got an A in P-Chem.Majutsushi got an A in P-Chem.Majutsushi got an A in P-Chem.Majutsushi got an A in P-Chem.Majutsushi got an A in P-Chem.Majutsushi got an A in P-Chem.Majutsushi got an A in P-Chem.Majutsushi got an A in P-Chem.Majutsushi got an A in P-Chem.Majutsushi got an A in P-Chem.Majutsushi got an A in P-Chem.
 
Posts: 50
Karma: 6306
Join Date: Aug 2023
Location: New Zealand
Device: Kobo Clara HD, Kobo Libra Colour
Quote:
Originally Posted by DNSB View Post
The driver function was not happy with being passed a None in the version that errored. Earlier versions and the current version had code that did not allow None to pass through.
The odd thing is that the plugin wasn't actually passing anything to the function, the function didn't take any parameters until the fix. So wherever the None came from it wasn't the plugin.
Majutsushi is offline   Reply With Quote
Old Today, 12:36 AM   #143
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: 43,304
Karma: 165170674
Join Date: Jul 2010
Location: Vancouver
Device: Kobo Sage, Libra Colour, Lenovo M8 FHD, Paperwhite 4, Tolino epos
Actually, the None did come from the plugin. I lifted the line numbers from the error message and at line 2665 in action.py, the following is seen:

Code:
version_info = None
device_version_info = device.device_version_info()
if device_version_info is not None:
version_info is set to None and then the device.version.info() in device.py is invoked. The first code block is for the older version that failed in 7.26.103, the second is the modified code in 7.26.104
Code:
    def device_version_info(self):
        debug_print('device_version_info - start')
        if not self._device_version_info:
            version_file = os.path.join(self._main_prefix, KOBO_ROOT_DIR_NAME, 'version')
Code:
    def device_version_info(self, reload: bool = False):
        debug_print('device_version_info - start')
        if self._device_version_info is None or reload:
            self._device_version_info = []
            version_file = os.path.join(self._main_prefix, KOBO_ROOT_DIR_NAME, 'version')
DNSB is offline   Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
[GUI Plugin] Kobo Utilities davidfor Plugins 3216 02-08-2025 04:23 AM
[GUI Plugin] Noosfere_util, a companion plugin to noosfere DB lrpirlet Plugins 2 08-18-2022 03:15 PM
[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


All times are GMT -4. The time now is 07:29 PM.


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