Selecting correct addon type
#1
I am trying to decipher what type my addon shoud be (what <extension>s it should have).

It is supposed to provide different type of information to my skin, both lists and single items. It is NOT going to provide any type of media, ie. the lists are going to contain items that do NOT represent media files (but information like available genres for the currently selected library node).

So, in order to be able to generate lists, I need to have <extension> of xbmc.python.pluginsource - to be able to acquire addon handle required to create lists: library= file should be called as plugin://script.module.stiff?param=value from <contents>.

In order to generate single items, I need to have <extension> of xbmc.python.library - and this can be another library= file, that should be called like $ADDON[script.module.stiff arg1 arg2]

Kodi automagically selects correct the right <extension library='file'> depending on context.

It this rightHuh
Reply
#2
You want just pluginsource.

The abstraction is a virtual filesystem. The plugin can return directories (calls to itself with particular parameters), playable files or just files which is the hook to do 'stuff' which does not generate a new listing, such as show a dialog, search etc.

If this abstraction is not appripriate, you want to do a script instead. This is a fullblown window, with full customization of the gui components and such. More work.

the library extension point is for code shared between multiple pluginsources and/or scripts. It is not related to the media library interpretation of the term library
Reply
#3
So basically I should recognize context myself by examining sys.argv[1] - if it's empty, it's a $ADDON[script.module.stiff] call, if not and it doesn't look like a handle, it's a $ADDON[script.module.stiff arg1 arg2] call, otherwise it's a plugin://script.module.stiff?param=value call - right?
Reply
#4
Quote:So basically I should recognize context myself by examining sys.argv[1] - if it's empty, it's a $ADDON[script.module.stiff] call, if not and it doesn't look like a handle, it's a $ADDON[script.module.stiff arg1 arg2] call, otherwise it's a plugin://script.module.stiff?param=value call - right?
this does not sound right.

to get information to display on a skin or anything that is handled by the skin to display nicely
use
<extension point="xbmc.python.pluginsource" library="default.py">

kodi will provide you with the handle in argv[1]
you can generate lists or single items(?) using the methods in xbmcplugin


scripts are for handling all the aspects of user interface by yourself.
kodi won't give you a handle on argv[1]
from your first post, it does not look like you need to use scripts.
Reply
#5
OK, it's now clear enough, thanks.
Reply
#6
Any idea why the xml definition below gives error "RunScript called for a non-script addon 'script.stiff'. This behaviour is deprecated.":

<?xml version="1.0" encoding="utf-8" standalone="yes" ?>
- <addon id="script.stiff" name="stiff" version="0.0.1" provider-name="stiffauthor">
- <requires>
<import addon="xbmc.python" version="2.25.0" />
</requires>
- <extension point="xbmc.python.pluginsource" library="addon.py">
<provides>audio image video</provides>
</extension>
- <extension point="xbmc.addon.metadata">
<summary>Stiff skin support module</summary>
<description>Stiff skin support module</description>
<platform>all</platform>
<license>ala</license>
</extension>
</addon>
Reply
#7
(2017-06-05, 21:33)baza_dwa Wrote: Any idea why the xml definition below gives error "RunScript called for a non-script addon 'script.stiff'. This behaviour is deprecated.":

<?xml version="1.0" encoding="utf-8" standalone="yes" ?>
- <addon id="script.stiff" name="stiff" version="0.0.1" provider-name="stiffauthor">
- <requires>
<import addon="xbmc.python" version="2.25.0" />
</requires>
- <extension point="xbmc.python.pluginsource" library="addon.py">
<provides>audio image video</provides>
</extension>
- <extension point="xbmc.addon.metadata">
<summary>Stiff skin support module</summary>
<description>Stiff skin support module</description>
<platform>all</platform>
<license>ala</license>
</extension>
</addon>

I would guess it is because you have the addon id as script.stiff, but have an extension point of xbmc.python.pluginsource. I would think the addon id should be plugin.stiff or something along those lines.
Reply
#8
This is not the case... I've changed all 'script.' to '.plugin.', including file names and entries in addon.xml, and it's still the same.

OK, RunAddon seems to work, it even supports parameters, but the error is now:

23:42:47.384 T:5964 ERROR: Control 55 in window 10025 has been asked to focus, but it can't
23:42:47.724 T:5964 ERROR: XFILE::CDirectory::GetDirectory - Error getting plugin://plugin.stiff/?ala=makota
23:42:47.724 T:5964 ERROR: CGUIMediaWindow::GetDirectory(plugin://plugin.stiff/?ala=makota) failed

while the whole script is

import xbmc
import xbmcgui
import xbmcplugin

xbmc.log('XXX: '+sys.argv[1])

And it messes with Control 55 in window 10025 anyways (ie. my properly working view in MyVideoNav), setting its contents to videodb://movies/ or something similar instead of library://video/movies/anime.xml being displayed) when called as RunAddon(plugin.stiff,ala=makota) in <onclick> for a button in this window...
Reply
#9
read some tutorial. you are not doing anything required by the api. at the very least you need a call to xbmcplugin.endOfDirectory(). you have 100's of examples. look at one of them! each and every one will show that you have to follow the api to get things done.
Reply
#10
I really did. The point is that it (http://kodi.wiki/view/Audio/video_add-on_tutorial) doesn't say that endOfDirectory() must exist in body of an addon.
I don't expect RFC2119 precision, but...

Btw, for the last couple of months of reading Kodi's wiki/docs I've found them so often outdated, incomplete, imprecise or just erroneous, that I have very low confidence in them. Yes, I read them, but still lots of experimenting, reading code and making rounds on forums is necessary.

Anyways, does setContents('movies') for returned directory would automatically update MyVideoNav? I hope not - this is something I don't want.
Reply
#11
i totally agree that documentation is suboptimal which is why i pointed you to the 100's of existing plugins (monkey see, monkey do).

setContent controls the available sort and view modes. i'm not sure what you fear is changed by it, but that's all it does.
Reply
#12
This explanation might help a bit as well
https://forum.kodi.tv/showthread.php?tid=299107

Yes info is scattered and not easy to find though it's getting better. As irnoic_monkey said, just see how other plugins do it and start with the simpler ones. Especially the ones in Krypton repo should be on par with recent improvements as our reviewers tend to help them getting better. https://github.com/xbmc/repo-plugins/tree/krypton
Read/follow the forum rules.
For troubleshooting and bug reporting, read this first
Interested in seeing some YouTube videos about Kodi? Go here and subscribe
Reply
#13
My question for setContents() was about what happens if addon is called not from a list or list-like element. It seems it updates whatever list is available at hand.

I was in MyVideoNav displaying movies in a container and also having a separate button with addon call in <onclick> (experimenting setup). Clicking the button caused updating the container.

Thanks for all the efforts to make things more clear, they are really helpful.

I miss the most general articles, like the one linked.

The next hurdle before me: how to discretionary filter views in MyVideoNav (and similar windows) - without calling all these dialogs inbetween - imagine a button "Action" - you click it and the view gets filtered with genre Action....
Reply

Logout Mark Read Team Forum Stats Members Help
Selecting correct addon type0