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 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: 46,234
Karma: 168983734
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 03-14-2025, 09:27 AM   #137
p@perm0nk
Junior Member
p@perm0nk began at the beginning.
 
Posts: 7
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 03-14-2025, 10:15 AM   #138
p@perm0nk
Junior Member
p@perm0nk began at the beginning.
 
Posts: 7
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 03-14-2025, 10:13 PM   #139
Majutsushi
Connoisseur
Majutsushi shines like a glazed doughnut.Majutsushi shines like a glazed doughnut.Majutsushi shines like a glazed doughnut.Majutsushi shines like a glazed doughnut.Majutsushi shines like a glazed doughnut.Majutsushi shines like a glazed doughnut.Majutsushi shines like a glazed doughnut.Majutsushi shines like a glazed doughnut.Majutsushi shines like a glazed doughnut.Majutsushi shines like a glazed doughnut.Majutsushi shines like a glazed doughnut.
 
Posts: 99
Karma: 8592
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 03-14-2025, 10:19 PM   #140
Majutsushi
Connoisseur
Majutsushi shines like a glazed doughnut.Majutsushi shines like a glazed doughnut.Majutsushi shines like a glazed doughnut.Majutsushi shines like a glazed doughnut.Majutsushi shines like a glazed doughnut.Majutsushi shines like a glazed doughnut.Majutsushi shines like a glazed doughnut.Majutsushi shines like a glazed doughnut.Majutsushi shines like a glazed doughnut.Majutsushi shines like a glazed doughnut.Majutsushi shines like a glazed doughnut.
 
Posts: 99
Karma: 8592
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 03-14-2025, 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: 46,234
Karma: 168983734
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 03-14-2025, 11:16 PM   #142
Majutsushi
Connoisseur
Majutsushi shines like a glazed doughnut.Majutsushi shines like a glazed doughnut.Majutsushi shines like a glazed doughnut.Majutsushi shines like a glazed doughnut.Majutsushi shines like a glazed doughnut.Majutsushi shines like a glazed doughnut.Majutsushi shines like a glazed doughnut.Majutsushi shines like a glazed doughnut.Majutsushi shines like a glazed doughnut.Majutsushi shines like a glazed doughnut.Majutsushi shines like a glazed doughnut.
 
Posts: 99
Karma: 8592
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 03-15-2025, 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: 46,234
Karma: 168983734
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
Old 03-15-2025, 09:00 PM   #144
Majutsushi
Connoisseur
Majutsushi shines like a glazed doughnut.Majutsushi shines like a glazed doughnut.Majutsushi shines like a glazed doughnut.Majutsushi shines like a glazed doughnut.Majutsushi shines like a glazed doughnut.Majutsushi shines like a glazed doughnut.Majutsushi shines like a glazed doughnut.Majutsushi shines like a glazed doughnut.Majutsushi shines like a glazed doughnut.Majutsushi shines like a glazed doughnut.Majutsushi shines like a glazed doughnut.
 
Posts: 99
Karma: 8592
Join Date: Aug 2023
Location: New Zealand
Device: Kobo Clara HD, Kobo Libra Colour
I'm not sure I follow. The "version_info = None" line sets a local variable in the plugin method, the "device_version_info()" method in the device driver doesn't know anything about it.

As far as I can tell from the exception and looking through the driver code a bit, the problem was that the eject() method in the driver set "self._device_version_info" and "self._main_prefix" to None when ejecting, and when the plugin called the device_version_info() method that method tried to reconstruct the version info, but because self._main_prefix was None it failed. The most recent change that fixed it removed the part that set self._device_version_info to None, so the device_version_info() method was able to return that without having to use the self._main_prefix variable.

