Пример #1
0
def AddFavorites(url, iconimage, name):
    favList = common.ReadList(favoritesFile)
    for item in favList:
        if item["url"][::-1].decode('base64').replace("83eT", "Ppbi").replace(
                "5ePP", "0ZWJ").decode('base64').replace(
                    "7RnT", "6Fqn").lower() == url.decode("utf-8").lower():
            xbmc.executebuiltin(
                "Notification({0}, '{1}' {2}, 5000, {3})".format(
                    AddonName, name, getLocaleString(30011), icon))
            return
    chList = common.ReadList(tmpListFile)
    for channel in chList:
        if channel["name"].lower() == name.decode("utf-8").lower():
            url = channel["url"].encode("utf-8")
            iconimage = channel["image"].encode("utf-8")
            break
    if not iconimage:
        iconimage = ""
    data = {
        "url": url.decode("utf-8"),
        "image": iconimage.decode("utf-8"),
        "name": name.decode("utf-8")
    }
    favList.append(data)
    common.SaveList(favoritesFile, favList)
    xbmc.executebuiltin("Notification({0}, '{1}' {2}, 5000, {3})".format(
        AddonName, name, getLocaleString(30012), icon))
Пример #2
0
def RemoveSelectedFavorties():
    allCategories = common.ReadList(categoriesFile)
    channels = common.ReadList(FAV)
    channelsNames = []
    for channel in channels:
        gp = [
            x["name"] for x in allCategories
            if x["id"] == channel.get("group", "")
        ]
        groupName = gp[0] if len(gp) > 0 else 'Favourites'
        channelsNames.append(
            u"[COLOR {0}][B]{1}[/B][/COLOR] [COLOR {2}][B][{3}][/B][/COLOR]".
            format(Addon.getSetting("chColor"), channel["name"],
                   Addon.getSetting("catColor"), groupName))
    selected = common.GetMultiChoiceSelected(
        localizedString(30209).encode('utf-8'), channelsNames)
    if len(selected) < 1:
        return
    xbmc.executebuiltin(
        'Notification({0}, Start removing channels from favourites, {1}, {2})'.
        format(AddonName, 5000, icon))
    removeFavorties(selected)
    common.MakeCatGuide(fullGuideFile, "Favourites")
    xbmc.executebuiltin(
        'Notification({0}, Channels removed trom favourites, {1}, {2})'.format(
            AddonName, 5000, __icon__))
Пример #3
0
def addFavorites(listIndex):
    item = common.ReadList(tmpList)[listIndex]
    dirs = common.ReadList(FAV)
    for favItem in dirs:
        if favItem["url"] == item["url"].replace("[COLOR yellow][B]",
                                                 "").replace(
                                                     "[/B][/COLOR]", ""):
            xbmc.executebuiltin(
                'Notification({0}, [COLOR {1}][B]{2}[/B][/COLOR] Already in  favorites, {3}, {4})'
                .format(AddonName, Addon.getSetting("chColor"),
                        item["name"].decode("utf-8"), 5000, __icon2__))
            return

    if item["image"] is None:
        item["image"] = ""

    name = item["name"].encode("utf-8")

    data = {
        "url": item["url"],
        "image": item["image"],
        "name": name.decode("utf-8"),
        "type": item["type"]
    }
    dirs.append(data)
    common.WriteList(FAV, dirs)
    xbmc.executebuiltin(
        'Notification({0}, [COLOR {1}][B]{2}[/B][/COLOR] added to favorites, {3}, {4})'
        .format(AddonName, Addon.getSetting("chColor"), name, 5000, __icon__))
Пример #4
0
def addFavorites(url, iconimage, name):
    dirs = common.ReadList(FAV)
    #print dirs
    for item in dirs:
        if item["url"].lower() == url.lower():
            xbmc.executebuiltin('Notification(%s, %s, %d, %s)' %
                                ('ISRALIVE', name + "  Already in  favorites",
                                 5000, __icon2__))
            return

    list = common.ReadList(tmpList)
    for item in list:
        #if urllib.unquote_plus(item["name"].lower()) == name.lower():
        if item["name"].encode("utf-8").lower() == name.lower():
            url = item["url"]
            iconimage = item["image"]
            type = item["type"]
    if not iconimage:
        iconimage = ""
    data = {"url": url, "image": iconimage, "name": name, "type": type}
    dirs.append(data)
    with open(FAV, 'w') as outfile:
        json.dump(dirs, outfile)
    outfile.close()
    xbmc.executebuiltin(
        'Notification(%s, %s, %d, %s)' %
        ('ISRALIVE', name + "  added to favorites", 5000, __icon__))
