Kodi Community Forum
Possible to create settings defaults that overrules the kodi master settings.xml? - Printable Version

+- Kodi Community Forum (https://forum.kodi.tv)
+-- Forum: Support (https://forum.kodi.tv/forumdisplay.php?fid=33)
+--- Forum: General Support (https://forum.kodi.tv/forumdisplay.php?fid=111)
+---- Forum: OS independent / Other (https://forum.kodi.tv/forumdisplay.php?fid=228)
+---- Thread: Possible to create settings defaults that overrules the kodi master settings.xml? (/showthread.php?tid=371564)



Possible to create settings defaults that overrules the kodi master settings.xml? - bossanova808 - 2023-01-24

So it appears that default settings for Kodi live at: https://github.com/xbmc/xbmc/blob/master/system/settings/settings.xml

(I know some others are in guisettings.xml)

Is it possible to create a file, e.g. in userdata, that overrules some of these, that I could then add to my various Kodi installs as a way of quickly configuring them how I like them?  Or add values to those to e.g. advancedsettings.xml?

Kodi is amazing and has loads and loads of configuration as we all know, but over the 15 years I have been using it, I've spent way too much time re-configuring the same things on new/clean installs.  I'd really like to simplify my life and make an xml file with (what I personally consider to be...) much more sane default settings.

Bascially, is there more programmatic way to handle Kodi config??

Actually - I have just seen this: https://kodi.wiki/view/Advancedsettings.xml#guisettings.xml_Setting_Conversion

...am I reading that right - I can put basically any setting in there, and it will be effectively set in code, rather than the UI?


RE: Possible to create settings defaults that overrules the kodi master settings.xml? - Karellen - 2023-01-24

(2023-01-24, 09:45)bossanova808 Wrote: am I reading that right - I can put basically any setting in there, and it will be effectively set in code, rather than the UI?
As far as I am aware, yes.
I need to update that section because apparently you can just copy and paste the setting as is ... <setting id="videolibrary.showemptytvshows">true</setting>
You don't actually need to convert it as shown in that section. I haven't tested but if you can let me know if it works that way, I can update the page.


RE: Possible to create settings defaults that overrules the kodi master settings.xml? - izprtxqkft - 2023-01-24

you can override guisettings.xml from advancedsettings.xml when doing so also hides that setting from the gui, i dont remember the wiki i read but im using this method
i wrote 5m console script to do it but you can see a template here: https://paste.kodi.tv/onocihadaj.kodi

heres the 5m script i used, call as ./guisettings.py guisettings.xml it reads the first argument as the file, does not do everything for you so youll have to go back and format further manuallly

python:
#!/usr/bin/python3

import sys
import xml.etree.ElementTree as ET

if len(sys.argv) >= 1:
    s = open(sys.argv[1]).read()
    
    e = ET.ElementTree(ET.fromstring(s))
    parent=""
    for elem in e.iter():
        if elem.tag=="setting":
            attr=elem.attrib['id'].split(".")
            if parent!=attr[0]:
                if parent!='':
                    print("</{}>".format(parent))
                parent=attr[0]
                print("<{}>".format(parent))
            print("<{}>{}</{}>".format(attr[1],elem.text,attr[1]))
    print("</{}>".format(parent))
    exit()

its not even python3, as stated it was a 5m
just changed usr/bin/python to python3 it works fine with 3 i just didnt write it that way at first


RE: Possible to create settings defaults that overrules the kodi master settings.xml? - bossanova808 - 2023-01-24

Thanks - I'll have a play and see what works & report back!


RE: Possible to create settings defaults that overrules the kodi master settings.xml? - bossanova808 - 2023-01-25

(@jepsizofye  Given the info from @Karellen above, your script actually just makes things harder by stripping off the parent, but thanks for trying to help in any case.)

Karellen is saying you can literally just copy the setting as is from guisettings.xml into your advancedsettings.xml.

As a test, I added an advancedsettings.xml with just:

xml:

<advancedsettings version="1">
    <setting id="videoplayer.seeksteps">-30,30</setting>
    <setting id="videoplayer.seekdelay">0</setting>
</advancedsettings>

...and this successfully automatically configured my Kodi for 'old skool' instant skipping in 30 second blocks.

But note, I did seemingly have to remove the default="true" part of the original guisettings.xml lines to get it to work.

Now the question becomes...how far to go with this?!  One could potentially move just about all the config into code with this...hmmm, very powerful, but at times it is useful to tweak things via the GUI.  hmmm.....


RE: Possible to create settings defaults that overrules the kodi master settings.xml? - emveepee - 2023-01-25

Yes I have been doing it for a while based on this thread https://forum.kodi.tv/showthread.php?tid=357970  I like sorting PVR by episode number now.

Martin


RE: Possible to create settings defaults that overrules the kodi master settings.xml? - bossanova808 - 2023-01-25

Ah, I did not find that in my searching.  But same conclusion - copy the line, remove the default value, and it appears to work.   @Karellen perhaps test to confirm, but I'd say go ahead and update the Wiki with this easier approach.


RE: Possible to create settings defaults that overrules the kodi master settings.xml? - izprtxqkft - 2023-01-25

right on @bossanova808 

thats not how i understood it when i read whatever i read but as long as it works

this is how i read your example *should* work, i guess both do

xml:
<advancedsettings version="1">
<videoplayer>
<seeksteps>-30,30</seeksteps>
<seekdelay>0</seekdelay>
</videoplayer>
</advancedsettings>

glad you got it


RE: Possible to create settings defaults that overrules the kodi master settings.xml? - Karellen - 2023-01-25

(2023-01-25, 03:37)bossanova808 Wrote: perhaps test to confirm, but I'd say go ahead and update the Wiki with this easier approach.
Great!! Thanks for that. I'll update the page with the easier method in the next day or two.

(2023-01-25, 03:16)bossanova808 Wrote: One could potentially move just about all the config into code with this
Yes, and you can end up with empty settings pages...

Image