This still seems a bit brittle to me, but I'm not sure the plugin can do anything about it. The right thing to do would be for the device_version_info() method in the driver to better handle the case where self._main_prefix is None.
Majutsushi is offline   Reply With Quote
Old 03-15-2025, 09:54 PM   #145
Majutsushi
Connoisseur
Majutsushi shines like a glazed doughnut.Majutsushi shines like a glazed doughnut.Majutsushi shines like a glazed doughnut.Majutsushi shines like a glazed doughnut.Majutsushi shines like a glazed doughnut.Majutsushi shines like a glazed doughnut.Majutsushi shines like a glazed doughnut.Majutsushi shines like a glazed doughnut.Majutsushi shines like a glazed doughnut.Majutsushi shines like a glazed doughnut.Majutsushi shines like a glazed doughnut.
 
Posts: 99
Karma: 8592
Join Date: Aug 2023
Location: New Zealand
Device: Kobo Clara HD, Kobo Libra Colour
So just to close this off, there isn't really any reason for the plugin to try to retrieve the device information in that specific code path anyway, so I've just changed it to not do that. This way the error shouldn't happen regardless of how the driver internals behave in this situation.
Majutsushi is offline   Reply With Quote
Old 03-16-2025, 12:31 AM   #146
Majutsushi
Connoisseur
Majutsushi shines like a glazed doughnut.Majutsushi shines like a glazed doughnut.Majutsushi shines like a glazed doughnut.Majutsushi shines like a glazed doughnut.Majutsushi shines like a glazed doughnut.Majutsushi shines like a glazed doughnut.Majutsushi shines like a glazed doughnut.Majutsushi shines like a glazed doughnut.Majutsushi shines like a glazed doughnut.Majutsushi shines like a glazed doughnut.Majutsushi shines like a glazed doughnut.
 
Posts: 99
Karma: 8592
Join Date: Aug 2023
Location: New Zealand
Device: Kobo Clara HD, Kobo Libra Colour
I've just released version 2.19.0.

The user-visible changes are:
  • Removed support for modifying home tiles as it is not supported in current firmware versions
  • Fixed an issue that prevented device rename and delete buttons from being enabled when only one device was registered
  • Fixed a potential exception when ejecting devices
Majutsushi is offline   Reply With Quote
Old 03-16-2025, 03:44 AM   #147
palaran
Member
palaran began at the beginning.
 
Posts: 11
Karma: 10
Join Date: Jul 2014
Device: Kobo Libra Colour
As an FYI, when I upgraded to 2.19.0 I get the following error;

calibre, version 7.26.0
ERROR: Unhandled exception: <b>AttributeError</b>:'KoboUtilitiesAction' object has no attribute 'epub_location_like_kepub'

calibre 7.26 embedded-python: True
Windows-10-10.0.26100-SP0 Windows ('64bit', 'WindowsPE')
('Windows', '10', '10.0.26100')
Python 3.11.5
Windows: ('10', '10.0.26100', 'SP0', 'Multiprocessor Free')
Interface language: None
EXE path: C:\Program Files\Calibre2\calibre.exe
Successfully initialized third party plugins: KePub Input (3, 6, 6) && KePub Metadata Reader (3, 4, 3) && KePub Metadata Writer (3, 4, 3) && KePub Output (3, 7, 3) && Kobo Utilities (2, 19, 0) && KoboTouchExtended (3, 7, 3)
Traceback (most recent call last):
File "calibre\gui2\__init__.py", line 806, in dispatch
File "calibre_plugins.koboutilities.action", line 2853, in _store_completed
File "calibre_plugins.koboutilities.action", line 3287, in _update_database_columns
AttributeError: 'KoboUtilitiesAction' object has no attribute 'epub_location_like_kepub'


