Getting top level file path of an add-on
#1
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
Kodi Music Remote for iOS, the remote control for music lovers - http://kodimusicremote.com
Reply
#2
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
Reply
#3
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".
Kodi Music Remote for iOS, the remote control for music lovers - http://kodimusicremote.com
Reply
#4
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...
Reply
#5
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).
Kodi Music Remote for iOS, the remote control for music lovers - http://kodimusicremote.com
Reply
#6
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
Reply
#7
Ok, thanks for the info! I ended up doing both Files.GetDirectory (for the top level directory) and Addons.GetAddons (for the add-on details) and cross-matching them by the addon-id. Not the prettiest, but it works Smile
Kodi Music Remote for iOS, the remote control for music lovers - http://kodimusicremote.com
Reply

Logout Mark Read Team Forum Stats Members Help
Getting top level file path of an add-on0