Re: Replacing one plugin with another
Paul Webster <Paul.Webster.a9poao-NUepA2SMhDQqspMVqqL2D+4xXEVPTSb/[email protected]>
| Newsgroups | gmane.music.equipment.slimdevices.devel |
|---|---|
| Organization | Logitech Squeezebox Forums |
| Message-ID | <[email protected]> |
I have the basis of something that works ....
in plugin Z (the new one) preinitPlugin
Code:
--------------------
my $targetPlugin = 'x'; # use the short form from 'Slim::Plugin::x::Plugin'
if ( Slim::Utils::PluginManager->isConfiguredEnabled($targetPlugin) ) {
Slim::Utils::PluginManager->disablePlugin($targetPlugin);
main::INFOLOG && $log->info("disabling $targetPlugin plugin because capability moved to $pluginNamePackage" );
}
--------------------
Needed to use isConfiguredEnabled rather than isEnabled because
isEnabled is really a check to see if the target plugin has loaded ...
which, in this case, it will not have done yet because we are still in
preinit phase.
This does result in plugin x being disabled - but if you go into the LMS
Settings/Plugins then LMS will want to download plugin x again ... so I
would also have to remove it from the list of available plugins (which
is OK for me because I would be withdrawing plugin x).
However, I need to put in extra check on plugin author (or some other
unique thing) so that I do not zap a future plugin by someone else that
happens to be called x.
Paul Webster
http://dabdig.blogspot.com
author of \"now playing\" plugins covering radio france (fip etc),
planetradio (bauer - kiss, absolute, scala, jazzfm etc), kcrw, supla
finland, abc australia, cbc/radio-canada and rte ireland
and, via the extra \"radio now playing\" plugin, allzic radio, caroline
flashback, cesky rozhlas, frequence3, jukeradio, klassikradio.de, linn
radio, mother earth, naim radio, nova.fr, radioblues flac, radio espace,
somehow jazz
------------------------------------------------------------------------
Paul Webster's Profile: http://forums.slimdevices.com/member.php?userid=105
View this thread: http://forums.slimdevices.com/showthread.php?t=115282