Kodi Community Forum
TV Guide Fullscreen - possibly the most powerful TV Guide in the world. ;) - Printable Version

+- Kodi Community Forum (https://forum.kodi.tv)
+-- Forum: Support (https://forum.kodi.tv/forumdisplay.php?fid=33)
+--- Forum: Add-on Support (https://forum.kodi.tv/forumdisplay.php?fid=27)
+---- Forum: Program Add-ons (https://forum.kodi.tv/forumdisplay.php?fid=151)
+---- Thread: TV Guide Fullscreen - possibly the most powerful TV Guide in the world. ;) (/showthread.php?tid=282157)



RE: TV Guide Fullscreen - possibly the most powerful TV Guide in the world. ;) - samueljones - 2019-07-27

(2019-07-26, 21:42)M89SE Wrote:
(2019-07-26, 00:24)samueljones Wrote: @M89SE , or anyone can please  help me out. am trying to get the programme duration to show something like 1hr 20min.  currently it shows in minutes e.g Length  : 100 minutes.

After google search i got the following but no working.


                       <control type="label">
                        <left>1240</left>
                        <top>200</top>
                        <width>300</width>
                        <height>60</height>
                        <align>center</align>
                       <label>Duration: $INFO[ListItem.Duration(h)]h$INFO[ListItem.Duration(mm)]m</label>
                        </control>


thanks

This one is quite tricky! I created this function in my own TV Guide a while ago. Smile

You will need to create a function in Python first and then import the setting to skin. Listitem.Duration won't work. Do you know how to programme Python or do you need some help?.

Result bottom right:

Image 
@M89SE , thanks for your reply, I thought it was an easy job, I dont know its a hard one.  Am still a beginner when it comes to python. Any help will be highly appreciated

Thanks.

SJ


RE: TV Guide Fullscreen - possibly the most powerful TV Guide in the world. ;) - M89SE - 2019-07-27

@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) 

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.


RE: TV Guide Fullscreen - possibly the most powerful TV Guide in the world. ;) - samueljones - 2019-07-30

@M89SE  unfortunately, this does not work in TVGF, after the edit TVGF can not be opened. may be the problem is from my edit I cant say.

hope @primaeval  will consider this function one day.

Thanks so much for your help anyways.


Regards


RE: TV Guide Fullscreen - possibly the most powerful TV Guide in the world. ;) - M89SE - 2019-07-30

(2019-07-30, 01:01)samueljones Wrote: @M89SE  unfortunately, this does not work in TVGF, after the edit TVGF can not be opened. may be the problem is from my edit I cant say.

hope @primaeval  will consider this function one day.

Thanks so much for your help anyways.


Regards

I will install TVGF and try to add it when I have some time over. Like I said before I may have made some mistake and need to try it out myself.


RE: TV Guide Fullscreen - possibly the most powerful TV Guide in the world. ;) - M89SE - 2019-07-30

@samueljones

Ok I got it working.

gui.py
https://drive.google.com/open?id=1tBc7n-foLruKelOJZs1Dw7j8DoYfiBmx

C_MAIN_CALC_TIME_EPG = 45999

Added on end of def onFocus(self, controlId):
python:
        startDelta = datetime.datetime.now() - program.startDate
        endDelta = datetime.datetime.now() - program.endDate

        s = (startDelta - endDelta)

        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(self.C_MAIN_CALC_TIME_EPG, '%s' % (s))

script-tvguide-main.xml
xml:

            <control type="label" id="45999">
                <description>Time format label</description>
                <posx>0</posx>
                <posy>0</posy>
                <width>300</width>
                <height>100</height>
                <textcolor>ffffffff</textcolor>
                <shadowcolor></shadowcolor>
                <font>font13_title</font>
                <align>left</align>
            </control>



RE: TV Guide Fullscreen - possibly the most powerful TV Guide in the world. ;) - samueljones - 2019-07-31

@M89SE  thanks a lot Bro, you are star. its working now. I really appreciate your effort and time.


Regards
SJ


RE: TV Guide Fullscreen - possibly the most powerful TV Guide in the world. ;) - M89SE - 2019-07-31

(2019-07-31, 10:01)samueljones Wrote: @M89SE  thanks a lot Bro, you are star. its working now. I really appreciate your effort and time.


