示例#1
0
    def detectStream(self, channel):
        """
        @param channel:
        @type channel: source.Channel
        """

        matches = list()

        # Get any Super Favourites with channel name
        superFaves = self.locateSuperFavourites(channel.title)

        if superFaves:
            if len(superFaves) == 1:
                matches.append((superFaves[0][0], "Super Folder", superFaves[0][1]))
            else:
                index = 0
                for superFave in superFaves:
                    index += 1
                    label = "Super Folder (%d)" % index
                    matches.append((superFave[0], label, superFave[1]))

        # Get any Add-ons with channel name
        for id in self.getAddons():
            try:
                xbmcaddon.Addon(id)
            except Exception:
                continue  # ignore addons that are not installed

            for (label, stream) in self.getAddonStreams(id):
                label = label.upper()
                channel.title = channel.title.upper()

                if (channel.title in label) or (label in channel.title):
                    matches.append((id, label, stream))

        # Get any Kodi Favourites with channel name
        kodiFaves = self.loadFavourites()

        if kodiFaves:
            id = "kodi-favourite"

            for (label, stream) in kodiFaves:
                label = label.upper()
                channel.title = channel.title.upper()

                if (channel.title in label) or (label in channel.title):
                    matches.append((id, label, stream))

        # Get any Playlist entries with channel name
        iptvPlaylist = self.loadPlaylist()

        if iptvPlaylist:
            id = "iptv-playlist"

            for (label, stream) in iptvPlaylist:
                label = label.upper()
                channel.title = channel.title.upper()

                if (channel.title in label) or (label in channel.title):
                    matches.append((id, label, stream))

        # Get entries from PVRchannels with channel name
        import pvr

        PVRchannels = pvr.getPVRChannels()

        if PVRchannels:
            id = "xbmc.pvr"

            for (label, stream) in PVRchannels:
                label = label.upper()
                channel.title = channel.title.upper()

                if (channel.title in label) or (label in channel.title):
                    matches.append((id, label, stream))

        if len(matches) == 1:
            return matches[0][2]
        else:
            return matches
示例#2
0
    def detectStream(self, channel, catchup=''):
        """
        @param channel:
        @type channel: source.Channel
        """

        matches = list()
        catchuplist = ['plugin.video.meta','plugin.video.metalliq']
        dixie.log('CATCHUP: %s'%catchup)

# If user chooses to watch via catchup then call meta addons
        if catchup != '':
            for item in catchuplist:
                try:
                    xbmcaddon.Addon(item)
                except Exception:
                    continue # ignore addons that are not installed
                catchup = catchup.replace(' ','+')
                for (label, stream) in self.getAddonStreams(item):
                    stream = str(stream.replace("<channel>",catchup))
                    addontitle = xbmcaddon.Addon(id=item).getAddonInfo('name')
                matches.append((item, addontitle, stream))

# For a live tv selection grab valid ini files and present options
        else:

# Get any Super Favourites with channel name
            superFaves = self.locateSuperFavourites(channel.id)
            xbmc.log('### SF: %s' % superFaves)
            
            if superFaves:
                if len(superFaves) == 1 and not '-metalliq' in superFaves[0][0]:
                    matches.append((superFaves[0][0], 'Social Share', superFaves[0][1]))
                elif len(superFaves) == 1 and '-metalliq' in superFaves[0][0] and SF_METALLIQ == 'true':
                    matches.append((superFaves[0][0], 'MetalliQ', superFaves[0][1]))
                else:
                    index = 0
                    for superFave in superFaves:
                        if '-metalliq' in superFave[0] and SF_METALLIQ == 'true':
                            label = 'MetalliQ'
                            matches.append((superFave[0], label, superFave[1]))        
                        elif not '-metalliq' in superFave[0]:
                            if len(superFaves) == 2 and ('-metalliq' in superFaves[0][0] or '-metalliq' in superFaves[1][0]):
                                label = 'Social Share'
                            else:
                                index += 1
                                label = 'Social Share (%d)' % index
                            matches.append((superFave[0], label, superFave[1]))        

# Get any Add-ons with channel name
            for id in self.getAddons():
                try:
                    xbmcaddon.Addon(id)
                except Exception:
                    continue # ignore addons that are not installed

                for (label, stream) in self.getAddonStreams(id):
                    label = label.upper()
                    channel.title = channel.title.upper().replace('_',' ')

# If meta is chosen we clean the name up a bit more
                    if SF_METALLIQ == 'false':
                        if id == "plugin.video.metalliq" or id == "plugin.video.meta":
                            label = channel.title
                            chanx  = channel.title.replace(" ","+").replace("_","+")
                            if chanx.endswith("%20HDTV"):
                                chanx = chanx.replace("%20HDTV","")
                            if chanx.endswith("%20HD"):
                                chanx = chanx.replace("%20HD","")
                            if chanx.endswith("%20PLUS1"):
                                chanx = chanx.replace("%20PLUS1","")
                            stream = str(stream.replace("<channel>",'live/%s/None/en'% chanx))
                            dixie.log('STREAM: %s'%stream)
                   
                    if (channel.title in label) or (label in channel.title):
                        matches.append((id, label, stream))
        
