MobileRead Forums

MobileRead Forums (https://www.mobileread.com/forums/index.php)
-   Development (https://www.mobileread.com/forums/forumdisplay.php?f=240)
-   -   Problem with my ScrambleEbook plugin and the Plugin Updater tool (https://www.mobileread.com/forums/showthread.php?t=282781)

jackie_w 01-18-2017 05:10 PM

Problem with my ScrambleEbook plugin and the Plugin Updater tool
 
I need to make a small change to my ScrambleEbook plugin (to remove some calibre metadata from epub3 books). However, before I do I noticed that the Plugin Updater tool doesn't think it is currently installed - even though it is. It currently appears in the 'Not installed' list.

This problem has probably existed since initial release - there haven't been any updates so far. I could be wrong but I think the problem may be that the Plugin Updater thinks the plugin is called "Scramble Ebook" (with a space) but the code inside the plugin's __init__.py file has "name = 'ScrambleEbook'" (no space).

What is the best way to fix this so that when I release the updated version current users will see that there's an update?

Perhaps this post should be in the Plugins subforum but I wanted to make sure that it would be read by someone with the correct forum privileges.

Terisa de morgan 01-18-2017 05:30 PM

I would like the answer to this as well as my "CleanComments" plugin has a similar problem :(

kovidgoyal 01-18-2017 10:38 PM

I'm somewhat confused, if you look at https://plugins.calibre-ebook.com/ you will see that the plugins name is ScrambleEbook without the space. The calibre code to check for plugin updates uses that site to get the names, not MR. You can see in detail what goes on in calibre, by looking at the read_available_plugins() function and get_installed_status() function in plugin_updater.py

Stick a few print statements in there to see why your plugin is not being detected as installed.

jackie_w 01-19-2017 12:34 AM

It's too late tonight so I'll have to look at print statements tomorrow.

However, just in case I didn't explain myself well enough, my calibre installation has no problem installing, assigning to toolbar, running the plugin. It's just that after restarting calibre the master 'Plugin Updater' tool lists "Scramble Ebook" in its "not installed" filtered list and doesn't list "ScrambleEbook" at all.

I've checked my plugin code and I don't see any occurrences of "Scramble Ebook" (with space) at all, only "ScrambleEbook".

In addition, in case any are relevant:
  • the plugin zipfile in the config directory after installation is called ScrambleEbook.zip (no space).
  • It shows as "ScrambleEbook (0.0.4)" in the list Prefs - Plugins - User Interface Action plugins
  • I did notice that the MR "Index of Plugins" thread shows it as "Scramble Ebook" (with space)

kovidgoyal 01-19-2017 01:13 AM

This should take care of it

https://github.com/kovidgoyal/calibr...209add0f491274

jackie_w 01-19-2017 07:56 AM

Thank you. I'll post the update to the main plugin thread shortly.

Does this mean that only current users who upgrade past v2.77 will be able to see the update in the Plugin Updater?

Would editing the "Index of Plugins" to remove the space make the update visible to more current users?

kovidgoyal 01-19-2017 08:00 AM

Yes, editing the index of plugins to have the name match what is __init__.py will fix it for everyone, within an hour.

jackie_w 01-19-2017 08:25 AM

Quote:

Originally Posted by kovidgoyal (Post 3460807)
Yes, editing the index of plugins to have the name match what is __init__.py will fix it for everyone, within an hour.

OK, thanks. I've now added the update zip and changed the version history in the main plugin thread.

Please remind me whether I need to do anything else to make the auto-magic happen.

A secondary question ... I noticed that downloads in the main plugin thread showed as 21000+ but downloads shown on the https://plugins.calibre-ebook.com/ link were only about 10% of that. The number of "active" users posting scrambled books to MR is only a small fraction of either of those but I'd still like to understand the difference.

kovidgoyal 01-19-2017 08:28 AM

I have no idea where the number on MR comes from. The number on plugins.calibre-ebook.com is the number of times the zip file corresponding to that plugin was downloaded by calibre, regardless of version.

Someone has to update the Index of plugins thread to use ScrambleEbook as the plugin name. I cant do it at the momnet as I am on a cell phone, and trying to edit that enormaous post is impossible, so hopefully one of the other moderators will do it for you.

pdurrant 01-19-2017 09:05 AM

Quote:

Originally Posted by kovidgoyal (Post 3460807)
Yes, editing the index of plugins to have the name match what is __init__.py will fix it for everyone, within an hour.

Done.

Also updated version number and release date in that list.

jackie_w 01-19-2017 09:09 AM

Thank you pdurrant :)

BetterRed 01-19-2017 04:21 PM

Quote:

Originally Posted by Terisa de morgan (Post 3460499)
I would like the answer to this as well as my "CleanComments" plugin has a similar problem :(

@Terisa de Morgan - if you create a new version of your PI with a consistent value for 'name' in __init__.py, and the zip file (i.e.'CleanComments'), as per your GetFileName PI, then the MR thread name, and the index can be updated to reflect that name.

The inclusion of an '; Uninstall: NormComment' directive at the end of the MR Index entry should take care of replacing existing 'NormComment' installs, see the 'FanFicFare' and 'KindleUnpack - The Plugin' index entries at MR and calibre-ebook.com. I'll ask JimmXinu to chime in here and confirm this is correct.

BR

JimmXinu 01-19-2017 05:46 PM

Quote:

Originally Posted by BetterRed (Post 3460993)
...
The inclusion of an '; Uninstall: NormComment' directive at the end of the MR Index entry should take care of replacing existing 'NormComment' installs, see the 'FanFicFare' and 'KindleUnpack - The Plugin' index entries at MR and calibre-ebook.com. I'll ask JimmXinu to chime in here and confirm this is correct.

Unfortunately, I have very little wisdom to offer here.

When I replaced FanFictionDownLoader with FanFicFare, thducks posted suggesting that there was a Deprecated section that FanFictionDownLoader could be moved to and then helped do so.

A little later, there was discussion with eschwartz and thducks about adding an Uninstall flag for FFDL, which was eventually resolved.

To be honest, I didn't pay a huge amount of attention, since the index thread is outside my control. But what BR says appears to be correct: A plugin's entry in the index thread can tell calibre to uninstall a predecessor PI. But it has to be done juuust right. ;)

BetterRed 01-19-2017 09:56 PM

Thanks Jim

Maybe theducks and Kovid can add their wisdom.

BR

kovidgoyal 01-19-2017 11:49 PM

1) Make sure the MR index plugin name and the name you declare in __init__.py are exactly the same

2) If they are not currently exactly the same, simply change the name in the MR Index thread via a request to a moderator. There is no need to uninstall anything, the MR index name is only used by the plugin updater dialog not the rest of calibre -- so changing the index name should be all that is required to fix the problem

3) This problem will not occur in the future since I fixed the plugin updater to use the internal name instead of the MR name when checking for installed status.


All times are GMT -4. The time now is 08:35 PM.

Powered by: vBulletin
Copyright ©2000 - 3.8.5, Jelsoft Enterprises Ltd.
MobileRead.com is a privately owned, operated and funded community.