Kodi Community Forum

Full Version: m-TVGuide
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2 3 4 5 6 7 8 9 10 11 12 13 14
maybe i can take a look on original tvgf

here for settings
 <setting id="channel.filter.sort" label="Sort Order for Channels in Categories" type="enum" default="0" values="Default|Sorted|categories.ini"/>

and it should be like this in source.py (from tvgf)
python:
    def _getChannelList(self, onlyVisible, all=False):
        c = self.conn.cursor()
        channelList = list()
        if onlyVisible:
            c.execute('SELECT * FROM channels WHERE source=? AND visible=? ORDER BY weight', [self.source.KEY, 1])
        else:
            c.execute('SELECT * FROM channels WHERE source=? ORDER BY weight', [self.source.KEY])
        for row in c:
            channel = Channel(row['id'], row['title'], row['lineup'], row['logo'], row['stream_url'], row['visible'], row['weight'])
            channelList.append(channel)

        if all == False and self.category and self.category != "Any":
            f = xbmcvfs.File('special://profile/addon_data/script.kc.guide/categories.ini','rb')
            lines = f.read().splitlines()
            f.close()
            filter = []
            seen = set()
            for line in lines:
                if "=" not in line:
                    continue
                name,cat = line.split('=')
                if cat == self.category:
                    if name not in seen:
                        filter.append(name)
                    seen.add(name)

            NONE = "0"
            SORT = "1"
            CATEGORIES = "2"
            new_channels = []
            if ADDON.getSetting('channel.filter.sort') == CATEGORIES:
                for filter_name in filter:
                    for channel in channelList:
                        if channel.title == filter_name:
                            new_channels.append(channel)
                if new_channels:
                    channelList = new_channels
            else:
                for channel in channelList:
                    if channel.title in filter:
                        new_channels.append(channel)
                if new_channels:
                    if ADDON.getSetting('channel.filter.sort') == SORT:
                        channelList = sorted(new_channels, key=lambda channel: channel.title.lower())
                    else:
                        channelList = new_channels
        elif ADDON.getSetting('channel.filter.sort.all') == 'true':
            channelList = sorted(channelList, key=lambda channel: channel.title.lower())
        c.close()
        return channelList
Ok, I will take a look on it tomorrow, seems pretty straightforward.
(2021-11-01, 00:38)M89SE Wrote: [ -> ]Ok, I will take a look on it tomorrow, seems pretty straightforward.

thank you...have a good nigth
Hello Again!

I've been playing a little bit more (unfortunately I haven't had a lot of time). And I've come across another question.
In one of the earlier threads you mentioned:

Multiple stream sources are switched while playing stream by pressing C / Context button.

However, I'm finding that if the streams are from addons - I can only add one.  For example, I am using live streams from two different Pluto TV addons. In the guide, when I go to add stream and I select the stream from one of the addons, there is no way for me to go and add the other as an "alternate stream" that I can find.  The "Add stream" option has now changed to "Remove Stream"  Is there a way to do this?  In TV Guide Full Screen, I had some channels setup with a stream from an addon as "primary" and then a stream from favorites and an M3U list as "alternates".  Is there a way to do this that I haven't found?  

And that leads to my second question. With the "sources are switched while playing stream" - what happens if one of the streams is down? I'd never be able to switch to the other stream by pressing the context button if the first one doesn't play.  If there is a way to add alternate streams, would it be possible to be able to select which stream one wants when hitting the channel in the guide? This is how I had things setup in TV Guide Full Screen.

Thanks for your time.  This is the first chance I've had to come back to this in about a month and the updates you've made in that time are fantastic!
@mastertheshadow Adding multiple streams from add-ons is not possible, only you can only add one stream to each channel. You could add a second playlist M3U with backup streams, m-TVGuide supports up to 5 different playlists to be loaded.

If a stream is broken then the add-on will automatically switch to next working one. See video section for more information.
https://github.com/Mariusz89B/script.mtv...Wiki#video
(2021-11-01, 09:00)M89SE Wrote: [ -> ]@mastertheshadow Adding multiple streams from add-ons is not possible, only you can only add one stream to each channel. You could add a second playlist M3U with backup streams, m-TVGuide supports up to 5 different playlists to be loaded.

