home
products
contribute
download
documentation
forum
Home
Forums
New posts
Search forums
What's new
New posts
All posts
Latest activity
Members
Registered members
Current visitors
Donate
Log in
Register
What's new
Search
Search
Search titles only
By:
New posts
Search forums
Search titles only
By:
Menu
Log in
Register
Navigation
Install the app
Install
More options
Contact us
Close Menu
Forums
MediaPortal 2
Plugin Development
Registering a new Aspect from a Plugin failing
Contact us
RSS
JavaScript is disabled. For a better experience, please enable JavaScript in your browser before proceeding.
You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an
alternative browser
.
Reply to thread
Message
<blockquote data-quote="MJGraf" data-source="post: 935679" data-attributes="member: 17886"><p>Makes absolute sense!</p><p> </p><p>But to be honest, I still didn't understand the difference between registering something via plugin.xml an registering the same thing with a call within Plugin.Activated. Let's take registering a service:</p><p> </p><p>Morpheus registers his FanArtService in FanArtServicePlugin.Activated with a call to ServiceRegistration.Set<IFanArtService>(new FanArtService());</p><p>There's nothing in plugin.xml regarding the service.</p><p> </p><p>On the other hand, the SeriesTVDbMatcher and the MovieTheMovieDbMatcher in the OnlineLibraries are registered only via plugin.xml.</p><p> </p><p>The reason for the first example may be that after registering the service, he adds the respective service implementation to the Backend UPNP device and wants to make sure that this happens after the service is registered with the service registration. On the other hand, the reason for the second example could be as easy as there is no PluginStateTracker for the OnlineLibraries - hence to Activated method.</p><p> </p><p>As to your question re startup order:</p><p> </p><p>ApplicationLauncher first activates the plugins and thereby starts all services provided by plugins.</p><p>Then it starts ApplicationCore.StartCoreServices();</p><p>Then we start BackendExtension.StartupBackendServices();</p><p>And after that the DefaultMediaItemAspectTypes are registered.</p><p> </p><p>The UPNP subsytem is the UPNPBackendServer, which is contained in MediaPortal.Backend.Services.BackendServer. This is therefore started as "BackendService", which is according to the above before the Default MIAs are registered. I'm therefore not sure whether it would be necessary at all to register your aspect before the UPNPBackendServer ist running. The default MIAs are registered after that as well...</p><p> </p><p>And to be honest, I'm also not sure whether it is necessary to register your aspect before the ImportWorker starts. At least there should be as message informing all interested services that the registered MIAs have changed. But I'm quite sure that this doesn't work (yet), because there seems to be a bug with the message. Maybe @<a href="https://forum.team-mediaportal.com/members/morpheus_xx.48495/" target="_blank">morpheus_xx</a> can check this:</p><p> </p><p>In the ContentDirectoryMessaging class (which is called by MediaLibrary.AddMediaItemAspectStorage) I found:</p><p> public static void SendPlaylistsChangedMessage()</p><p> {</p><p> SystemMessage msg = new SystemMessage(MessageType.PlaylistsChanged);</p><p> ServiceRegistration.Get<IMessageBroker>().Send(CHANNEL, msg);</p><p> }</p><p> public static void <u><strong>SendMIATypesChangedMessage</strong></u>()</p><p> {</p><p> SystemMessage msg = new SystemMessage(MessageType.<u><strong>PlaylistsChanged</strong></u>);</p><p> ServiceRegistration.Get<IMessageBroker>().Send(CHANNEL, msg);</p><p> }</p><p> </p><p>In my understanding this is a copy and paste bug - in the second method this should be:</p><p>SystemMessage msg = new SystemMessage(MessageType.<u><strong>MIATypesChanged</strong></u>);</p><p> </p><p>At least UPnPContentDirectoryServiceImpl checks for this message and it looks like it never received one... <img src="data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7" class="smilie smilie--sprite smilie--sprite8" alt=":D" title="Big Grin :D" loading="lazy" data-shortname=":D" /></p><p>In the ImportWorker, however, I couldn't find anything listening to that message.</p><p> </p><p>This whole thing indeed brings me to the conclusion that it may be much easier for plugin programmers if they did not have to take care about all this when they register new MIAs - therefore at first glance I would prefer the plugin.xml solution. But this again requires the PluginRuntime to be extended for automatically registering MIAs - and I have no clue how to do that...</p><p> </p><p>Michael</p></blockquote><p></p>
[QUOTE="MJGraf, post: 935679, member: 17886"] Makes absolute sense! But to be honest, I still didn't understand the difference between registering something via plugin.xml an registering the same thing with a call within Plugin.Activated. Let's take registering a service: Morpheus registers his FanArtService in FanArtServicePlugin.Activated with a call to ServiceRegistration.Set<IFanArtService>(new FanArtService()); There's nothing in plugin.xml regarding the service. On the other hand, the SeriesTVDbMatcher and the MovieTheMovieDbMatcher in the OnlineLibraries are registered only via plugin.xml. The reason for the first example may be that after registering the service, he adds the respective service implementation to the Backend UPNP device and wants to make sure that this happens after the service is registered with the service registration. On the other hand, the reason for the second example could be as easy as there is no PluginStateTracker for the OnlineLibraries - hence to Activated method. As to your question re startup order: ApplicationLauncher first activates the plugins and thereby starts all services provided by plugins. Then it starts ApplicationCore.StartCoreServices(); Then we start BackendExtension.StartupBackendServices(); And after that the DefaultMediaItemAspectTypes are registered. The UPNP subsytem is the UPNPBackendServer, which is contained in MediaPortal.Backend.Services.BackendServer. This is therefore started as "BackendService", which is according to the above before the Default MIAs are registered. I'm therefore not sure whether it would be necessary at all to register your aspect before the UPNPBackendServer ist running. The default MIAs are registered after that as well... And to be honest, I'm also not sure whether it is necessary to register your aspect before the ImportWorker starts. At least there should be as message informing all interested services that the registered MIAs have changed. But I'm quite sure that this doesn't work (yet), because there seems to be a bug with the message. Maybe @[URL='https://forum.team-mediaportal.com/members/morpheus_xx.48495/']morpheus_xx[/URL] can check this: In the ContentDirectoryMessaging class (which is called by MediaLibrary.AddMediaItemAspectStorage) I found: public static void SendPlaylistsChangedMessage() { SystemMessage msg = new SystemMessage(MessageType.PlaylistsChanged); ServiceRegistration.Get<IMessageBroker>().Send(CHANNEL, msg); } public static void [U][B]SendMIATypesChangedMessage[/B][/U]() { SystemMessage msg = new SystemMessage(MessageType.[U][B]PlaylistsChanged[/B][/U]); ServiceRegistration.Get<IMessageBroker>().Send(CHANNEL, msg); } In my understanding this is a copy and paste bug - in the second method this should be: SystemMessage msg = new SystemMessage(MessageType.[U][B]MIATypesChanged[/B][/U]); At least UPnPContentDirectoryServiceImpl checks for this message and it looks like it never received one... :D In the ImportWorker, however, I couldn't find anything listening to that message. This whole thing indeed brings me to the conclusion that it may be much easier for plugin programmers if they did not have to take care about all this when they register new MIAs - therefore at first glance I would prefer the plugin.xml solution. But this again requires the PluginRuntime to be extended for automatically registering MIAs - and I have no clue how to do that... Michael [/QUOTE]
Insert quotes…
Verification
Post reply
Forums
MediaPortal 2
Plugin Development
Registering a new Aspect from a Plugin failing
Contact us
RSS
Top
Bottom