Req: wrapper plugin for plugins which return values after own unloading and reloading

Discuss and announce Total Commander plugins, addons and other useful tools here, both their usage and their development.

Moderators: white, Hacker, petermad, Stefan2

Post Reply
User avatar
DrShark
Power Member
Power Member
Posts: 1872
Joined: 2006-11-03, 22:26 UTC
Location: Kyiv, 68/262
Contact:

Req: wrapper plugin for plugins which return values after own unloading and reloading

Post by *DrShark »

Some plugins it seems only return some or all values in custom columns or tooltips after execution of cm_UnloadPlugins command. There is no way for user to execute cm_UnloadPlugins during a search in internal Find Filles tool (cm_SearchFor) and some other Total Commander functions where content plugins are used.

This issue for one of such plugins, RarInfo, is described in a forum topic:
ghisler.ch/board/viewtopic.php?f=35&t=75187 (moved to ghisler.ch/board/viewtopic.php?p=404783#p404783)

Christian Ghisler checked what is happening in this particular situation:
Christian Ghisler (by email) wrote:... the rarinfo plugin [...] only seems to work all the time when calling ContentGetValue with flag CONTENT_DELAYIFSLOW in the foreground, and if the plugin returns ft_delayed, then call the same function again from a background thread without CONTENT_DELAYIFSLOW.
However, in some places of Total Commander is communicates with wdx plugins without CONTENT_DELAYIFSLOW at all,
for example, in Find Files and Multi-Rename Tool (during rename operation) TC uses following approach:
Christian Ghisler (by email) wrote:1. Call ContentGetValue without the flag CONTENT_DELAYIFSLOW
2. If the plugin returns the value, rename / search, and continue with next file
But to make RarInfo work in Find Filesn and MRT, it would have to do following:
Christian Ghisler (by email) wrote:1. Call ContentGetValue with flag CONTENT_DELAYIFSLOW
2. If the plugin returns the value, rename / search, and continue with next file
3. If the plugin returns ft_delayed, do the following
4. Create a background thread
5. Call ContentGetValue without flag CONTENT_DELAYIFSLOW from that background thread
6. Wait in foreground thread until ContentGetValue returns in thebackground thread
7. Rename/search in the file
This change is too complex to implement in TC, with the reason just to make some plugins work.

But Christian Ghisler mentioned that in theory it would be possible to implement a wrapper plugin for plugins as RarInfo.

The wrapper plugin can itself communicate with plugins like rarinfo with this complex way, maybe simplified a bit since wrapper only deals with buggy plugin and will anyway have to use following for it:
1. Call ContentGetValue with flag CONTENT_DELAYIFSLOW
2. Create a background thread
3. Call ContentGetValue without flag CONTENT_DELAYIFSLOW from that background thread
4. Wait in foreground thread until ContentGetValue returns in the
background thread
5. If the plugin returns the value, transfer it to Total Commander.

Maybe optionally the wrapper plugin could even unload the wdx with which it communicates after step 5 and reload again to retrieve the value of next file, if only this can make buggy plugin to return correct value.

Though there is no 100% guarantee that this will work:
Christian Ghisler (by email) wrote:[t]here is no guarantee that RarInfo will work correctly when using CONTENT_DELAYIFSLOW for each call first - it may have other limitations like checking what thread ID is used for the background thread to detect the main window background handler etc.
but if it will, Total Commander would then have to communicate only just with wrapper plugin in the same way like all other wdx plugins.

So I'm asking developers here to write such a wrapper. It can be helpful not only for rarinfo plugin (which would be quite useful for if it would work in TC) - in above topic with bugreport I also mentioned a similar issue of old eml_info plugin, and there may be other plugins which would work in TC only with help of such a wrapper.
Donate for Ukraine to help stop Russian invasion!
Ukraine's National Bank special bank account:
UA843000010000000047330992708
Post Reply