If a stream is broken then the add-on will automatically switch to next working one. See video section for more information.
https://github.com/Mariusz89B/script.mtv...Wiki#video
Gotcha. Would you be able to tell me what the source.db table entry would look like for a channel with multiple playlist sources? I maintain a number of my playlists manually (and I think I know a workaround to populate some of these streams to a new playlist) so for those channels that m-TVGuide cannot automatch it may be easier/faster for me to import the tables into source.db via a csv import in SQL Light db view. 

Is it simply a new record for the channel in the db - so that for example a channel named "Pluto TV Drama" with 2 streams then there would be two records for each "Pluto TV Drama"? 1for each stream? And then, would that have to be with the CID reference to the playlist?
@mastertheshadow Good question, I'm not sure though m-TVGuide assigns a uniqe CID automatically for each item and matches it with EPG. I haven't played around with adding multiple streams manually via the source.db. But hey give it a try! Smile
(2021-11-01, 09:41)M89SE Wrote: [ -> ]@mastertheshadow Good question, I'm not sure though m-TVGuide assigns a uniqe CID automatically for each item and matches it with EPG. I haven't played around with adding multiple streams manually via the source.db. But hey give it a try! Smile

I shall do some more playing (though it may have to wait until I finish grading term papers or my students will start to hunt me down 😂). From my initial tests looking at the custom stream url table, the CID appears to mostly follow the order of channels in the playlist starting at cid=0 and then moving up incrementally if I remember correctly but I'm going to have to do some more testing - I have one EPG and Playlist generated by the IPTVMerge addon and there are some oddities somewhere because by the end of that playlist the cid in the dd from those channels that have been able to automatch  is off by 3 when counting entries in the playlist.

SInce m-TVGuide can't automatch all streams by epgid or alternate name (likely due to the way these files are generated - some IDs are 30+ characters long and some channels share the same name with different IDs because they are different streams) and I can't manually match on the guide because of the name issue - I can't find where the cid discrepancy is happening.

Of course ...everything I try to do is overly complicated (at least according to my spouse 😂) so once I can get past the group of students wanting grades I'll run some simplified test cases and see what I can come up with.

As always thanks for your help!
@mastertheshadow Yes, CID is assigned in order.

@Kangool Ok, I have a working test version with channel sorting, but I can't figure out if I select sorting by category for added groups (categories.ini), then how should the main list (All channels) be sorted or should it stay the same?
script.mtvguide-9.7.4_alpha_v1.zip
(2021-11-01, 10:08)M89SE Wrote: [ -> ]@mastertheshadow Yes, CID is assigned in order.

@Kangool Ok, I have a working test version with channel sorting, but I can't figure out if I select sorting by category for added groups (categories.ini), then how should the main list (All channels) be sorted or should it stay the same?
script.mtvguide-9.7.4_alpha_v1.zip

if it is sorted by groups the main list sorting doesnt matter
if you sort the main list like the list in categories.ini than categories are automatic sorted like in the ini....cuz at the moment (previos versions) categories was sorted by the main list.

example main list in previos versions:
1 orf 1
2 orf 2
3 orf 3

shows in categaories AT/CH (in my case for austria/switzerland)
the same

if sort of main list is changed cuz of reset (like change timezone or whatever) and sort is now like the epg.xml
1 atv
2 srf 1
3 srf info

than i have showing also the same list in my categories 

i try now the new version
big thanks that you try to slove this sorting problem for us
First thanks for the alpha build, for "All channels" i think it could stay as it is, it doesn't need sorting in my eyes.
ITS PERFEKT NOW EXACTLY THAT WHAT WE NEED
THE CATEGORIES ALL SORTED LIKE IN THE INI
BIG BIG THANKS
Super! I will add the changes to release version.
(2021-11-01, 11:30)M89SE Wrote: [ -> ]Super! I will add the changes to release version.

perfect job done my friend
Here is the latest version with fixes how the add-on handles tvg-id in M3U playlists, also available in repo.
https://github.com/Mariusz89B/script.mtv.../tag/9.7.8
Pages: 1 2 3 4 5 6 7 8 9 10 11 12 13 14