[End-user mod] Change Fontsizes and values in XML
tldr: examples of sed-usage, but wound up explaning how to code something.

What I'm explaining below works for Linux (use sed) AND Windows (use sed for windows).

(To be able to do what is below, you first need to be able to manually change let's say a font-size in Kodi.  That means finding out what the thing on your screen (that you want larger or smaller or different) is called in what xml file, and editing it, and reloading your skin to see the result of your edit.  First you need to figure this stuff out.  You won't need a command like sed for that. It means opening a text editor and looking around in files, finding the spot you think it is, and changing for example "30" into "32" "70", and seeing on screen the result of what you did (tip : at 70 for a fontsize, it will be obvious what change you made, letters will be very very large).  Only after succeeding  can you think about using a command to do all that. It's trial and error. See below for tips where to look, but the difficulty-level of this stuff just is what it is.)

If you update a skin, all edited values get reset. So if you made let's say your plotfont big, it goes smaller again.  You can make a script (.sh or .bat), and automate changes.

Warning : There is no checking against mistakes with the commands below.  If you mess up, you need to reinstall your skin and start again. Running the same command twice may change values you didn't intend to change.  But the solution to this, reinstalling your skin, is pretty robust so you shouldn't have long term problems. The adventurous may mess up their entire Kodi (and let's face it their entire OS). So backup what you don't want to lose.

Example for linux :


cd /home/mydir/.kodi/addons/myskin/1080i

sed -i "s/| Player.Seeking | Player.DisplayAfterSeek | Player.Paused | Player.Forwarding |/| Player.Seeking | Player.Forwarding |/" DialogSeekBar.xml
sed -i "/font13/{n;/RobotoCondensed-Regular.ttf/{n;s/<size>30/<size>32/}}" Font.xml

Explanation :

with cd we change to the folder where the files to be changed are. Then follows the interesting stuff :

sed -i "s/| Player.Seeking | Player.DisplayAfterSeek | Player.Paused | Player.Forwarding |/| Player.Seeking | Player.Forwarding |/" DialogSeekBar.xml

Sed is a command-line editor. With -i it edits inside a file. The thing between quotes " is the command you give sed, s stands for substitute. At the end you put the filename where the thing is that needs changing.  We'll be looking in Dialogseekbar.xml first and then in Font.xml.

There are three slashes / between the quotes ". It just says this : /replace this/with someting else/. (Also : if the thing you are changing has a slash / in it, for example </this>, you can also say +replace this+with something else+.  Replace / with +, or whatever symbol you like that isn't present in the thing you want to substitute.)

The thing we are looking for is "| Player.Seeking | Player.DisplayAfterSeek | Player.Paused | Player.Forwarding |". And we change it to "| Player.Seeking | Player.Forwarding |".  By removing "| Player.DisplayAfterSeek |" and "... Player.Paused |" the seekbar isn't displayed anymore after a seek, or while you pause.

This stuff above is for a simple "search for one thing" and you'll find it. But sed only searches one line at a time by default. So to find a certain other thing in XML, where a lot of things get repeated a lot of times, you need to use a trick.  Let's look at the value of a font in Font.xml, and take display-element font13 for example (you might not have that in your xml) that you want to change. The fontsize for the font belonging to font13 gets identified over three lines (see below, what size"size" for what font"Roboto" for what display-element"font13").  I won't illustrate what is in the xml, but only how we deal with it.

sed -i "/font13/{n;/RobotoCondensed-Regular.ttf/{n;s/<size>30/<size>32/}}" Font.xml

First you have sed find font13 ("/replace this/..."). But instead of "with something else/" we want to search for a next thing on the line below.  So between brackets {} we look for that next thing and eventually do the replacing.  We open { and take in the next line n. Then  we do the same thing as before.

This stuff 


is just a way of saying "first look for this" (font13), and after that "then look for another this on the next line" (RobotoCondensed-Regular.ttf). And below we do it one more time, again by opening brackets, taking in the next line, and looking for a thing <size>30 ...

sed -i "/font13/{n;/RobotoCondensed-Regular.ttf/{n;s/<size>30/

So two things we need to look for, "font13" and "RobotoCondensed-Regular.ttf", before we we find on the next line the thing "<size>30" that we want to change.  And at the very end

sed -i "/font13/{n;/RobotoCondensed-Regular.ttf/{n;s/<size>30/<size>32/}}'

we say to replace "<size30>" with "<size32>" and we close of BOTH brackets }} (, or however many we opened to get to the thing we needed to find and change).
Thread Rating:
  • 0 Vote(s) - 0 Average

Logout Mark Read Team Forum Stats Members Help
[End-user mod] Change Fontsizes and values in XML00
This forum uses Lukasz Tkacz MyBB addons.