Regards
SJ
No problem just let me know if you need some help.


RE: TV Guide Fullscreen - possibly the most powerful TV Guide in the world. ;) - daemonrealm - 2019-07-31

Hello,

I keep getting this error after parsing of my XMLTV file on multiple services used for EPG data.

2019-07-31 16:32:24.479 T:123145415970816   ERROR: Traceback (most recent call last):
2019-07-31 16:32:24.479 T:123145415970816   ERROR:   File "/Users/j131337/Library/Application Support/Kodi/addons/script.tvguide.fullscreen/source.py", line 568, in _updateChannelAndProgramListCaches
2019-07-31 16:32:24.481 T:123145415970816   ERROR:     self.conn.commit()
2019-07-31 16:32:24.481 T:123145415970816   ERROR: IntegrityError: FOREIGN KEY constraint failed

Thanks any assistance?


RE: TV Guide Fullscreen - possibly the most powerful TV Guide in the world. ;) - M89SE - 2019-07-31

(2019-07-31, 22:34)daemonrealm Wrote: Hello,

I keep getting this error after parsing of my XMLTV file on multiple services used for EPG data.

2019-07-31 16:32:24.479 T:123145415970816   ERROR: Traceback (most recent call last):
2019-07-31 16:32:24.479 T:123145415970816   ERROR:   File "/Users/j131337/Library/Application Support/Kodi/addons/script.tvguide.fullscreen/source.py", line 568, in _updateChannelAndProgramListCaches
2019-07-31 16:32:24.481 T:123145415970816   ERROR:     self.conn.commit()
2019-07-31 16:32:24.481 T:123145415970816   ERROR: IntegrityError: FOREIGN KEY constraint failed

Thanks any assistance?
Seems to be a database corruption, have you tried to reset the database file?. Might be a channel with special characters (maybe ' or ") in XMLTV file that need to be removed.


RE: TV Guide Fullscreen - possibly the most powerful TV Guide in the world. ;) - daemonrealm - 2019-08-01

(2019-07-31, 23:50)M89SE Wrote:
(2019-07-31, 22:34)daemonrealm Wrote: Hello,

I keep getting this error after parsing of my XMLTV file on multiple services used for EPG data.

2019-07-31 16:32:24.479 T:123145415970816   ERROR: Traceback (most recent call last):
2019-07-31 16:32:24.479 T:123145415970816   ERROR:   File "/Users/j131337/Library/Application Support/Kodi/addons/script.tvguide.fullscreen/source.py", line 568, in _updateChannelAndProgramListCaches
2019-07-31 16:32:24.481 T:123145415970816   ERROR:     self.conn.commit()
2019-07-31 16:32:24.481 T:123145415970816   ERROR: IntegrityError: FOREIGN KEY constraint failed

Thanks any assistance?
Seems to be a database corruption, have you tried to reset the database file?. Might be a channel with special characters (maybe ' or ") in XMLTV file that need to be removed. 

Hello, yes I did a reset everything on the database restarting Kodi as well. That sometimes works, also the history is sometimes the XMLTV guide data loads OK, sometimes not.


RE: TV Guide Fullscreen - possibly the most powerful TV Guide in the world. ;) - M89SE - 2019-08-01

@deamonrealm I would need to see the entire log. Could you send it to me as PM?.


RE: TV Guide Fullscreen - possibly the most powerful TV Guide in the world. ;) - daemonrealm - 2019-08-02

(2019-08-01, 06:29)M89SE Wrote: @deamonrealm I would need to see the entire log. Could you send it to me as PM?.

Hello yes, I apologize for the delay response. Let me re-run it, the trial for this service may be over so I will re-obtain one.


RE: TV Guide Fullscreen - possibly the most powerful TV Guide in the world. ;) - moshoodo123 - 2019-08-02

(2019-07-30, 13:23)M89SE Wrote:
(2019-07-30, 01:01)samueljones Wrote: @M89SE  unfortunately, this does not work in TVGF, after the edit TVGF can not be opened. may be the problem is from my edit I cant say.

hope @primaeval  will consider this function one day.

Thanks so much for your help anyways.


Regards

I will install TVGF and try to add it when I have some time over. Like I said before I may have made some mistake and need to try it out myself.  
@M89SE, Thanks a lot for providing this script, it is very helpful. is there a way make it show as 1h 46m with space in between? currently it shows as 1h00   and  2h30.

