Posts: 28
Joined: Dec 2011
Reputation:
0
void0
Junior Member
Posts: 28
2014-01-10, 21:57
(This post was last modified: 2014-01-10, 21:58 by void0.)
My plugin should be visible both under audio, video and picture categories.
In addon.xml I have these settings:
<extension point="xbmc.python.pluginsource" library="addon.py">
<provides>video audio image</provides>
</extension>
The problem is that I don't know how to fire different scripts for different categories. There might be some code in addon.py to detect from what category it has been called and then run either audio, video or image scripts, but I don't know how to detect from what category it has been called.
Posts: 793
Joined: Oct 2010
Reputation:
17
IIRC, you can use the infolabel Container.PluginCategory to see what category your addon was launched from
Posts: 1,355
Joined: Oct 2008
Reputation:
66
You should find the 'content_type' parameter if the plugin is launched from one of the main add-on directories.
Posts: 28
Joined: Dec 2011
Reputation:
0
void0
Junior Member
Posts: 28
Hmm... do you have code examples?
Posts: 1,355
Joined: Oct 2008
Reputation:
66
Plugin parameters are in sys.argv[2] it's up to you how to parse them, if you add a print statement, e.g. 'print sys.argv[2]', you should see it in the log.
Posts: 28
Joined: Dec 2011
Reputation:
0
void0
Junior Member
Posts: 28
Aren't they empty when script just fired up?
Posts: 28
Joined: Dec 2011
Reputation:
0
void0
Junior Member
Posts: 28
How to get content? Do you have an example? When I just start plugin sys.argv[2] is empty, how then I would know that plugin has been started from e.g. video and not audio?
Posts: 1,299
Joined: Jul 2009
Reputation:
59
sphere
Retired Team-Kodi Member
Posts: 1,299
Again (and last time):
If you have multiple providing media entries in your addon.xml AND you are starting your plugin from either the music-plugins or the picture-plugins or the video-plugins window, you will have content_type in sys.argv[2].
You are asking us for code samples but you are the one with who should upload the code.
Posts: 1,355
Joined: Oct 2008
Reputation:
66
Also I think* this requires XBMC version >= 12.0.
Posts: 28
Joined: Dec 2011
Reputation:
0
void0
Junior Member
Posts: 28
I am on 11.0, that looks like a reason why it didn't work