Пример #5
0
def Categories():
    '''
    Actions menu items.
    '''
    AddDir("[B]{0}: {1}[/B] - {2} ".format(
        getLocaleString(30036),
        getLocaleString(30037) if makeGroups else getLocaleString(30038),
        getLocaleString(30039)),
           "setting",
           50,
           os.path.join(iconsDir, "setting.png"),
           isFolder=False)
    AddDir("[COLOR white][B][{0}][/B][/COLOR]".format(getLocaleString(30003)),
           "favorites", 30, os.path.join(iconsDir, "bright_yellow_star.png"))
    AddDir("[COLOR yellow][B]{0}[/B][/COLOR]".format(getLocaleString(30001)),
           "newList",
           20,
           os.path.join(iconsDir, "NewList.ico"),
           isFolder=False)
    AddDir("[COLOR yellow][B]{0}[/B][/COLOR]".format(getLocaleString(30040)),
           "newDirectory",
           43,
           os.path.join(iconsDir, "New-folder.png"),
           isFolder=False)
    '''
    Contents
    '''
    # Displaying virtual directories.
    vDirs = common.ReadList(vDirectoriesFile)
    y = 0
    for vDir in vDirs:
        dir_icon = vDir["icon"] if not vDir["icon"] is "" else os.path.join(
            iconsDir, "default-folder-image.png")
        AddDir("[COLOR green][B]{0}[/B][/COLOR]".format(vDir["name"]),
               "{0}".format(y),
               44,
               dir_icon,
               uuid=vDir["uuid"],
               isFolder=True)
        y += 1

    ignored = []
    for vdir in vDirs:
        if len(vdir["data"]) > 0:
            ignored += vdir["data"]

    i = 0
    chList = common.ReadList(playlistsFile)
    addList = []
    try:
        for uitem in chList:
            if "uuid" in uitem and not uitem["uuid"] in ignored:
                addList.append(chList[i])
            i += 1
    except:
        addList = chList

    AddListItems(addList)
Пример #6
0
def Update():
    # Update channels-lists files
    common.UpdateChList(forceUpdate=False)

    # Update EPG files for selected LiveTV channels first
    isGuideUpdated = False
    if Addon.getSetting("useEPG") == "true":
        epg = common.ReadList(fullGuideFile)
        if len(epg) > 0:
            isGuideUpdated = True
            fullCategoriesList = []
            selectedCategoriesList = []
            categoriesList = []
            iptvList = Addon.getSetting("iptvList")
            if iptvList == "0":  # Favourites
                categoriesList = [{"id": "Favourites"}]
            elif iptvList == "1":  # No filter
                categoriesList = fullCategoriesList = common.ReadList(
                    os.path.join(user_dataDir, "lists", "categories.list"))
            elif iptvList == "2":  # Selected categories
                categoriesList = selectedCategoriesList = common.ReadList(
                    os.path.join(user_dataDir, "lists",
                                 "selectedCategories.list"))
            common.MakeCatGuides(categoriesList, epg)

    useIPTV = common.getUseIPTV()
    # Update LiveTV channels and EPG
    if useIPTV:
        import myIPTV
        myIPTV.makeIPTVlist(iptvChannelsFile)
        myIPTV.MakeChannelsGuide(fullGuideFile, iptvGuideFile)
        myIPTV.RefreshPVR(iptvChannelsFile, iptvGuideFile, iptvLogosDir)

    # Update EPG files for non-selected LiveTV channels
    if isGuideUpdated:
        if fullCategoriesList == []:
            fullCategoriesList = common.ReadList(
                os.path.join(user_dataDir, "lists", "categories.list"))
        if iptvList == "0":  # Favourites
            categoriesList = fullCategoriesList
        elif iptvList == "1":  # No filter
            categoriesList = [{"id": "Favourites"}]
        elif iptvList == "2":  # Selected categories
            categoriesList = common.GetUnSelectedList(fullCategoriesList,
                                                      selectedCategoriesList)
            categoriesList.append({"id": "Favourites"})

        common.MakeCatGuides(categoriesList, epg)

    # Update channels-logos files
    if useIPTV and myIPTV.GetIptvType() < 2:
        myIPTV.SaveChannelsLogos(iptvLogosDir)

    checkInterval = 720  # 12 hours = 720 minutes
    xbmc.executebuiltin(
        "XBMC.AlarmClock({0},XBMC.RunPlugin(plugin://plugin.video.israelive/default.py?mode=100&url=checkUpdates),{1},silent)"
        .format("IsraeLiveUpdates", checkInterval))
