Posts: 56
Joined: Nov 2013
Reputation:
0
Hi,
in my app I'm getting a list of music add-ons via "Addons.GetAddons" to display it to the user, including add-on description. How do I get the top level path of the add-on to open with "Files.GetDirectory"? There seems to be no property in the returned data.
Instead of "Addons.GetAddons", I can use "Files.GetDirectory" with "directory" = "addons://sources/audio", this way I get the top level path in the "file" property, however, I don't get add-on descriptions.
Thanks,
Markus
Posts: 146
Joined: Mar 2015
Reputation:
6
axa88
Senior Member
Posts: 146
Sorry, I cant exactly get the gist of what your trying, i dont see the overall workflow, but depending on exactly what you want to do, you can either use Addons.ExectueAddon to execute (open in kodi for example or whatever the addon does) or Files.GetDirectory to get the menu directory structure (the menus usually used within the addon itself when executed in kodi), both using the "addonid" that you got with Addons.GetAddons
Posts: 56
Joined: Nov 2013
Reputation:
0
Hi axa88,
thanks for help. Basically, I'd like to know what I need to pass to Files.GetDirectory to get the menu directory structure. If I understand correctly, you say I should pass the addonid to Files.GetDirectory, but I don't think it's possible. I need to pass the parameter "directory".
Posts: 146
Joined: Mar 2015
Reputation:
6
axa88
Senior Member
Posts: 146
2017-05-16, 02:30
(This post was last modified: 2017-05-16, 02:31 by axa88.)
you understand correctly, but i will reword, you need to use the Files.GetDirectory method passing it the addonid you have aquired as the value of the directory parameter..
if I recall correctly it needs to have the right protocol prefix, which I think isn't at all obvious...
I'm killing time on the john right now but at some point when I get to my PC I'll add an example...
Posts: 56
Joined: Nov 2013
Reputation:
0
2017-05-16, 08:03
(This post was last modified: 2017-05-16, 08:03 by markusloffler.)
Yes, you can use "plugin://<pluginid>" as the value for "directory". But if you just want to get the music items (as in my case), it gets tricky. You need to say "plugin://<pluginid>?content_type=music". But this only works reliably for add-ons that provide both music and video (e.g. podcasts). For example, for Soundcloud it fails if you add "content_type=music". So I came to the conclusion that constructing the directory value from the addon-id is not a clean way altogether. But maybe it's just a Soundcloud bug? (It works with Radio for example).
Posts: 146
Joined: Mar 2015
Reputation:
6
axa88
Senior Member
Posts: 146
I cant comment on any particular plugin but the most generic and reliable way of interacting with one is to navigate with Files.GetDirectory, just like if you were using the directory structure right in the osd...
Out of curiosity i looked at soundcloud, i see it has a directory structure which down one path leads to a list of items one having "Music Genres " and one "Audio Genres" , i couldn't get the plugin working for some reason but if either of those are what your after you can directly link to that directory request...
There are those plugins that just seem to allow you a way to execute, and as far as i know don't provide a directory structure to the osd, and thus not to the API, rather just allowing a built in menu situation. and there may be some ways to interact with them through the api, they didnt design themselves for interaction and learning to do so is a hassle