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. ;) - SteliosT - 2018-11-26

(2016-12-19, 22:52)primaeval Wrote: version 0.0.260
- Settings \ Source \ Look for .gz Files (Urls only)
- Settings \ Source \ md5 Check (Urls only)
- md5 needs to be of the uncompressed file
- put the original file name as the source (not the .gz file)

This is slightly new behaviour with gz and md5 files.
If you used compression before make sure it still works.

You can save yourselves a fair bit of time and bandwidth if you use compression and md5 files.

If your server supports compression you might not have to do anything with gz files,
requests should decompress it automatically.
If it doesn't I would recommend making a .gz version of your xmltv file if it is big.
Turn the new gz setting on.
Leave the source name without the gz extension (eg guide.xmltv not guide.xmltv.gz).

If you can make an md5 file on the server it could save you a lot of unnecessary downloading.
Make an md5 of the uncompressed file (eg guide.xmltv.md5).
Make a gz version of your file (eg guide.xmltv.gz)
Turn both the new settings on.

The md5 check will only download new files if the md5 has changed.

If the gz button is on and it can't find a gz version of your file it will try to download the original file without the gz extension.
Hi everyone. Since this is my first post, I apologize for any possible mistakes due to my questions. First, thanks to Primaeval for the amazing work, not only on this script, but for all the previous projects.
I have followed the intructions to select the guide.xml file an internet source (url). It seems the file is pre-compressed, so i have taken the final .gz extension out from the url. Unfortunately, this is not working, showing "It was impossible to load the program data due to invalid settings". I wonder what I'm doing wrong. I have tested the decompressed .xml file on TVGF and it worked perfectly. Since I have not been able to make webgrab+ run with mono via Termux (i'm working in an android device), i'm running out of options. Any help would be massive.


RE: TV Guide Fullscreen - possibly the most powerful TV Guide in the world. ;) - primaeval - 2018-11-26

(2018-11-25, 22:53)M89SE Wrote: Im trying to reupload on github, yes xmltv channels with no program data.

Should be working now:
https://github.com/M89SE/script.mtvguide/blob/master/gui.py
 There are 3,914 additions. What am I supposed to be looking at?


RE: TV Guide Fullscreen - possibly the most powerful TV Guide in the world. ;) - M89SE - 2018-11-26

class ProgramListDialog(xbmcgui.WindowXMLDialog)

I would like to add the empty xmltv channels to the list. Take for example def showNow, so in source.py I manage to add them but i get them at the end of the list.

https://github.com/M89SE/script.mtvguide/pull/1/commits/8106e55b295a1821b981ad51b37958139f4b206a

python:
def getNowList(self, channel, startTime):
        return self._invokeAndBlockForResult(self._getNowList, channel, startTime)

    def _getNowList(self, channel, startTime):
        programList =
        now = datetime.datetime.now()
        endTime = startTime + datetime.timedelta(hours = 2)
        channels = self._getChannelList(True)
        channelIds = [c.id for c in channels]
        channelsWithoutProg = list(channels)
        channelMap = dict()
        for cc in channels:
            if cc.id:
                channelMap[cc.id] = cc

        c = self.conn.cursor()
        c.execute('SELECT DISTINCT p.*' + 'FROM programs p, channels c WHERE p.channel IN (\'' + ('\',\''.join(channelIds)) + '\') AND p.channel=c.id AND p.source=? AND p.end_date >= ? AND p.start_date <= ?' + 'ORDER BY c.weight', [self.source.KEY, now, now])

        for row in c:
            notification_scheduled = ''
            recording_scheduled = ''
            program = Program(channelMap[row['channel']], title=row['title'], startDate=row['start_date'], endDate=row['end_date'],
                  description=row['description'], imageLarge=row['image_large'], imageSmall=row['image_small'], categoryA=row['categoryA'], categoryB=row['categoryB'],
                  notificationScheduled=notification_scheduled, recordingScheduled=recording_scheduled)
            programList.append(program)
            try:
                channelsWithoutProg.remove(channelMap[row['channel']])
            except ValueError:
                pass
        for channel in channelsWithoutProg:
            program = Program(channel, channel.title, startTime, endTime, '', '', 'tvguide-logo-epg.png', '', '', '')
            programList.append(program)
        c.close()
        return programList