Rolled back to 2.18.4 and works fine.
palaran is offline   Reply With Quote
Old 03-16-2025, 06:31 AM   #148
DrChiper
Bookish
DrChiper ought to be getting tired of karma fortunes by now.DrChiper ought to be getting tired of karma fortunes by now.DrChiper ought to be getting tired of karma fortunes by now.DrChiper ought to be getting tired of karma fortunes by now.DrChiper ought to be getting tired of karma fortunes by now.DrChiper ought to be getting tired of karma fortunes by now.DrChiper ought to be getting tired of karma fortunes by now.DrChiper ought to be getting tired of karma fortunes by now.DrChiper ought to be getting tired of karma fortunes by now.DrChiper ought to be getting tired of karma fortunes by now.DrChiper ought to be getting tired of karma fortunes by now.
 
DrChiper's Avatar
 
Posts: 1,017
Karma: 2003162
Join Date: Jun 2011
Device: PC, t1, t2, t3, Clara BW, Clara HD, Libra 2, Libra Color, Nxtpaper 11
Quote:
Originally Posted by palaran View Post
As an FYI, when I upgraded to 2.19.0 I get the following error;
What activities did you do to get that error?
I'm on calibre 7.24 and just upgraded the plugin to 2.190.0 and could add/remove and adjust reading status of any ebooks without errors.
I'm not using the Kobo Extended 3.7.3 plugin (disabled).

Last edited by DrChiper; 03-16-2025 at 06:42 AM.
DrChiper is offline   Reply With Quote
Old 03-16-2025, 07:39 AM   #149
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,447
Karma: 8012886
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
Quote:
Originally Posted by Majutsushi View Post
I've just released version 2.19.0.

The user-visible changes are:
  • Fixed an issue that prevented device rename and delete buttons from being enabled when only one device was registered
Off topic a bit, but ...

At some point when you have nothing else to do , changing the device matching from the UUID in the .driveinfo.calibre to the device serial number if the person is running a version of calibre that has the device_serial_no() method. Using the serial number will prevent losing track of the device if it is reset because the UUID will change but the serial number won't.
chaley is offline   Reply With Quote
Old 03-16-2025, 04:48 PM   #150
m.a.biglin
Member
m.a.biglin began at the beginning.
 
Posts: 17
Karma: 10
Join Date: May 2020
Device: Boyue Likebook Mars
All of a sudden I'm getting this error with kobo utilities. (libra 2 e-reader) It will no longer sync read positions.
I was playing with the kobo touch extended plugin, which i have since removed, if that could of caused this. If this isn't a utilities issue, I can post it where you suggest.


calibre, version 7.26.0
ERROR: Unhandled exception: <b>AttributeError</b>:'KoboUtilitiesAction' object has no attribute 'epub_location_like_kepub'

calibre 7.26 embedded-python: True
Windows-10-10.0.22631-SP0 Windows ('64bit', 'WindowsPE')
('Windows', '10', '10.0.22631')
Python 3.11.5
Windows: ('10', '10.0.22631', 'SP0', 'Multiprocessor Free')
Interface language: None
EXE path: C:\Program Files\Calibre2\calibre.exe
Successfully initialized third party plugins: Gather KFX-ZIP (from KFX Input) (2, 22, 0) && DeDRM (10, 0, 3) && Package KFX (from KFX Input) (2, 22, 0) && Barnes & Noble (1, 5, 6) && Goodreads (1, 8, 2) && KFX metadata reader (from KFX Input) (2, 22, 0) && From KFX (2, 22, 0) && KFX Input (2, 22, 0) && Set KFX metadata (from KFX Output) (2, 14, 0) && KFX Output (2, 14, 0) && Kobo Metadata (1, 10, 0) && Kobo Utilities (2, 19, 0)
Traceback (most recent call last):
File "calibre\gui2\__init__.py", line 806, in dispatch
File "calibre_plugins.koboutilities.action", line 2853, in _store_completed
File "calibre_plugins.koboutilities.action", line 3287, in _update_database_columns
AttributeError: 'KoboUtilitiesAction' object has no attribute 'epub_location_like_kepub'
m.a.biglin is offline   Reply With Quote
Reply


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 09:43 PM.


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