Пример #7
0
def AddCategories():
	if not os.path.isfile(categoriesFile):
		common.UpdateChList()
	allCatList = common.ReadList(categoriesFile)
	selectedCatList = common.ReadList(selectedCategoriesFile)
	categories = common.GetUnSelectedList(allCatList, selectedCatList)
	categoriesNames = [u"[COLOR {0}][B][{1}][/B][/COLOR]".format(Addon.getSetting("catColor"), item["name"]) for item in categories]
	selected = common.GetMultiChoiceSelected(localizedString(30503).encode('utf-8'), categoriesNames)
	if len(selected) < 1:
		return
	selectedList = [categories[item] for item in selected]
	common.WriteList(selectedCategoriesFile, selectedCatList + selectedList)
Пример #8
0
def SaveGuide():
    try:
        epg = common.ReadList(fullGuideFile)
        if len(epg) > 0:
            fullCategoriesList = common.ReadList(categoriesFile)
            fullCategoriesList.append({"id": "Favourites"})
            common.MakeCatGuides(fullCategoriesList, epg)
        return True
    except Exception as ex:
        xbmc.log("{0}".format(ex), 3)
        xbmc.executebuiltin(
            "XBMC.Notification({0}, Guide NOT saved!, {1}, {2})".format(
                AddonName, 5000, icon))
        return False
Пример #9
0
def AddUserChannelToFavorites():
	chName = common.GetKeyboardText(localizedString(30225).encode('utf-8')).strip()
	if len(chName) < 1:
		return
	chUrl = common.GetKeyboardText(localizedString(30226).encode('utf-8')).strip()
	if len(chUrl) < 1:
		return
	
	if not os.path.isfile(categoriesFile):
		common.UpdateChList()
	categories = common.ReadList(categoriesFile)
	categoriesNames = [u"[COLOR {0}][B][{1}][/B][/COLOR]".format(Addon.getSetting("catColor"), item["name"]) for item in categories]
	categoryInd = common.GetMenuSelected(localizedString(30227).encode('utf-8'), categoriesNames)
	if categoryInd == -1:
		return
	group = categories[categoryInd]["id"]
	chTypeInd = common.GetMenuSelected(localizedString(30232).encode('utf-8'), [localizedString(30233).encode('utf-8'), localizedString(30234).encode('utf-8')])
	if chTypeInd == 0:
		chType = "video"
	elif chTypeInd == 1: 
		chType = "audio"
	else:
		return
	logoInd = common.GetMenuSelected(localizedString(30228).encode('utf-8'), [localizedString(30229).encode('utf-8'), localizedString(30230).encode('utf-8'), localizedString(30231).encode('utf-8')])
	if logoInd == 0:
		logoFile = common.GetKeyboardText(localizedString(30229).encode('utf-8')).strip()
		if len(logoFile) < 1:
			return
	elif logoInd == 1:
		logoFile = xbmcgui.Dialog().browse(2, localizedString(30230).encode('utf-8'), 'myprograms')
		if logoFile is None or len(logoFile) < 1:
			return
	elif logoInd == 2:
		logoFile = ""
	else:
		return
		
	favsList = common.ReadList(FAV)
	for channel in favsList:
		if channel["url"].lower() == chUrl.lower():
			xbmc.executebuiltin('Notification({0}, [COLOR {1}][B]{2}[/B][/COLOR]  Already in favourites, {3}, {4})'.format(AddonName, Addon.getSetting("chColor"), chName, 5000, __icon2__))
			return
		
	data = {"url": chUrl.decode("utf-8"), "group": group, "image": logoFile.decode("utf-8"), "type": chType, "name": chName.decode("utf-8")}
	
	favsList.append(data)
	if common.WriteList(FAV, favsList):
		xbmc.executebuiltin('Notification({0}, [COLOR {1}][B]{2}[/B][/COLOR]  added to favourites, {3}, {4})'.format(AddonName, Addon.getSetting("chColor"), chName, 5000, __icon__))
