Tip : Quickly Identifying Labels.
#1
First off if anyone has any other way of quickly identifying objects in Kodi let me know Wink

I've just recently started getting in to Kodi and modding some existing skins. As part of that it can be awkward at times to see a label on screen and try to workout which bit of xml controls it. Ok, its not THAT difficult but can take a bit of searching around. So I threw together a small script to help me.

Basically all it does is adds a prefix to the label text so you can identify it on the Kodi screen.

For example, if you use the Custom_Overlay.xml and debug to show which file is currently active then you know which file to start in. So say we have MyVideoNav.xml and we are using the BigList view, so go to the xml that has BigList.

Labels appear as follows :

<label>SomeText/Variable</label>
....
...
<label>AnotherText/Variable</label>
...
...
<label>MoreText/Variable</label>

Run the identifyLabels script and it will add an id :

<label>::ID-1::SomeText/Variable</label>
....
...
<label>::ID-2::AnotherText/Variable</label>
...
...
<label>::ID-3::MoreText/Variable</label>

So when you refresh the view in Kodi you will see the ID text and be able to search for that ID in the xml. Once done just run the undoIdentifyLabels script to remove these ID's again.

Whats needed is :
NotePad++
Python Script Plugin : http://npppythonscript.sourceforge.net/

Once that is installed goto Plugins->PythonScript->New Script to create a script. Create two scripts with the code below then after this is done open your Kodi skin xml file and goto Plugins->PythonScript->Scripts-><Your created scripts>

That should be it. Now there may be a much easier way of doing this but I couldnt find it and it would be great if someone could let me know how. Otherwise just thought I'd share a small tip in case it is of use to anyone else. Its just a quick and messy way but can be useful.

identifyLabels.py
Code:
currentFile=notepad.getCurrentFilename()
inputFile=open(currentFile, "r")
lines=inputFile.readlines()
out=[]
curID=1
for line in lines:
    if '<label>' in line:
        line=line.replace('<label>', '<label>::ID-'+`curID`+'::')
        curID=curID+1
    out.append(line)
inputFile.close()

outputFile=open(currentFile, "w")
for line in out:
    outputFile.write(line)
outputFile.close()  
notepad.reloadCurrentDocument()


undoIdentifyLabels.py
Code:
import re
currentFile=notepad.getCurrentFilename()
inputFile=open(currentFile, "r")
lines=inputFile.readlines()
out=[]
curID=1
for line in lines:
    if '<label>::ID-' in line:
        line = re.sub('<label>::ID-.*?::', '<label>', line)
    out.append(line)
inputFile.close()

outputFile=open(currentFile, "w")
for line in out:
    outputFile.write(line)
outputFile.close()  
notepad.reloadCurrentDocument()
Reply
#2
SublimeKodi offers several features which go into that direction
(live tooltip preview of infolabels inside the editor and
"Search translated strings of open file" for example)
Donate: https://kodi.tv/contribute/donate (foundation), 146Gr48FqHM7TPB9q33HHv6uWpgQqdz1yk (BTC personal)
Estuary: Kodis new default skin - ExtendedInfo Script - KodiDevKit
Reply
#3
Sweet, I have been meaning to give Sublime a shot. I use eclipse normally for other things so I had been using that for the Kodi skins and GitHub also.

Will give it a go this evening, cheers Phil!
Reply
#4
Thanks phil. Have ST3 setup and the package downloaded now. Might take a while to get used to it! The package is installed, I've installed the toolbox addon in Kodi, enabled the webserver, updated the settings but dont see any tooltips, or anything that helps skinning to be honest! So guess I'm missing something....
Reply

Logout Mark Read Team Forum Stats Members Help
Tip : Quickly Identifying Labels.0