I am trying to modify /home/osmc/.kodi/userdata/guisettings.xml with sed, so I can change screen resolution and audio output when rebooting through a script. However each time I run the script (changing the lines in guisettings.xml) and reboot - my OSMC has changed back to the default skin.
This hasn’t been a problem earlier but yesterday reinstalled OSMC because of corrupted SD-card.
Does anyone have an idea how to make my changes in guisettings.xml stay after rebooting and prevent OSMC from booting up in the default OSMC skin?
If you are making the changes while Kodi is running, then they will be reset when Kodi restarts. Kodi writes guisettings when it’s stopped.
Depending on what you are trying to change, you could use the Kodi JSON to achieve it. Otherwise Kodi must be stopped (sudo systemctl stop mediacenter) for your changes to stick.
I tried to stop Kodi with “sudo systemctl stop multimedia” and then do the changes to guisettings.xml and afterwards reboot. Same problem appeared after the reboot… ?
How would you suggest that I could implement the following lines in my own created “advancedsettings.xml” in .kodi/userdata/
sed -i ‘15s# default=“true”>PI:HDMI#ALSA:@:CARD=Device,DEV=0#g’ /home/osmc/.kodi/userdata/guisettings.xml
sed -i ‘215s%true% default=“true”%g’ /home/osmc/.kodi/userdata/guisettings.xml
sed -i ‘320s#29#33#g’ /home/osmc/.kodi/userdata/guisettings.xml
sed -i ‘322s# default=“true”>DESKTOP#00128000720060.00000pstd#g’ /home/osmc/.kodi/userdata/guisettings.xml
The above lines is the changes I need to happen, when I reboot (and the screen rotates because of “display_rotate=2” in /boot/config.txt). This will change my screen resolution to 1280x720p and my audio output to USB audio.
However when doing it like the above code - the OSMC skin is set to default, when rebooting…
I’m out of time for today, but I’d have thought that the simplest solution would be to have several versions of advancedsettings.xml, one for each of the configurations you want, and simply copy whichever one you need to advancedsettings.xml, overwriting the previous settings.
Could you maybe specify further how the file “advancedsettings.xml” would look, if I would like my sed commands to run before rebooting for rotating the screen?
The information you need is found here. You would just copy whatever lines you wanted from the guisettings.xml file. I believe this would be something like…
There’s no guarantee that using advancedsettings.xml will work for all settings. Just because someone on Reddit says it’ll work, doesn’t guarantee that it will. I was hoping that you’d give it a try.
Looking at your sed scripts, I’d say that guisettings.xml file is probably failing to parse correctly and Kodi will therefore reset everything back to default settings. You suggested in post #1 that it was working before a reinstall of OSMC but I don’t understand how that might be so. If the advancedsettings.xml method doesn’t work, I’ll comment on the sed code.
Hey again! I fixed it! Well a lot easier way but it is solved. I have just created two guisettings.xml.normal and guisettings.xml.projector. With my bash script I am now instead just renaming and moving around each time I am rebooting. This works! Amazing…
Another question you maybe can answer: is it possible to “safely” reboot, what should I do to prevent the power from just cutting to my external harddisk when using “sudo reboot”. Could I maybe somehow unmount the disks before the reboot, so it doesn’t hurt in my heart each time it reboots and the harddisks hard shuts down and boot up again right after ?