Пример #10
0
def CheckUA():
    response = None
    try:
        remoteSettings = common.ReadList(remoteSettingsFile)
        if remoteSettings == []:
            return False
        urls = common.GetSubKeyValue(remoteSettings, "UA", "urls")
        if urls is None or len(urls) == 0:
            return False

        random.seed()
        random.shuffle(UAs)

        #text = OpenURL(common.Decode('sefm0Z97eL-1e9ag0NezeMk='), user_agent=UAs[0])
        #country = text.split(';')
        #if country[0] == '1' and country[2].upper() == 'ISR':
        #	print "------- From Israel! ----------"
        #else:
        #	print '------- Come to Israel -----------'

        random.shuffle(urls)
        req = urllib2.Request(common.Decode(urls[0]))
        req.add_header('User-Agent', UAs[0])
        response = urllib2.urlopen(req)
        response.read()
        response.close()
    except Exception as ex:
        #print ex
        if not response is None:
            response.close()
Пример #11
0
def AddNewFavortie():
    chName = GetKeyboardText("{0}".format(
        localizedString(10014).encode('utf-8'))).strip()
    if len(chName) < 1:
        return
    chUrl = GetKeyboardText("{0}".format(
        localizedString(10015).encode('utf-8'))).strip()
    if len(chUrl) < 1:
        return

    favList = common.ReadList(favoritesFile)
    for item in favList:
        if item["url"].lower() == url.lower():
            xbmc.executebuiltin(
                "Notification({0}, '{1}' {2}, 5000, {3})".format(
                    AddonName, chName,
                    localizedString(10011).encode('utf-8'), icon))
            return

    data = {"url": chUrl, "image": "", "name": chName.decode("utf-8")}

    favList.append(data)
    if common.SaveList(favoritesFile, favList):
        xbmc.executebuiltin(
            "XBMC.Container.Update('plugin://{0}?mode=30&url=favorites')".
            format(AddonID))
Пример #12
0
def Categories():
    Playdp = str(len(PlaylistUrl))
    url = base64.decodestring(localisedTranslate)
    AddDir("[COLOR white][B] CLICK HERE TO UPDATE AAA STREAM[/B][/COLOR]",
           "Update", 50,
           os.path.join(addonDir, "resources", "images", "update-icon.png"))
    AddDir(
        "[COLOR white][B] YOUR FAVOURITE CHANNELS HERE[/B][/COLOR]",
        "favorites", 30,
        os.path.join(
            "http://www.iconarchive.com/download/i6066/custom-icon-design/pretty-office-3/add-to-favorites.ico"
        ))
    AddDir("[COLOR yellow][B] AAASTREAM MOVIES[/B][/COLOR]", 'movies', 44,
           "http://s5.postimg.org/ycy0pxt9j/appmovies.jpg")
    AddDir("[COLOR yellow][B] AAASTREAM TV SHOWS[/B] (SOON)[/COLOR]", 'TV', 0,
           "http://s5.postimg.org/ycy0pxt9j/appmovies.jpg")
    AddDir("[COLOR yellow]This is Version 1.9.1[/COLOR]", "Update", 99,
           "http://s5.postimg.org/9469649rb/appgraphic.jpg")

    playlistsFile = os.path.join(addonDir, "playLists.txt")
    DownloaderClass(url, playlistsFile)

    list = common.ReadList(playlistsFile)
    for item in list:
        mode = int(Playdp) + 26 if item["url"].find("youtube") > 0 else 2
        name = common.GetEncodeString(item["name"])
        AddDir("[COLOR blue]{0}[/COLOR]".format(name), item["url"], mode,
               "http://s5.postimg.org/9469649rb/appgraphic.jpg")
