Kodi Community Forum
need settings help - Printable Version

+- Kodi Community Forum (https://forum.kodi.tv)
+-- Forum: Development (https://forum.kodi.tv/forumdisplay.php?fid=32)
+--- Forum: Add-ons (https://forum.kodi.tv/forumdisplay.php?fid=26)
+---- Forum: Python 3 migration (https://forum.kodi.tv/forumdisplay.php?fid=281)
+---- Thread: need settings help (/showthread.php?tid=373627)



need settings help - rojur - 2023-06-30

Hello,
working on a new add-on (kodi 19++) and want to select a library item (single Video, a playlist, a pvr channel) in settings.xml for later use in my add-on

I played a lot with my settings according to  https://kodi.wiki/view/Add-on_settings_conversion and most work fine
But I could not find a way to browse library.

Does anyone has a small settings.xml section and nudge me the right way?

Thanks a lot


RE: need settings help - jbinkley60 - 2023-06-30

(2023-06-30, 09:48)rojur Wrote: Hello,
working on a new add-on (kodi 19++) and want to select a library item (single Video, a playlist, a pvr channel) in settings.xml for later use in my add-on

I played a lot with my settings according to  https://kodi.wiki/view/Add-on_settings_conversion and most work fine
But I could not find a way to browse library.

Does anyone has a small settings.xml section and nudge me the right way?

Thanks a lot

I have this function for getting and changing addon settings in my addon:

addon settings function:

def settings(setting, value = None):
    # Get or add addon setting
    if value:
        xbmcaddon.Addon().setSetting(setting, value)
    else:
        return xbmcaddon.Addon().getSetting(setting)  

Then to use it I call it like this to get a settings value:

getting a value:
autourl = settings('autostart')

or this to set a value:

setting a value:
settings('kodiclean', 'false')



Thanks,

Jeff


RE: need settings help - rojur - 2023-06-30

Jeff, 
thanks for looking at this but I'm afraid I was not clear enough about my issue.

I already have string, integer and boolean settings in my settings.xml and work with those parameters in my code successfully.

What I do not figure out is how to define a setting in settings.xml that works like file browser but allows user to browse the library instead of filesystem. eg. to select and configure a playlist to go with

I played with the examples from https://kodi.wiki/view/Add-on_settings_conversion, in particular the "type=audio" or "type=video" samples
but they only allow me to browse file system.

But I need to browse the library. Maybe the "type=action" examples are the right way to go, but in this case in can't find much information how to do that

best regards
Jürgen


RE: need settings help - jbinkley60 - 2023-06-30

(2023-06-30, 11:22)rojur Wrote: Jeff, 
thanks for looking at this but I'm afraid I was not clear enough about my issue.

I already have string, integer and boolean settings in my settings.xml and work with those parameters in my code successfully.

What I do not figure out is how to define a setting in settings.xml that works like file browser but allows user to browse the library instead of filesystem. eg. to select and configure a playlist to go with

I played with the examples from Add-on_settings_conversion (wiki), in particular the "type=audio" or "type=video" samples
but they only allow me to browse file system.

But I need to browse the library. Maybe the "type=action" examples are the right way to go, but in this case in can't find much information how to do that

The Kodi folks will need to help with this question.  I am not sure if it is possible or not. 

Thanks,

Jeff


RE: need settings help - izprtxqkft - 2023-06-30

if i understand the question

you can do this by setting the default value

<setting type="video" id="playlist" label="Browse" default="library://video_flat/playlists.xml/"/>

or

<setting type="video" id="movie" label="Browse" default="videodb://"/>


it just directs the file browser where to go


RE: need settings help - jbinkley60 - 2023-06-30

(2023-06-30, 16:30)jepsizofye Wrote: if i understand the question

you can do this by setting the default value

<setting type="video" id="playlist" label="Browse" default="library://video_flat/playlists.xml/"/>

or

<setting type="video" id="movie" label="Browse" default="videodb://"/>


it just directs the file browser where to go

Good to know.  Do you know if leverages the Kodi special protocol or the raw file system structure ?  I also wasn't sure if it could go outside of the Kodi filesystem space.


Thanks,

jeff


RE: need settings help - izprtxqkft - 2023-06-30

should be using the internal vfs, the default will work with just about any path kodi would understand like xbmcvfs does


RE: need settings help - rojur - 2023-07-05

Many thanks jepsizofye,
that was the nudge I was looking for.

I finally had success with
 
Code:
                <setting id="video_playlist" type="path" label="30032" help="">
                    <level>0</level>
                    <default>special://masterprofile/playlists/video/</default>
                    <constraints>
                        <masking>*.xsp</masking>
                    </constraints>
                    <control type="button" format="file">
                        <heading>30032</heading>
                    </control>
                </setting>

However, I was playing a lot with various types of settings, also with RunScript actions and even with your examples.
But the results are very different and there is lot of information missing making advanced usage quite painful.

Is there any additional documentation how addon settings work? Anything more deep than what is listed at https://kodi.wiki/view/Add-on_settings_conversion?
Within source code? Is there an xml schema behind it? I couldn't find something.

Nevertheless, your hint with browsers default value as starting point was great

Best regards
Jürgen