2019-07-27, 10:12
@samueljones
OK, first you need to decide in which window you would like to add this function, eg. script-tvguide-main.xml or else.
Lets say you choose script-tvguide-main.
Open gui.py and find class TVGuide, then from self.program you need to extract program.startDate and program.endDate, I think this should also be possible in TVGF.
Create a new defining function (def)
Add self.calcTime() to "def onInit(self):" at the end.
Then create an ID number for C_MAIN_CALC_TIME_EPG and add it to class TVGuide(xbmcgui.WindowXML):.
eg.
C_MAIN_CALC_TIME_EPG = 4232
Open up script-tvguide-main.xml and add a new label with ID 4232, now the function should be visible in time format: hours "1h 00" or minutes "60 min".
I might be a bit wrong and I haven't tested this implementation myself in TVGF.
OK, first you need to decide in which window you would like to add this function, eg. script-tvguide-main.xml or else.
Lets say you choose script-tvguide-main.
Open gui.py and find class TVGuide, then from self.program you need to extract program.startDate and program.endDate, I think this should also be possible in TVGF.
Create a new defining function (def)
python:def calcTime(self):
startDelta = datetime.datetime.now() - self.program.startDate
endDelta = datetime.datetime.now() - self.program.endDate
s = (endDelta - startDelta)
s = re.sub(r'^0:', '', str(s))
s = re.sub(r':00$', 'min', str(s))
s = re.sub(':', 'h', str(s))
matchHour = re.search(r'h\d+min$', s)
matchMin = re.search(r'^0\dmin', s)
if matchHour:
s = re.sub(r'min$', '', str(s))
elif matchMin:
s = re.sub(r'^0', '', str(s))
self.setControlLabel(C_MAIN_CALC_TIME_EPG, '%s' % (s))
Add self.calcTime() to "def onInit(self):" at the end.
Then create an ID number for C_MAIN_CALC_TIME_EPG and add it to class TVGuide(xbmcgui.WindowXML):.
eg.
C_MAIN_CALC_TIME_EPG = 4232
Open up script-tvguide-main.xml and add a new label with ID 4232, now the function should be visible in time format: hours "1h 00" or minutes "60 min".
I might be a bit wrong and I haven't tested this implementation myself in TVGF.