Пример #13
0
def removeFavorties(url):
    dirs = common.ReadList(FAV)
    for item in dirs:
        if item["url"].lower() == url.lower():
            dirs.remove(item)
            common.WriteList(FAV, dirs)
            xbmc.executebuiltin("XBMC.Container.Refresh()")
Пример #14
0
def AddNewFavorite():
    chName = GetKeyboardText(getLocaleString(10014))
    if len(chName) < 1:
        return
    chUrl = GetKeyboardText(getLocaleString(10015))
    if len(chUrl) < 1:
        return
    image = GetChoice(10023, 10023, 10023, 10024, 10025, 10021, fileType=2)

    favList = common.ReadList(favoritesFile)
    for item in favList:
        if item["url"].lower() == chUrl.decode("utf-8").lower():
            xbmc.executebuiltin(
                "Notification({0}, '{1}' {2}, 5000, {3})".format(
                    AddonName, chName, getLocaleString(10011), icon))
            return

    data = {
        "url": chUrl.decode("utf-8"),
        "image": image,
        "name": chName.decode("utf-8")
    }

    favList.append(data)
    if common.SaveList(favoritesFile, favList):
        xbmc.executebuiltin("XBMC.Container.Refresh()")
Пример #15
0
def AddCategoryToFavorites(categoryID):
    allCatList = common.ReadList(categoriesFile)
    category = [
        u"[COLOR {0}][B][{1}][/B][/COLOR]".format(Addon.getSetting("catColor"),
                                                  item["name"])
        for item in allCatList if item['id'] == categoryID
    ]
    channels = common.GetChannels(categoryID)
    if not common.YesNoDialog(localizedString(30210).encode('utf-8'),
                              localizedString(30221).encode('utf-8'),
                              localizedString(30222).encode('utf-8').format(
                                  category[0].encode('utf-8'), len(channels)),
                              localizedString(30223).encode('utf-8'),
                              nolabel=localizedString(30002).encode('utf-8'),
                              yeslabel=localizedString(30001).encode('utf-8')):
        return
    xbmc.executebuiltin(
        'Notification({0}, Start adding channels to favourites, {1}, {2})'.
        format(AddonName, 5000, icon))
    addFavorites([channel["id"] for channel in channels],
                 categoryID,
                 showNotification=False)
    common.MakeFavouritesGuide(fullGuideFile)
    xbmc.executebuiltin(
        'Notification({0}, Channels added to favourites, {1}, {2})'.format(
            AddonName, 5000, __icon__))
Пример #16
0
def ImportFavourites():
    selectedDir = Addon.getSetting("imExFolder")
    if selectedDir is None or selectedDir == "":
        return
    files = [f for f in os.listdir(selectedDir) if f.endswith(".txt")]
    fileInd = common.GetMenuSelected(
        localizedString(30025).encode('utf-8'), files)
    if fileInd == -1:
        return
    fullPath = os.path.join(selectedDir.decode("utf-8"), files[fileInd])
    favsList = common.ReadList(fullPath)
    if not common.YesNoDialog(
            localizedString(30215).encode('utf-8'),
            localizedString(30216).encode('utf-8'),
            line2=localizedString(30217).encode('utf-8').format(len(favsList)),
            line3=localizedString(30218).encode('utf-8'),
            nolabel=localizedString(30002).encode('utf-8'),
            yeslabel=localizedString(30001).encode('utf-8')):
        return
    common.WriteList(FAV, favsList)
    common.MakeFavouritesGuide(fullGuideFile)
    xbmc.executebuiltin(
        'Notification({0}, Favourites list is saved., {2}, {3})'.format(
            AddonName, fullPath, 5000, __icon__))

    iptvList = int(Addon.getSetting("iptvList"))
    if useIPTV and iptvList == 0:
        MakeIPTVlists()
        DownloadLogos()