Image


RE: TV Guide Fullscreen - possibly the most powerful TV Guide in the world. ;) - primaeval - 2018-11-26

(2018-11-26, 10:20)M89SE Wrote: ...
You could use the channels list that _getChannelList gives you, as it is ORDERed by c.weight, to loop through the channels
and insert the programs in the channelsWithoutProg list into the programList in the right places.


RE: TV Guide Fullscreen - possibly the most powerful TV Guide in the world. ;) - M89SE - 2018-11-26

I'm a bit lost could you maybe show me an example of it? I'm still in the learning phase.


RE: TV Guide Fullscreen - possibly the most powerful TV Guide in the world. ;) - primaeval - 2018-11-26

(2018-11-26, 11:23)M89SE Wrote: I'm a bit lost could you maybe show me an example of it? I'm still in the learning phase.
This list of "channels" is all of them with or without programs.
https://github.com/M89SE/script.mtvguide/blob/8106e55b295a1821b981ad51b37958139f4b206a/source.py#L956
In the loop
https://github.com/M89SE/script.mtvguide/blob/8106e55b295a1821b981ad51b37958139f4b206a/source.py#L978
loop though "channels"
if the channel is in the channelsWithoutProg list
find the place in programList to "insert" a dummy program.
Finding the place will be a bit tricky.
You'll have to loop through the channels or programs and detect when there is something missing.


RE: TV Guide Fullscreen - possibly the most powerful TV Guide in the world. ;) - M89SE - 2018-11-26

Thank you for your answer I will try it out. Smile


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

I can't figure out a way to do this, is there an easier way maybe by using sort() method?


RE: TV Guide Fullscreen - possibly the most powerful TV Guide in the world. ;) - primaeval - 2018-11-27

(2018-11-27, 00:04)M89SE Wrote: I can't figure out a way to do this, is there an easier way maybe by using sort() method?
 That is the easiest way.
To use sort() you need to make a list indexed by the channel weight.
To get the weight you'll need to look up the channel in the program.
You also need to sort on start time for other list views.


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

I made a loop through channel and it's working I have the channels in order but description, startTime, endTime and logo of the channelsWithoutProg are taken from the channel above, I must have made something wrong?

python:
def _getNowList(self, channel):
        programList =
        now = datetime.datetime.now()
        startTime = datetime.datetime.now()
        endTime = startTime + datetime.timedelta(hours = 2)
        channels = self._getChannelList(True)
        channelsWithoutProg = list(channels)
        #channelIds = [c.id for c in channels]
        channelMap = dict()
        for cc in channels:
            if cc.id:
                channelMap[cc.id] = cc

        c = self.conn.cursor()
        c.execute('SELECT DISTINCT p.*' + 'FROM programs p, channels c WHERE p.channel IN (\'' + ('\',\''.join(channelMap)) + '\') AND p.channel=c.id AND p.source=? AND p.end_date >= ? AND p.start_date <= ?' + 'ORDER BY c.weight', [self.source.KEY, now, now])

        for row, channel in zip(c, channelsWithoutProg):
            notification_scheduled = ''
            recording_scheduled = ''
            program = Program(channel, title=row['title'], startDate=row['start_date'], endDate=row['end_date'],
                  description=row['description'], imageLarge=row['image_large'], imageSmall=row['image_small'], categoryA=row['categoryA'], categoryB=row['categoryB'],
                  notificationScheduled=notification_scheduled, recordingScheduled=recording_scheduled)
            programList.append(program)
            try:
                channelsWithoutProg.remove(channelMap[row['channel']])
            except ValueError:
                pass
        c.close()
        return programList