# Get any Kodi Favourites with channel name
            kodiFaves = self.loadFavourites()
            
            if kodiFaves:
                id = 'kodi-favourite'
                
                for (label, stream) in kodiFaves:
                    label = label.upper()
                    channel.title = channel.title.upper()

                    if (channel.title in label) or (label in channel.title):
                        matches.append((id, label, stream))
                    
# Get any Playlist entries with channel name
            iptvPlaylist = self.loadPlaylist()
            
            if iptvPlaylist:
                id = 'iptv-playlist'
            
                for (label, stream) in iptvPlaylist:
                    label = label.upper()
                    channel.title = channel.title.upper()

                    if (channel.title in label) or (label in channel.title):
                        matches.append((id, label, stream))

# Get entries from PVRchannels with channel name    
            import pvr
            PVRchannels = pvr.getPVRChannels()
            
            if PVRchannels:
                id = 'xbmc.pvr'
                
                for (label, stream) in PVRchannels:
                    label = label.upper()
                    channel.title = channel.title.upper()

                    if (channel.title in label) or (label in channel.title):
                        matches.append((id, label, stream))
            

        if len(matches) == 1:
            return matches[0][2]
        else:
            return matches
示例#3
0
    def detectStream(self, channel, catchup=""):
        """
        @param channel:
        @type channel: source.Channel
        """

        matches = list()
        catchuplist = ["plugin.video.meta", "plugin.video.metalliq"]
        dixie.log("CATCHUP: %s" % catchup)

        # If user chooses to watch via catchup then call meta addons
        if catchup != "":
            for item in catchuplist:
                try:
                    xbmcaddon.Addon(item)
                except Exception:
                    continue  # ignore addons that are not installed
                catchup = catchup.replace(" ", "+")
                for (label, stream) in self.getAddonStreams(item):
                    stream = str(stream.replace("<channel>", catchup))
                    addontitle = xbmcaddon.Addon(id=item).getAddonInfo("name")
                matches.append((item, addontitle, stream))

        # For a live tv selection grab valid ini files and present options
        else:

            # Get any Super Favourites with channel name
            superFaves = self.locateSuperFavourites(channel.id)
            xbmc.log("### SF: %s" % superFaves)

            if superFaves:
                if len(superFaves) == 1 and not "-metalliq" in superFaves[0][0]:
                    matches.append((superFaves[0][0], "Super Folder", superFaves[0][1]))
                elif len(superFaves) == 1 and "-metalliq" in superFaves[0][0] and SF_METALLIQ == "true":
                    matches.append((superFaves[0][0], "MetalliQ", superFaves[0][1]))
                else:
                    index = 0
                    for superFave in superFaves:
                        if "-metalliq" in superFave[0] and SF_METALLIQ == "true":
                            label = "MetalliQ"
                            matches.append((superFave[0], label, superFave[1]))
                        elif not "-metalliq" in superFave[0]:
                            if len(superFaves) == 2 and (
                                "-metalliq" in superFaves[0][0] or "-metalliq" in superFaves[1][0]
                            ):
                                label = "Super Folder"
                            else:
                                index += 1
                                label = "Super Folder (%d)" % index
                            matches.append((superFave[0], label, superFave[1]))

            # Get any Add-ons with channel name
            for id in self.getAddons():
                try:
                    xbmcaddon.Addon(id)
                except Exception:
                    continue  # ignore addons that are not installed

                for (label, stream) in self.getAddonStreams(id):
                    label = label.upper()
                    channel.title = channel.title.upper().replace("_", " ")

                    # If meta is chosen we clean the name up a bit more
                    if SF_METALLIQ == "false":
                        if id == "plugin.video.metalliq" or id == "plugin.video.meta":
                            label = channel.title
                            chanx = channel.title.replace(" ", "+").replace("_", "+")
                            if chanx.endswith("%20HDTV"):
                                chanx = chanx.replace("%20HDTV", "")
                            if chanx.endswith("%20HD"):
                                chanx = chanx.replace("%20HD", "")
                            if chanx.endswith("%20PLUS1"):
                                chanx = chanx.replace("%20PLUS1", "")
                            stream = str(stream.replace("<channel>", "live/%s/None/en" % chanx))
                            dixie.log("STREAM: %s" % stream)

                    if (channel.title in label) or (label in channel.title):
                        matches.append((id, label, stream))

            # Get any Kodi Favourites with channel name
            kodiFaves = self.loadFavourites()

            if kodiFaves:
                id = "kodi-favourite"

                for (label, stream) in kodiFaves:
                    label = label.upper()
                    channel.title = channel.title.upper()

                    if (channel.title in label) or (label in channel.title):
                        matches.append((id, label, stream))

            # Get any Playlist entries with channel name
            iptvPlaylist = self.loadPlaylist()

            if iptvPlaylist:
                id = "iptv-playlist"

                for (label, stream) in iptvPlaylist:
                    label = label.upper()
                    channel.title = channel.title.upper()

                    if (channel.title in label) or (label in channel.title):
                        matches.append((id, label, stream))

            # Get entries from PVRchannels with channel name
            import pvr

            PVRchannels = pvr.getPVRChannels()

            if PVRchannels:
                id = "xbmc.pvr"

                for (label, stream) in PVRchannels:
                    label = label.upper()
                    channel.title = channel.title.upper()

                    if (channel.title in label) or (label in channel.title):
                        matches.append((id, label, stream))

        if len(matches) == 1:
            return matches[0][2]
        else:
            return matches