Пример #17
0
def AddNewList():
	listName = GetKeyboardText(localizedString(10004).encode('utf-8')).strip()
	if len(listName) < 1:
		return

	method = GetSourceLocation(localizedString(10002).encode('utf-8'), [localizedString(10016).encode('utf-8'), localizedString(10017).encode('utf-8')])	
	#print method
	if method == -1:
		return
	elif method == 0:
		listUrl = GetKeyboardText(localizedString(10005).encode('utf-8')).strip()
	else:
		listUrl = xbmcgui.Dialog().browse(int(1), localizedString(10006).encode('utf-8'), 'myprograms','.plx|.m3u').decode("utf-8")
		if not listUrl:
			return
	
	if len(listUrl) < 1:
		return

	list = common.ReadList(playlistsFile)
	for item in list:
		if item["url"].lower() == listUrl.lower():
			xbmc.executebuiltin('Notification({0}, "{1}" {2}, 5000, {3})'.format(AddonName, listName, localizedString(10007).encode('utf-8'), icon))
			return
	list.append({"name": listName.decode("utf-8"), "url": listUrl})
	if common.SaveList(playlistsFile, list):
		xbmc.executebuiltin("XBMC.Container.Update('plugin://{0}')".format(AddonID))
Пример #18
0
def Categories():
	repoCheck.UpdateRepo()
	playlistDictionary = {
	#'ronos-Not updated' : 'http://tiny.cc/ronosiptv',
	#'prozone - Not Working': 'http://prozone.getxbmc.com/playlists',
	#'KodiSport - Need To Check': 'http://tiny.cc/kodisport',
	'All (Jordan)': 'http://ij0rd8n.x10host.com',
	'All (micky)': 'http://lvtvv.com/htf.m3u',
	'Idan+ (TheWiz)': 'http://iptv.thewiz.info/idan.m3u',
	'proTV (+sport5HD)': 'http://sportisraelprotv.site90.com/protvisrael.m3u'}
	
	
	list = common.ReadList(playlistsFile)
	
	for listName, listUrl in playlistDictionary.iteritems():
		isAlreadyExist = False
		for item in list:
			if item["url"].lower() == listUrl.lower():
				isAlreadyExist = True
				break
		if not isAlreadyExist:
			list.append({"name": listName.decode("utf-8"), "url": listUrl})
	
	for item in list:
		mode = 1 if item["url"].find(".plx") > 0 else 2
		name = common.GetEncodeString(item["name"])
		AddDir("{0}".format(name) ,item["url"], mode, "")
	
	AddDir("[COLOR yellow][{0}][/COLOR]".format(localizedString(10001).encode('utf-8')), "settings" , 20, os.path.join(addonDir, "resources", "images", "NewList.ico"), isFolder=False)
	AddDir("[COLOR yellow][{0}][/COLOR]".format(localizedString(10003).encode('utf-8')), "favorites" ,30 ,os.path.join(addonDir, "resources", "images", "bright_yellow_star.png"))
Пример #19
0
def ListFavorites():
	AddDir("[COLOR yellow][B]{0}[/B][/COLOR]".format(localizedString(10013).encode('utf-8')), "favorites" ,34 ,os.path.join(addonDir, "resources", "images", "bright_yellow_star.png"), isFolder=False)
	list = common.ReadList(favoritesFile)
	for channel in list:
		name = channel["name"].encode("utf-8")
		iconimage = channel["image"].encode("utf-8")
		AddDir(name, channel["url"], 32, iconimage, isFolder=False) 
Пример #20
0
def ShowDirectoryContents(directory_uuid):
    vDirs = common.ReadList(vDirectoriesFile)
    dirFiles = lsDir(directory_uuid)

    if dirFiles is None:
        return

    chList = common.ReadList(playlistsFile)
    lPlaylists = []

    for pUuid in dirFiles:
        for playlist in chList:
            if pUuid == playlist["uuid"]:
                lPlaylists.append(playlist)

    AddListItems(lPlaylists, addToVdir=False)
