2015-06-23, 12:36
First off if anyone has any other way of quickly identifying objects in Kodi let me know
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
undoIdentifyLabels.py
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()