Kodi Community Forum
Help for a total Newbie - Printable Version

+- Kodi Community Forum (https://forum.kodi.tv)
+-- Forum: Development (https://forum.kodi.tv/forumdisplay.php?fid=32)
+--- Forum: Skinning (https://forum.kodi.tv/forumdisplay.php?fid=12)
+--- Thread: Help for a total Newbie (/showthread.php?tid=333824)



Help for a total Newbie - Joe1RI - 2018-07-19

I have been trying to teach myself some skinning for Kodi.  I have used an existing module  script-xxx.xml -- I have learned a ton by tweaking here and there, and am at a point where I am trying to make my own skin.  Here is my question.  I have a label control with the following syntax:
         <label>$INFO[Control.GetLabel(3998)]</label>
The value within the Control.GetLabel(3999) is the value that I want to use... however, I only want to use the first value from that variable.  the variable contains a number followed by a space and them some other text.  I am looking for a way to extract only the number part. Example: "23 pants ordered", I would want the value of only "23" (ultimately I would love to format it as "0023") -- Example: "750 items ordered" , I would want to extract the value "750" (ultimately would love to format it as "0750").  I think that this may need to use some sort of Split command and extract only the first value, but I have no idea how that syntax works.  I've been trying and searching web for 2 days now.  I know this is an easy one for you more advanced skinners.  Please help out a newbie... 
Thanx in advance.


RE: Help for a total Newbie - Hitcher - 2018-07-19

What info does the actual label contain?


RE: Help for a total Newbie - Joe1RI - 2018-07-19

it is a number value followed by a space and some text... i wan to simply extract the number portion of the text


RE: Help for a total Newbie - Joe1RI - 2018-07-19

The value is for a duration : "23 min remaining" or "173 min remaining" ... the literal after the number will always be the same.  Maybe there is a way to replace the literal value will nulls?


RE: Help for a total Newbie - Hitcher - 2018-07-19

What I meant was the actual info label name. What is control 3999?


RE: Help for a total Newbie - Joe1RI - 2018-07-19

oh sorry.  I am messing around for teaching purposes with a "non approved" script/addon.  Not sure I should mention it here.  Ultimately, I would love to create my own skin, but for now I am only learning.  I have watched videos on Python and trying to understand how the Python relates to the .xml files.  I am a total newbie at this and just trying to understand how these things work (I do not want to get banned because it is a non-approved add-on)... for right now, as a nyewbie, I am trying to understand how to manipulate data that is returned from the python script and learn how to display it where and how I want.  Uusing .png file... playing around with pos x, y, etc... the value is as stated "n min remains" -- so I want to understand how to manipulate that value..... in this instance I simple want to parse the value to pull a substring or word from the label.  I hope that helps... by the way, newbie or not, i know Hitcher is one of the masters here.  I appreciate any help you can provide.


RE: Help for a total Newbie - Hitcher - 2018-07-19

Then the easiest way would be to change the script to give you just the number.


RE: Help for a total Newbie - Joe1RI - 2018-07-19

I was able to do that Smile  but now was trying to manipulate the value in the xml


RE: Help for a total Newbie - Joe1RI - 2018-07-19

I learn best by actually doing ... Just a thought: It would be cool if there were an approved "learn to skin" add-on out there that we could use as a template with comments and example on what is available to do in each (python script and XML) -- that way everyone could use the same add-on to reference.  So one of the other things I would like to do for example, is have the python get a value (like today's date) .... then have the xml create a button that when clicked would open a dialog window (skinned by me) that would format the date or text how I wish to see it...


RE: Help for a total Newbie - Klojum - 2018-07-19

(2018-07-19, 15:46)Joe1RI Wrote: oh sorry.  I am messing around for teaching purposes with a "non approved" script/addon.  Not sure I should mention it here.
Just call it a "banned add-on". We call it that all the time. Smile


RE: Help for a total Newbie - Joe1RI - 2018-07-19

hahaha.. thanks.. Just the one module I was using to try and learn on....


RE: Help for a total Newbie - Joe1RI - 2018-08-10

Hey Hitcher.  Turns out it is NOT a banned add-on after all.  I am trying to make some changes for the "TV Guide" add on.  I was able to customize the crap out of most of it, but I cannot get one thing to work.  Help would be appreciated by anyone. Current state has a variable in the gui.py file called CHANNELS_PER_PAGE and it is current set at 8.  Meaning that 8 items for egg will show on the screen at a time.  Ultimately, I want to try and allow that value as input from the settings options, but for now I just want to get it to work.  All the display aspects work, however, the move up and move down values still use the default value of 8 channels.

I think I have traced to this: Based on the action Up/Down. I cant for the life of me figure what to add to the code to make it represent the channels_per_page variable.  I have tried a variety of IF and nested IF's saying if equal to channels_per_page, but all I get is syntax errors or not working .. Arrghhhh!!! please help.

python:
        elif action.getId() == ACTION_UP:
            self._up(currentFocus)
        elif action.getId() == ACTION_DOWN:
            self._down(currentFocus)

and _up / _down:
    def _up(self, currentFocus):
        currentFocus.x = self.focusPoint.x
        control = self._findControlAbove(currentFocus)
        if control is not None:
            self.setFocus(control)
        elif control is None:
            self.focusPoint.y = self.epgView.bottom
            self.onRedrawEPG(self.channelIdx - CHANNELS_PER_PAGE, self.viewStartDate,
                             focusFunction=self._findControlAbove)

    def _down(self, currentFocus):
        currentFocus.x = self.focusPoint.x
        control = self._findControlBelow(currentFocus)
        if control is not None:
            self.setFocus(control)
        elif control is None:
            self.focusPoint.y = self.epgView.top
            self.onRedrawEPG(self.channelIdx + CHANNELS_PER_PAGE, self.viewStartDate,
                             focusFunction=self._findControlBelow)