Пример #21
0
def MakeChannelsGuide(fullGuideFile, iptvGuideFile):
    FullGuideList = common.ReadList(fullGuideFile)
    if len(FullGuideList) == 0:
        return

    tz = GetTZ()

    channelsList = ""
    programmeList = ""
    for channel in FullGuideList:
        item = re.compile('^\[COLOR yellow\]\[B\](.*?)\[/B\]\[/COLOR\]$',
                          re.I + re.M + re.U + re.S).findall(
                              channel["channel"].encode("utf-8"))
        chName = item[0] if item != [] else None
        channelsList += "\t<channel id=\"{0}\">\n\t\t<display-name>{0}</display-name>\n\t</channel>\n".format(
            chName)

        for programme in channel["tvGuide"]:
            start = time.localtime(programme["start"])
            end = time.localtime(programme["end"])
            name = EscapeXML(programme["name"].encode(
                "utf-8")) if programme["name"] != None else ""
            description = EscapeXML(programme["description"].encode(
                "utf-8")) if programme["description"] != None else ""
            programmeList += "\t<programme start=\"{0} {5}\" stop=\"{1} {5}\" channel=\"{2}\">\n\t\t<title>{3}</title>\n\t\t<desc>{4}</desc>\n\t</programme>\n".format(
                time.strftime("%Y%m%d%H%M%S", start),
                time.strftime("%Y%m%d%H%M%S", end), chName, name, description,
                tz)

    xmlList = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<tv>\n{0}{1}</tv>".format(
        channelsList, programmeList)
    f = open(iptvGuideFile, 'w')
    f.write(xmlList)
    f.close()
def ListFavorites():
	AddDir("[COLOR yellow][B]{0}[/B][/COLOR]".format(getLocaleString(10013)), "favorites" ,34 ,os.path.join(iconsDir, "bright_yellow_star.png"), isFolder=False)
	list = common.ReadList(favoritesFile)
	i = 0
	for channel in list:
		AddDir(channel["name"].encode("utf-8"), channel["url"].encode("utf-8"), 32, channel["image"].encode("utf-8"), index=i, isFolder=False)
		i += 1
Пример #23
0
def addFavorites(channelsIDs, categoryID, showNotification=True):
    channels = common.GetChannels(categoryID)
    favsList = common.ReadList(FAV)

    for channelID in channelsIDs:
        channel = [x for x in channels if x["id"] == channelID]
        if len(channel) < 1:
            if showNotification:
                xbmc.executebuiltin(
                    'Notification({0}, [COLOR {1}][B]{2}[/B][/COLOR]  Cannot add to favourites, {3}, {4})'
                    .format(AddonName, Addon.getSetting("chColor"),
                            channel["name"].encode("utf-8"), 5000, __icon2__))
            continue
        channel = channel[0]

        if any(f.get('id', '') == channel["id"] for f in favsList):
            if showNotification:
                xbmc.executebuiltin(
                    'Notification({0}, [COLOR {1}][B]{2}[/B][/COLOR]  Already in favourites, {3}, {4})'
                    .format(AddonName, Addon.getSetting("chColor"),
                            channel["name"].encode("utf-8"), 5000, __icon2__))
            continue

        favsList.append(channel)

        if showNotification:
            xbmc.executebuiltin(
                'Notification({0}, [COLOR {1}][B]{2}[/B][/COLOR]  added to favourites, {3}, {4})'
                .format(AddonName, Addon.getSetting("chColor"),
                        channel["name"].encode("utf-8"), 5000, __icon__))

    common.WriteList(FAV, favsList)
    common.MakeFavouritesGuide(fullGuideFile)
Пример #24
0
def ChangeChoice(iuuid,
                 listFile,
                 key,
                 choiceTitle,
                 fileTitle,
                 urlTitle,
                 choiceFile,
                 choiceUrl,
                 choiceNone=None,
                 fileType=1,
                 fileMask=None,
                 favourites=False):
    index = GetPlaylistIndex(iuuid, listFile) if not favourites else iuuid
    chList = common.ReadList(listFile)
    defaultText = chList[index].get(key, "")
    str = GetChoice(choiceTitle, fileTitle, urlTitle, choiceFile,
                    choiceUrl, choiceNone, fileType, fileMask,
                    defaultText.encode("utf-8"))
    if key == "url" and len(str) < 1:
        return
    elif key == "logos" and str.startswith('http') and not str.endswith('/'):
        str += '/'
    chList[index][key] = str.decode("utf-8")
    if common.SaveList(listFile, chList):
        xbmc.executebuiltin("XBMC.Container.Refresh()")