i.e  I want hours to show as  1h   , 2h, 3h  etc

     minutes to show as 20m,  30m  etc  and combination to be   1h 30m.

Thanks for your help.


RE: TV Guide Fullscreen - possibly the most powerful TV Guide in the world. ;) - M89SE - 2019-08-04

(2019-08-02, 15:23)moshoodo123 Wrote:
(2019-07-30, 13:23)M89SE Wrote:
(2019-07-30, 01:01)samueljones Wrote: @M89SE  unfortunately, this does not work in TVGF, after the edit TVGF can not be opened. may be the problem is from my edit I cant say.

hope @primaeval  will consider this function one day.

Thanks so much for your help anyways.


Regards

I will install TVGF and try to add it when I have some time over. Like I said before I may have made some mistake and need to try it out myself.          
@M89SE, Thanks a lot for providing this script, it is very helpful. is there a way make it show as 1h 46m with space in between? currently it shows as 1h00   and  2h30.

i.e  I want hours to show as  1h   , 2h, 3h  etc

     minutes to show as 20m,  30m  etc  and combination to be   1h 30m.

Thanks for your help.        

Sure Smile

python:
        startDelta = datetime.datetime.now() - program.startDate
        endDelta = datetime.datetime.now() - program.endDate

        s = (startDelta - endDelta)

        s = re.sub(r'^0:', '', str(s))
        s = re.sub(r':00$', 'min', str(s))
        s = re.sub(':', 'h ', str(s))  #<--- Added a space after "h".
        matchHour = re.search(r'h\s\d+min$', s) #<--- Added a "\s" after "h".
        matchMin = re.search(r'^0\s\dmin', s) #<--- Added a "\s" after "0".

        #if matchHour: #<--- Commented this with a "#".
            #s = re.sub(r'min$', '', str(s)) #<--- Commented this with a "#".

        if matchMin: #<--- Changed from "elif" to "if".
            s = re.sub(r'^0', '', str(s))

        self.setControlLabel(self.C_MAIN_CALC_TIME_EPG, '%s' % (s))

To have "m" instead of "min" just replace all "min" terms with "m".


RE: TV Guide Fullscreen - possibly the most powerful TV Guide in the world. ;) - moshoodo123 - 2019-08-06

(2019-08-04, 22:27)M89SE Wrote:
(2019-08-02, 15:23)moshoodo123 Wrote:
(2019-07-30, 13:23)M89SE Wrote: I will install TVGF and try to add it when I have some time over. Like I said before I may have made some mistake and need to try it out myself.          
@M89SE, Thanks a lot for providing this script, it is very helpful. is there a way make it show as 1h 46m with space in between? currently it shows as 1h00   and  2h30.

i.e  I want hours to show as  1h   , 2h, 3h  etc

     minutes to show as 20m,  30m  etc  and combination to be   1h 30m.

Thanks for your help.          

Sure Smile

python:
        startDelta = datetime.datetime.now() - program.startDate
        endDelta = datetime.datetime.now() - program.endDate

        s = (startDelta - endDelta)

        s = re.sub(r'^0:', '', str(s))
        s = re.sub(r':00$', 'min', str(s))
        s = re.sub(':', 'h ', str(s))  #<--- Added a space after "h".
        matchHour = re.search(r'h\s\d+min$', s) #<--- Added a "\s" after "h".
        matchMin = re.search(r'^0\s\dmin', s) #<--- Added a "\s" after "0".

        #if matchHour: #<--- Commented this with a "#".
            #s = re.sub(r'min$', '', str(s)) #<--- Commented this with a "#".

        if matchMin: #<--- Changed from "elif" to "if".
            s = re.sub(r'^0', '', str(s))

        self.setControlLabel(self.C_MAIN_CALC_TIME_EPG, '%s' % (s))

To have "m" instead of "min" just replace all "min" terms with "m".  

@M89SE , Thanks a lot mate for your help. that really makes sense.  do you have any idea why single hour still shows as 1h00m  , 2h00m. instead of 1h, 2h etc.  it is perfect when showing hour and minutes together which currently shows as 1h 30min.   minutes only too is showing perfectly which currently shows as 20min, 30min etc.  only single hour have the bug.

Regards