예제 #1
0
def GetIptvChannels():
	allCategories = common.GetChannels('categories')
	categories = GetCategories()
	channelsList = []
	for category in categories:
		if category.get('type', '') == "ignore":
			continue
		channels = common.GetChannels(category["id"]) if category["id"] != "Favourites" else common.ReadList(FAV)
		ind = -1
		for channel in channels:
			ind += 1
			if channel["type"] == 'video' or channel["type"] == 'audio':
				try:
					channelName = common.GetUnColor(channel['name'].encode("utf-8"))
					tvg_id = common.GetUnColor(channel.get("tvg", channel["name"]).encode("utf-8"))
					
					if category["id"] == "Favourites":
						gp = [x["name"] for x in allCategories if x["id"] == channel.get("group", "")]
						groupName = gp[0] if len(gp) > 0 else 'Favourites'
						channelID = ind
					else:
						groupName = category['name']
						channelID = channel['id']
							
					data = {'name': channelName, 'tvg': tvg_id, 'url': channel['url'], 'image': channel['image'], 'type': channel['type'], 'group': groupName.encode("utf-8"), 'id': channelID, 'catid': category["id"]}
					channelsList.append(data)
				except Exception, e:
					pass
예제 #2
0
def listFavorites():
    favsList = common.ReadList(FAV)
    if favsList == []:
        addDir('[COLOR red]{0}[/COLOR]'.format(
            localizedString(30202).encode('utf-8')),
               99,
               isFolder=False)
        addDir('[COLOR red]{0}[/COLOR]'.format(
            localizedString(30203).encode('utf-8')),
               99,
               isFolder=False)
    ind = -1
    for favourite in favsList:
        ind += 1
        if favourite["type"] == "ignore":
            continue
        channelTVgName = favourite.get("tvg",
                                       favourite["name"]).encode("utf-8")
        channelName = common.GetUnColor(favourite["name"].encode("utf-8"))
        image = favourite["image"].encode("utf-8")
        description = None
        background = None
        isTvGuide = False
        displayName, description, background, isTvGuide = GetProgrammeDetails(
            channelName, channelTVgName, "Favourites", progName=showProgNames)
        addDir(displayName,
               11,
               image,
               description,
               isFolder=False,
               background=background,
               isTvGuide=isTvGuide,
               categoryID="Favourites",
               index=ind)
    SetViewMode()
예제 #3
0
def GetProgrammes(epg, channelName ,full=False):
	programmes = []
	try:
		matches = [x["tvGuide"] for x in epg if x["channel"].encode('utf-8').strip() == common.GetUnColor(channelName)]
		programmes = matches[0]
	except Exception, e:
		pass
예제 #4
0
def GetIptvChannels():
    allCategories = common.GetChannels('categories')
    categories = GetCategories()
    channelsList = []
    for category in categories:
        if category.get('type', '') == "ignore":
            continue
        channels = common.GetChannels(
            category["id"]
        ) if category["id"] != "Favourites" else common.ReadList(
            os.path.join(user_dataDir, 'favorites.txt'))
        for channel in channels:
            if channel["type"] == 'video' or channel["type"] == 'audio':
                try:
                    channelName = common.GetUnColor(
                        channel['name'].encode("utf-8"))

                    if category["id"] == "Favourites":
                        gp = [
                            x["name"] for x in allCategories
                            if x["id"] == channel.get("group", "")
                        ]
                        groupName = gp[0] if len(gp) > 0 else 'Favourites'
                    else:
                        groupName = category['name']

                    data = {
                        'name': channelName,
                        'url': channel['url'],
                        'image': channel['image'],
                        'type': channel['type'],
                        'group': groupName.encode("utf-8")
                    }
                    channelsList.append(data)
                except Exception, e:
                    pass