Пример #25
0
def Categories():
    AddDir("[COLOR yellow][B]{0}[/B][/COLOR]".format(getLocaleString(10001)),
           "settings",
           20,
           os.path.join(addonDir, "resources", "images", "NewList.ico"),
           isFolder=False)
    AddDir(
        "[COLOR white][B][{0}][/B][/COLOR]".format(getLocaleString(10003)),
        "favorites", 30,
        os.path.join(addonDir, "resources", "images",
                     "bright_yellow_star.png"))

    i = 0
    list = common.ReadList(playlistsFile)
    for item in list:
        mode = 1 if item["url"].find(".plx") > 0 else 2
        name = common.GetEncodeString(item["name"])
        image = item.get('image', '')
        if mode == 1:
            logos = ''
        else:
            logos = item.get('logos', '')
        AddDir("[COLOR blue][{0}][/COLOR]".format(name),
               item["url"].encode("utf-8"),
               mode,
               image.encode("utf-8"),
               logos.encode("utf-8"),
               index=i)
        i += 1
Пример #26
0
def isMarkedListsChange():
    markedListsFilename = os.path.join(addon_data_dir, "lists",
                                       "markedLists.txt")
    oldList = common.ReadList(markedListsFilename)
    newList = common.GetMarkedLists()
    #oldList = [x.encode('UTF8') for x in oldList]
    return cmp(oldList, newList) != 0
Пример #27
0
def RemoveFromLists(index, listFile):
    list = common.ReadList(listFile)
    if index < 0 or index >= len(list):
        return
    del list[index]
    common.SaveList(listFile, list)
    xbmc.executebuiltin("XBMC.Container.Refresh()")
Пример #28
0
def AddFavorites(url, iconimage, name, mode):
    favList = common.ReadList(favoritesFile)
    for item in favList:
        if item["url"].lower() == url.decode("utf-8").lower():
            xbmc.executebuiltin(
                "Notification({0}, '{1}' {2}, 5000, {3})".format(
                    AddonName, name, getLocaleString(30011), icon))
            return
    chList = []
    for channel in chList:
        if channel["name"].lower() == name.decode("utf-8").lower():
            url = channel["url"].encode("utf-8")
            iconimage = channel["image"].encode("utf-8")
            break
    if not iconimage:
        iconimage = ""
    data = {
        "url": url.decode("utf-8"),
        "image": iconimage.decode("utf-8"),
        "name": name.decode("utf-8"),
        "mode": mode
    }
    favList.append(data)
    common.SaveList(favoritesFile, favList)
    xbmc.executebuiltin("Notification({0}, '{1}' {2}, 5000, {3})".format(
        AddonName, name, getLocaleString(30012), icon))
Пример #29
0
def ChangeChoice(index,
                 listFile,
                 key,
                 choiceTitle,
                 fileTitle,
                 urlTitle,
                 choiceFile,
                 choiceUrl,
                 choiceNone=None,
                 fileType=1,
                 fileMask=None):
    list = common.ReadList(listFile)
    if key == "logos":
        listUrl = list[index].get("url", "")
        if listUrl.endswith('.plx'):
            return
    defaultText = list[index].get(key, "")
    str = GetChoice(choiceTitle, fileTitle, urlTitle, choiceFile,
                    choiceUrl, choiceNone, fileType, fileMask,
                    defaultText.encode("utf-8"))
    if key == "url" and len(str) < 1:
        return
    elif key == "logos" and str.startswith('http') and not str.endswith('/'):
        str += '/'
    list[index][key] = str.decode("utf-8")
    if common.SaveList(listFile, list):
        xbmc.executebuiltin("XBMC.Container.Refresh()")
Пример #30
0
def FilmonChannelGuide(url, channelName, iconimage, ignoreFilmonGuide=False):
    filmon = False
    programmes = []
    channelDescription = ""

    if not ignoreFilmonGuide:
        chNum, referrerCh, chName = myFilmon.GetUrlParams(url)
        if referrerCh is None:
            filmon = True
            chName, channelDescription, iconimage, programmes = myFilmon.GetChannelGuide(
                chNum, filmonOldStrerams=True)

    if not filmon:
        epg = common.ReadList(globalGuideFile)
        programmes = GetProgrammes(epg, channelName, full=True)

    if iconimage is None:
        iconimage = ""
    if channelDescription is None:
        channelDescription = ""

    ShowGuide(programmes,
              channelName,
              iconimage,
              channelDescription,
              filmon=filmon)