Пример #1
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
Пример #2
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
Пример #3
0
    def detectStream(self, channel, catchup=''):
        """
        @param channel:
        @type channel: source.Channel
        """

        matches = list()
        xbmc.log('CATCHUP: %s'%catchup)

# If user chooses to watch via catchup then call meta addons
        if catchup  != '':
            catchup = catchup.replace(' ','+')
            stream  = ('plugin://plugin.video.metalliq/%s' % (catchup))
            matches.append(('plugin.video.metalliq', 'Catchup', [str(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:
                    pass # ignore addons that are not installed

                for (label, stream) in self.getAddonStreams(id):
                    label = label.upper()
                    label_temp = label.replace(' ','').replace('_','').replace('HD','').replace('1','ONE').replace('2','TWO').replace('3','THREE').replace('4','FOUR').replace('5','FIVE').replace('6','SIX').replace('7','SEVEN').replace('8','EIGHT').replace('9','NINE').replace('0','ZERO').replace('SPORTS','SPORT').replace('|','').replace(':','').replace('(','').replace(')','').replace('=','')
                    if len(label_temp) > 9:
                        label_temp = label_temp.replace('CINEMA','').replace('MOVIES','')
                    channel.title = channel.title.upper().replace('_',' ')
                    channel_temp = channel.title.replace(' ','').replace('_','').replace('HD','').replace('1','ONE').replace('2','TWO').replace('3','THREE').replace('4','FOUR').replace('5','FIVE').replace('6','SIX').replace('7','SEVEN').replace('8','EIGHT').replace('9','NINE').replace('0','ZERO').replace('SPORTS','SPORT').replace('|','').replace(':','').replace('(','').replace(')','').replace('=','')
                    if len(channel_temp) > 9:
                        channel_temp = channel_temp.replace('CINEMA','').replace('MOVIES','')

# 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))
                            xbmc.log('STREAM: %s'%stream)
                    if type(stream) is list:
                        stream = stream[0]
                    if (channel_temp in label_temp) or (label_temp in channel_temp):
# Workaround for getting clean id if ini contains badly formatted items
                        if stream.startswith('plugin://') and not 'plugin.program.super.favourites' in stream:
                            idtemp = stream.split('plugin://')[1]
                            xbmc.log('idtemp: %s' % idtemp)
                            id = idtemp.split('/')[0]

 # Clean up badly formatted labels in the ini files
                        label = re.sub('[:\\/?\<>|"]', '', label)
                        label = label.strip()
                        try:
                            label = label.encode('ascii', 'ignore')
                        except:
                            try:
                                label = label.decode('utf-8').encode('ascii', 'ignore')
                            except:
                                label = label

                        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()
                    label_temp = label.replace(' ','').replace('_','').replace('HD','').replace('1','ONE').replace('2','TWO').replace('3','THREE').replace('4','FOUR').replace('5','FIVE').replace('6','SIX').replace('7','SEVEN').replace('8','EIGHT').replace('9','NINE').replace('0','ZERO').replace('SPORTS','SPORT').replace('|','').replace(':','').replace('(','').replace(')','').replace('=','')
                    if len(label_temp) > 9:
                        label_temp = label_temp.replace('CINEMA','').replace('MOVIES','')
                    
                    channel.title = channel.title.upper()
                    channel_temp = channel.title.replace(' ','').replace('_','').replace('HD','').replace('1','ONE').replace('2','TWO').replace('3','THREE').replace('4','FOUR').replace('5','FIVE').replace('6','SIX').replace('7','SEVEN').replace('8','EIGHT').replace('9','NINE').replace('0','ZERO').replace('SPORTS','SPORT').replace('|','').replace(':','').replace('(','').replace(')','').replace('=','')
                    if len(channel_temp) > 9:
                        channel_temp = channel_temp.replace('CINEMA','').replace('MOVIES','')

                    if (channel_temp in label_temp) or (label_temp in channel_temp):
                        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()
                    label_temp = label.replace(' ','').replace('_','').replace('HD','').replace('1','ONE').replace('2','TWO').replace('3','THREE').replace('4','FOUR').replace('5','FIVE').replace('6','SIX').replace('7','SEVEN').replace('8','EIGHT').replace('9','NINE').replace('0','ZERO').replace('SPORTS','SPORT').replace('|','').replace(':','').replace('(','').replace(')','').replace('=','')
                    if len(label_temp) > 9:
                        label_temp = label_temp.replace('CINEMA','').replace('MOVIES','')

                    channel.title = channel.title.upper()
                    channel_temp = channel.title.replace(' ','').replace('_','').replace('HD','').replace('1','ONE').replace('2','TWO').replace('3','THREE').replace('4','FOUR').replace('5','FIVE').replace('6','SIX').replace('7','SEVEN').replace('8','EIGHT').replace('9','NINE').replace('0','ZERO').replace('SPORTS','SPORT').replace('|','').replace(':','').replace('(','').replace(')','').replace('=','')
                    if len(channel_temp) > 9:
                        channel_temp = channel_temp.replace('CINEMA','').replace('MOVIES','')

                    if (channel_temp in label_temp) or (label_temp in channel_temp):
                        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()
                    label_temp = label.replace(' ','').replace('_','').replace('HD','').replace('1','ONE').replace('2','TWO').replace('3','THREE').replace('4','FOUR').replace('5','FIVE').replace('6','SIX').replace('7','SEVEN').replace('8','EIGHT').replace('9','NINE').replace('0','ZERO').replace('SPORTS','SPORT').replace('|','').replace(':','').replace('(','').replace(')','').replace('=','')
                    if len(label_temp) > 9:
                        label_temp = label_temp.replace('CINEMA','').replace('MOVIES','')

                    channel.title = channel.title.upper()
                    channel_temp = channel.title.replace(' ','').replace('_','').replace('HD','').replace('1','ONE').replace('2','TWO').replace('3','THREE').replace('4','FOUR').replace('5','FIVE').replace('6','SIX').replace('7','SEVEN').replace('8','EIGHT').replace('9','NINE').replace('0','ZERO').replace('SPORTS','SPORT').replace('|','').replace(':','').replace('(','').replace(')','').replace('=','')
                    if len(channel_temp) > 9:
                        channel_temp = channel_temp.replace('CINEMA','').replace('MOVIES','')

                    if (channel_temp in label_temp) or (label_temp in channel_temp):
                        matches.append((id, label, stream))
            

        xbmc.log('### matches length: %s' % len(matches))
        # if len(matches) == 1:
        #     return [matches[0][0],matches[0][1],str(matches[0][2])]
        # else:
        return matches
Пример #4
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
Пример #5
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