RE: TV Guide Fullscreen - possibly the most powerful TV Guide in the world. ;) - primaeval - 2018-11-27

(2018-11-27, 10:48)M89SE Wrote: I made a loop through channel and it's working I have the channels in order but description, startTime, endTime and logo of the channelsWithoutProg are taken from the channel above, I must have made something wrong?

python:
def _getNowList(self, channel):
        programList =
        now = datetime.datetime.now()
        startTime = datetime.datetime.now()
        endTime = startTime + datetime.timedelta(hours = 2)
        channels = self._getChannelList(True)
        channelsWithoutProg = list(channels)
        #channelIds = [c.id for c in channels]
        channelMap = dict()
        for cc in channels:
            if cc.id:
                channelMap[cc.id] = cc

        c = self.conn.cursor()
        c.execute('SELECT DISTINCT p.*' + 'FROM programs p, channels c WHERE p.channel IN (\'' + ('\',\''.join(channelMap)) + '\') AND p.channel=c.id AND p.source=? AND p.end_date >= ? AND p.start_date <= ?' + 'ORDER BY c.weight', [self.source.KEY, now, now])

        for row, channel in zip(c, channelsWithoutProg):
            notification_scheduled = ''
            recording_scheduled = ''
            program = Program(channel, title=row['title'], startDate=row['start_date'], endDate=row['end_date'],
                  description=row['description'], imageLarge=row['image_large'], imageSmall=row['image_small'], categoryA=row['categoryA'], categoryB=row['categoryB'],
                  notificationScheduled=notification_scheduled, recordingScheduled=recording_scheduled)
            programList.append(program)
            try:
                channelsWithoutProg.remove(channelMap[row['channel']])
            except ValueError:
                pass
        c.close()
        return programList
 Nice try for using a zip.
The channels c and channelswithoutprog are different sizes.
Use len() to see.
It's like trying to zip up one side of your jacket with your school bag.


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

Yes of course diden't think about that, so how am I supposed to use a loop if I can't combine them?

As you see my phyton knowledge is limited, my point was only to add selectItem() to the list but it became more advanced then I thought. Smile


RE: TV Guide Fullscreen - possibly the most powerful TV Guide in the world. ;) - primaeval - 2018-11-27

(2018-11-27, 12:26)M89SE Wrote: Yes of course diden't think about that, so how am I supposed to use a loop if I can't combine them?
 I said it was tricky.
Try making 2 lists of programs: the normal programList and one for the dummy programs.
Then loop through the "channels".
For each channel check which list the channel is in by looping through each list until you find the channel.
Add that into a third combined list of programs.

Or loop through the channels and insert a dummy program into programList when you find a missing channel.


RE: TV Guide Fullscreen - possibly the most powerful TV Guide in the world. ;) - doktourtv - 2018-12-03

Thank you again for this exceptional addon.

With your help in the past, I was able the get the recording feature (autoplaywith) working well. Thanks for that.

I have a small related question: Is there any way to start the recording even after the show as started rather then only through scheduling, a 'record immediately' ability. Sometimes I need to leave before the show has ended and would like to record what remains of the show I am currently watching.

Thank you


RE: TV Guide Fullscreen - possibly the most powerful TV Guide in the world. ;) - primaeval - 2018-12-03

(2018-12-03, 15:21)doktourtv Wrote: Thank you again for this exceptional addon.

With your help in the past, I was able the get the recording feature (autoplaywith) working well. Thanks for that.

I have a small related question: Is there any way to start the recording even after the show as started rather then only through scheduling, a 'record immediately' ability. Sometimes I need to leave before the show has ended and would like to record what remains of the show I am currently watching.

Thank you
 It should be number keys 8 and 9 to start and stop recording on the channel you are currently on in the epg.
It defaults to 4 hours if you don't press stop.
I've changed a few things with recording recently so make sure it works before you rely on it.