def RadioVODs(): name = common.GetLabelColor("תכניות רדיו - כאן", bold=True, color="none") common.addDir(name, '', 21, os.path.join(imagesDir, 'kan.jpg'), infos={"Title": name}, module='kan') name = common.GetLabelColor("תכניות רדיו ספורט 5", bold=True, color="none") common.addDir(name, '', 20, os.path.join(imagesDir, 'Sport5.png'), infos={"Title": name}, module='sport5') name = common.GetLabelColor("תכניות רדיו - 89.1fm", bold=True, color="none") common.addDir(name, '', 0, os.path.join(imagesDir, '891fm.png'), infos={"Title": name}, module='891fm') name = common.GetLabelColor("תכניות רדיו - 106.4fm", bold=True, color="none") common.addDir(name, '', 0, os.path.join(imagesDir, '1064fm.jpg'), infos={"Title": name}, module='1064fm')
def GetCategoriesList(): name = common.GetLabelColor("מועדפי עידן פלוס", bold=True, color="none") common.addDir(name, '', 10, icon, infos={"Title": name}, addFav=False) name = common.GetLabelColor("חיפוש תכניות", bold=True, color="none") common.addDir(name, '', 4, icon, infos={"Title": name}, addFav=False) name = common.GetLabelColor("טלויזיה", bold=True, color="none") common.addDir(name, '', 1, icon, infos={"Title": name}) name = common.GetLabelColor("VOD", bold=True, color="none") common.addDir(name, '', 2, icon, infos={"Title": name}) name = common.GetLabelColor("רדיו", bold=True, color="none") common.addDir(name, '', 3, icon, infos={"Title": name}) name = common.GetLabelColor("תכניות רדיו", bold=True, color="none") common.addDir(name, '', 12, icon, infos={"Title": name}) name = common.GetLabelColor("פודקאסטים", bold=True, color="none") common.addDir(name, '', 13, icon, infos={"Title": name}) name = common.GetLabelColor("מוזיקה", bold=True, color="none") common.addDir(name, '', 14, icon, infos={"Title": name}) name = common.GetLabelColor("הגדרות", bold=True, color="none") common.addDir(name, 'Addon.OpenSettings', 6, icon, infos={"Title": name}, moreData=common.AddonID, isFolder=False)
def ShowPaging(grids, page_url, iconimage, mode): WpQuery = grids[0].get('WpQuery', None) if WpQuery is None: paged = 0 else: paged = WpQuery.get('paged', 0) if paged > 0 and len(grids) > 0: max_page = grids[0].get('max_page', 0) if paged > 1: prev_page = page_url + 'page/' + str(paged-1) + '/' if paged - 1 > 1 else page_url common.addDir(common.GetLabelColor(common.GetLocaleString(30011), color="green"), prev_page, mode, iconimage, module=module) if max_page > paged: common.addDir(common.GetLabelColor(common.GetLocaleString(30012), color="green"), page_url + 'page/' + str(paged+1) + '/', mode, iconimage, module=module)
def GetChannels(url, iconimage): html = common.OpenURL(url, headers={"User-Agent": UA}) if html == "": return None match = re.compile("var makoliveJson ='(.*?)';").findall(html) resultJSON = json.loads(match[0]) if resultJSON is None or len(resultJSON) < 1: return None for channel in resultJSON['list']: name = common.GetLabelColor(common.encode(channel['title'], "utf-8"), keyColor="prColor") infos = { "Title": name, "Plot": common.encode(channel['subtitle'], "utf-8") } url = '{0}{1}'.format(baseUrl, channel['link']) iconimage = channel['picUrl'] common.addDir( name, url, 5, iconimage, infos, contextMenu=[(common.GetLocaleString( 30005 ), 'RunPlugin({0}?url={1}&name={2}&mode=5&iconimage={3}&moredata=choose&module=keshet)' .format(sys.argv[0], common.quote_plus(url), common.quote_plus(name), common.quote_plus(iconimage)))], moreData=bitrate, module='keshet', isFolder=False, isPlayable=True)
def AddSeries(matches, catName): for link, iconimage, name, description in matches: i = link.lower().find('catid=') if i > 0: link = link[i + 6:] elif 'page.aspx' in link.lower(): try: t = common.OpenURL(link) m = re.compile( 'magazine_info_link w-inline-block\s*"\s*href=\'.*?catid=(.*?)&' ).findall(t) link = m[0] except: pass name = common.GetLabelColor(name.strip(), keyColor="prColor", bold=True) common.addDir(name, link, 2, iconimage, infos={ "Title": name, "Plot": description }, module=module, moreData='kan|||{0}'.format(catName), urlParamsData={'catName': catName})
def GetCategoriesList(iconimage): sortString = common.GetLocaleString( 30002) if sortBy == 0 else common.GetLocaleString(30003) name = "{0}: {1}".format(common.GetLocaleString(30001), sortString) common.addDir( name, "toggleSortingMethod", 4, iconimage, { "Title": name, "Plot": "{0}[CR]{1}[CR]{2} / {3}".format( name, common.GetLocaleString(30004), common.GetLocaleString(30002), common.GetLocaleString(30003)) }, module=module, isFolder=False) name = common.GetLabelColor("כל התכניות", bold=True, color="none") common.addDir(name, '', 0, iconimage, infos={ "Title": name, "Plot": "צפיה בתכניות ערוץ מורשת 20" }, module=module)
def GetSeriesList(iconimage): text = common.OpenURL( 'https://www.20il.co.il/tochniot_haarutz/%d7%97%d7%93%d7%a9%d7%95%d7%aa-%d7%a2%d7%a8%d7%95%d7%a5-20/' ) match = re.compile('<div class="tochniot-in-use-images(.*?)</div>', re.S).findall(text) match = re.compile('<a href="(.*?)".*?<img src="\s*(.*?)"', re.S).findall(match[0]) grids_arr = [] for link, iconimage in match: iconimage = GetQuoteUrl(iconimage) name = common.unquote( common.encode(link[link.rfind('/') + 1:], 'utf-8')) name = common.GetLabelColor(common.UnEscapeXML(name.replace('-', ' ')), keyColor="prColor", bold=True) if iconimage.startswith('http') == False: iconimage = '{0}{1}'.format(baseUrl, iconimage) grids_arr.append((name, '{0}{1}'.format(baseUrl, link), iconimage, { "Title": name })) grids_sorted = grids_arr if sortBy == 0 else sorted( grids_arr, key=lambda grids_arr: grids_arr[0]) for name, link, image, infos in grids_sorted: common.addDir(name, link, 1, common.encode(image, 'utf-8'), infos=infos, module=module)
def GetRadioEpisodesList(url): data = GetRadioData() for id in data[url]['children']: episode = data[id] name = common.GetLabelColor(episode['name'], keyColor="chColor") desc = episode.get('description', '') link = episode['url'].replace(u'\u200f', '') iconimage = '{0}/{1}'.format(radioUrl, episode['imageUrl']) common.addDir( name, link, 23, iconimage, infos={ "Title": name, "Plot": desc, "Aired": episode['time'] }, contextMenu= [(common.GetLocaleString(30005), 'RunPlugin({0}?url={1}&name={2}&mode=4&iconimage={3}&moredata=choose&module={4})' .format(sys.argv[0], common.quote_plus(link), name, common.quote_plus(iconimage), module)), (common.GetLocaleString(30023), 'RunPlugin({0}?url={1}&name={2}&mode=4&iconimage={3}&moredata=set_{4}_res&module={4})' .format(sys.argv[0], common.quote_plus(link), name, common.quote_plus(iconimage), module))], module=module, moreData=bitrate, isFolder=False, isPlayable=True)
def GetCategoriesList(iconimage): name = "{0}: {1}".format(common.GetLocaleString(30001), common.GetLocaleString(30002) if sortBy == 0 else common.GetLocaleString(30003)) common.addDir(name, "toggleSortingMethod", 5, iconimage, {"Title": name, "Plot": "{0}[CR]{1}[CR]{2} / {3}".format(name, common.GetLocaleString(30004), common.GetLocaleString(30002), common.GetLocaleString(30003))}, module=module, isFolder=False) result = GetUrlJson('{0}/vod/'.format(baseUrl)) if len(result) > 0: name = common.GetLabelColor("כל התכניות", bold=True, color="none") common.addDir(name, '', 0, iconimage, infos={"Title": name, "Plot": "צפיה בתכניות רשת 13"}, module=module) grids = result.get('Content', {}).get('PageGrid', {}) for grid in grids: gridType = grid.get('GridType') if gridType is not None and gridType == 'grid_content_4col' or gridType == 'carousel_grid_content': gridTitle = common.encode(grid.get('GridTitle').get('title').strip(), 'utf-8') name = common.GetLabelColor(gridTitle, bold=True, color="none") common.addDir(name, str(grid.get('grid_id')), 6, iconimage, infos={"Title": name}, module=module) name = common.GetLabelColor("החדשות 13", bold=True, color="none") common.addDir(name, '', 10, iconimage, infos={"Title": name, "Plot": "צפיה בתכניות חדשות 13"}, module=module)
def GetEpisodes(text): #raw_unicode_escape = False #match = []#re.compile(u'<main id="main"(.*?)</main>', re.S).findall(text) #if len(match) < 1: match = re.compile(u'pageGlobals.*?"id":(.*?),').findall(text) link = 'https://sport1.maariv.co.il/wp-json/sport1/v1/league/{0}/video/content?is_mobile=false&rows=800'.format(match[0]) text = common.OpenURL(link) match[0] = text.replace('\\"', '"').replace('\/', '/') #raw_unicode_escape = True match = re.compile(u'<div class="video-card(.*?)</a>', re.S).findall(match[0]) for item in match: m = re.compile("<a href=['\"](.*?)['\"].*?<img(.*?)>.*?<h3.*?>(.*?)</h3>", re.S).findall(item) if len(m) < 1: continue url, icon, name = m[0] m = re.compile(u'data-lazy="(.*?)"', re.S).findall(icon) if len(m) < 1: m = re.compile(u'src=["\'](.*?)["\']', re.S).findall(icon) icon = m[0] #if raw_unicode_escape: name = common.decode(name, 'raw_unicode_escape', force=True) url = common.decode(url, 'raw_unicode_escape', force=True) icon = common.decode(icon, 'raw_unicode_escape', force=True) name = common.GetLabelColor(common.UnEscapeXML(name.strip()), keyColor="chColor", bold=True) try: common.addDir(name, url.replace(baseUrl, ''), 4, icon, infos={"Title": name}, contextMenu=[(common.GetLocaleString(30005), 'RunPlugin({0}?url={1}&name={2}&mode=4&iconimage={3}&moredata=choose&module={4})'.format(sys.argv[0], common.quote_plus(url), name, common.quote_plus(icon), module)), (common.GetLocaleString(30023), 'RunPlugin({0}?url={1}&name={2}&mode=4&iconimage={3}&moredata=set_{4}_res&module={4})'.format(sys.argv[0], common.quote_plus(url), name, common.quote_plus(icon), module))], module=module, moreData=bitrate, isFolder=False, isPlayable=True) except Exception as ex: xbmc.log(str(ex), 3)
def GetSeasonsList(url, iconimage): url = "{0}&{1}".format(url, endings) if "?" in url else "{0}?{1}".format( url, endings) prms = GetJson(url) if prms is None or "programData" not in prms or "seasons" not in prms[ "programData"]: xbmc.log("Cannot get Seasons list", 2) return if iconimage == os.path.join(imagesDir, 'search.jpg'): iconimage = GetImage(prms["programData"], "picI", iconimage) for prm in prms["programData"]["seasons"]: try: if "vods" not in prm: continue name = common.GetLabelColor(common.encode(prm.get('name', ''), "utf-8"), keyColor="timesColor", bold=True) url = "{0}{1}".format(baseUrl, prm["url"]) description = common.encode(prm.get('brief', ''), "utf-8") infos = {"Title": name, "Plot": description} common.addDir(name, url, 3, iconimage, infos, module=module, moreData=prm["id"]) except Exception as ex: xbmc.log(str(ex), 3)
def PlayLive(id): channel = None channels = baseChannels.TvChannels + baseChannels.RadioChannels for ch in channels: if ch.get('ch') == id: channel = ch break if channel is None: return nowEPG = epg.GetNowEPG() programs = [] if channel.get('tvgID', '') == '' else nowEPG.get( channel['tvgID'], []) channelNameFormat = int(Addon.getSetting("channelNameFormat")) displayName = common.GetLabelColor(common.GetLocaleString( channel['nameID']), keyColor="chColor", bold=True) iconimage = os.path.join(imagesDir, channel['image']) if len(programs) > 0: programTime = common.GetLabelColor("[{0}-{1}]".format( datetime.datetime.fromtimestamp( programs[0]["start"]).strftime('%H:%M'), datetime.datetime.fromtimestamp( programs[0]["end"]).strftime('%H:%M')), keyColor="timesColor") programName = common.GetLabelColor(common.encode( programs[0]["name"], 'utf-8'), keyColor="prColor", bold=True) displayName = GetChannelName(programName, programTime, displayName, channelNameFormat) if channel.get('resKey', '') == '': bitrate = 'best' else: bitrate = Addon.getSetting(channel['resKey']) if bitrate == '': bitrate = 'best' try: module = channel['module'] moduleScript = __import__('resources.lib.{0}'.format(module), fromlist=[module]) moduleScript.Run(displayName, channel['channelID'], channel['mode'], iconimage, bitrate) except Exception as ex: xbmc.log(str(ex), 3)
def GetCategories(iconimage): categories = [ {'name': 'ערוצים פופולרים', 'cat': 'popular'}, {'name': 'ערוצים דיגיטלים', 'cat': 'digital'}, {'name': 'ערוצי תוכן', 'cat': 'content'} ] for category in categories: name = common.GetLabelColor(category['name'], keyColor="prColor", bold=True) common.addDir(name, category['cat'], 1, iconimage, infos={"Title": name}, module=module)
def ShowChannelEPG(channel, name='', iconimage='', provider='auto', days=2): common.addDir('------- {0} -------'.format(common.GetLabelColor(name, keyColor="chColor", bold=True)), name, 99, iconimage, isFolder=False) day = "" epgList = GetEPG() programs = epgList[channel] channelNameFormat = int(Addon.getSetting("channelNameFormat")) for program in programs: if now >= program['end']: continue startdate = datetime.datetime.fromtimestamp(program["start"]).strftime('%d/%m/%y') if startdate != day: day = startdate dayS = common.GetLabelColor(day, keyColor="nprColor", bold=True) common.addDir(dayS, 'epg', 99, iconimage, {"Title": dayS}, module=module, isFolder=False) start_time = datetime.datetime.fromtimestamp(program["start"]).strftime('%H:%M') end_time = datetime.datetime.fromtimestamp(program["end"]).strftime('%H:%M') programName = GetDisplayName(common.GetLabelColor('[{0}-{1}]'.format(start_time, end_time), keyColor="timesColor"), common.GetLabelColor(common.encode(program["name"].strip(),'utf-8'), keyColor="prColor", bold=True), channelNameFormat) description = common.encode(program["description"].strip(), 'utf-8') common.addDir(programName, 'epg', 99, iconimage, {"Title": programName, "Plot": description}, module=module, isFolder=False)
def GetSeasonList(url, iconimage): result = GetUrlJson(url) seasons, episodes = GetLinks(url, result, iconimage) if len(seasons) > 0: for link, title in common.items(seasons): name = common.GetLabelColor(title, keyColor="timesColor", bold=True) common.addDir(name, link, 2, iconimage, infos={"Title": name}, module=module) if len(episodes) < 1: return ShowEpisodes(episodes, iconimage)
def ShowEpisodes(episodes, iconimage): if len(episodes) < 1: name = 'אין פרקים מלאים' common.addDir(name, '', 99, iconimage, infos={"Title": name}, module=module, isFolder=False) return programNameFormat = int(Addon.getSetting("programNameFormat")) #for gridTitle, link, icon, title, subtitle, publishDate in sorted(episodes,key=lambda episodes: episodes[5]):#reversed(episodes): for gridTitle, link, icon, title, subtitle, publishDate in episodes: name = common.GetLabelColor(title, keyColor="chColor") if gridTitle is None or gridTitle == '' else common.getDisplayName(gridTitle, title, programNameFormat) link = str(link) common.addDir(name, link, 3, icon, infos={"Title": name, "Plot": subtitle, "Aired": publishDate}, contextMenu=[(common.GetLocaleString(30005), 'RunPlugin({0}?url={1}&name={2}&mode=3&iconimage={3}&moredata=choose&module=reshet)'.format(sys.argv[0], common.quote_plus(link), common.quote_plus(name), common.quote_plus(icon))), (common.GetLocaleString(30023), 'RunPlugin({0}?url={1}&name={2}&mode=3&iconimage={3}&moredata=set_reshet_res&module=reshet)'.format(sys.argv[0], common.quote_plus(link), common.quote_plus(name), common.quote_plus(icon)))], moreData=bitrate, module=module, isFolder=False, isPlayable=True)
def GetSeriesList(iconimage): text = common.OpenURL('https://www.oles.tv/891fm/shows/') series = re.compile( 'class="media-left"><a href="(.*?)" class="pic link"><img class="media-object" src="(.*?)" alt="Programme: (.*?)"(.*?)<div class="tools">' ).findall(text) for link, iconimage, name, desc in series: name = common.GetLabelColor(common.UnEscapeXML(name), keyColor="prColor", bold=True) match = re.compile('p class="text">(.*?)<a').findall(desc) desc = common.GetLabelColor( match[0], keyColor="chColor") if len(match) > 0 else '' common.addDir(name, link, 1, iconimage, infos={ "Plot": desc, "Title": name }, module=module)
def Musics(): name = common.GetLabelColor("מוזיקה - גלגל\"צ", bold=True, color="none") common.addDir(name, 'glglz', 1, os.path.join(imagesDir, 'glglz.jpg'), infos={"Title": name}, module='glz') name = common.GetLabelColor("מוזיקה - eco99fm", bold=True, color="none") common.addDir(name, '', 0, os.path.join(imagesDir, '99fm.png'), infos={"Title": name}, module='99fm') name = common.GetLabelColor("מוזיקה - 100fm", bold=True, color="none") common.addDir(name, '', 0, os.path.join(imagesDir, '100fm.jpg'), infos={"Title": name}, module='100fm')
def LiveChannels(): if Addon.getSetting("tvShortcut") == 'true': name = common.GetLabelColor(common.GetLocaleString(30652), bold=True, color="none") common.addDir(name, 'ActivateWindow', 6, icon, infos={"Title": name}, moreData='tvchannels', isFolder=False) nowEPG = epg.GetNowEPG() channels = GetUserChannels(type='tv') for channel in channels: if channel.get('type') == 'refresh': name = common.GetLabelColor(common.GetLocaleString( channel['nameID']), bold=True, color="none") common.addDir(name, 'Container.Refresh', channel['mode'], channel['image'], infos={"Title": name}, moreData=';noexit', isFolder=False) else: programs = [] if channel['tvgID'] == '' else nowEPG.get( channel['tvgID'], []) LiveChannel(common.GetLocaleString(channel['nameID']), channel['channelID'], channel['mode'], channel['image'], channel['module'], contextMenu=[], resKey=channel['resKey'], programs=programs, tvgID=channel['tvgID'])
def Search(url, iconimage): search_entered = common.GetKeyboardText('מילים לחיפוש', '') if search_entered != '': url = url.format(search_entered.replace(' ', '%20')) params = GetJson(url) suggestions = params["suggestions"] data = params["data"] for i in range(len(suggestions)): if "mako-vod-channel2-news" in data[i]: continue url = "{0}{1}".format(baseUrl, data[i]) name = common.UnEscapeXML(common.encode(suggestions[i], "utf-8")) infos = {"Title": name, "Plot": name} if "VOD-" in data[i]: name = common.GetLabelColor(name, keyColor="chColor") common.addDir( name, url, 5, iconimage, infos, contextMenu=[(common.GetLocaleString( 30005 ), 'RunPlugin({0}?url={1}&name={2}&mode=5&iconimage={3}&moredata=choose&module=keshet)' .format(sys.argv[0], common.quote_plus(url), common.quote_plus(name), common.quote_plus(iconimage)))], moreData=bitrate, module='keshet', isFolder=False, isPlayable=True) else: name = common.GetLabelColor(name, keyColor="prColor", bold=True) common.addDir(name, url, 2, iconimage, infos, module=module) else: return
def Search(): series = common.GetUpdatedList(common.seriesFile, common.seriesUrl, isZip=True, sort=True) filteredSeries = [] seriesLinks = [] searchText = common.GetKeyboardText('מילים לחיפוש', '').strip().lower() if searchText == '': filteredSeries = series else: for serie in series: if serie['name'].lower().startswith(searchText): filteredSeries.append(serie) seriesLinks.append(serie['name']) for serie in series: if searchText in serie['name'].lower( ) and serie['name'] not in seriesLinks: filteredSeries.append(serie) seriesLinks.append(serie['name']) programNameFormat = int(Addon.getSetting("programNameFormat")) for serie in filteredSeries: serieMoreData = serie.get('moreData', '') serieCatName = serie.get('catName', '') serieName = serie['name'] moduleName = GetModuleName(serie['module'], serie['mode'], serieMoreData, serieCatName) name = common.getDisplayName(serieName, moduleName, programNameFormat, bold=True) infos = {"Title": name, "Plot": serie['desc']} isFolder = False if serieMoreData == 'youtube' else True xbmc.log(serie['url'], 5) xbmc.log(serie['icon'], 5) common.addDir(name, serie['url'], serie['mode'], common.encode(serie['icon'], 'utf-8'), infos, module=serie['module'], moreData=common.encode(serieMoreData, 'utf-8'), totalItems=len(filteredSeries), isFolder=isFolder, urlParamsData={ 'name': common.GetLabelColor(serieName, keyColor="prColor", bold=True) })
def GetPlaylists(url): url = '{0}player/getplayerdata?rootId={1}'.format(apiUrl, channels[url]['rootId']) playlist = common.OpenURL(url, headers=headers, responseMethod='json') for item in playlist['musicChannels']: name = common.GetLabelColor(item['name'], keyColor="chColor") common.addDir(name, item['fileUrl'], 2, 'https://glz.co.il{0}'.format(item['playerImage']), infos={"Title": name}, module=module, isFolder=False, isPlayable=True)
def GetEpisodesList(url, programName, image): programName = common.GetLabelColor(programName, keyColor="prColor") text = common.OpenURL(url) match = re.compile('class="day">(.*?)class="tools"').findall(text) episodes = re.compile('<a href="(.*?)".*?</i>\s*(.*?)</a>').findall( match[0]) name = common.GetLabelColor(programName, keyColor="prColor") common.addDir(name, '', 99, image, infos={ "Title": name, "Plot": name }, module=module, isFolder=False) grids_arr = [] for link, name in episodes: grids_arr.append((name, link)) grids_sorted = sorted(grids_arr, key=lambda grids_arr: grids_arr[0], reverse=True) for name, link in grids_sorted: name = common.GetLabelColor(common.UnEscapeXML(name), keyColor="chColor") common.addDir(name, link, 2, image, infos={ "Title": name, "Plot": programName }, module=module, isFolder=False, isPlayable=True)
def Podcasts(): name = common.GetLabelColor("פודקאסטים - כאן", bold=True, color="none") common.addDir(name, '', 31, os.path.join(imagesDir, 'kan.jpg'), infos={"Title": name}, module='kan') name = common.GetLabelColor("פודקאסטים לילדים - כאן", bold=True, color="none") common.addDir(name, '', 33, os.path.join(imagesDir, 'kan.jpg'), infos={"Title": name}, module='kan') name = common.GetLabelColor("פודקאסטים ספורט 5", bold=True, color="none") common.addDir(name, '', 20, os.path.join(imagesDir, 'Sport5.png'), infos={"Title": name}, module='sport5')
def GetRadioCategoriesList(iconimage): grids_arr = [] data = GetRadioData() for id in data['root']['children']: category = data[id] name = common.GetLabelColor(category['name'], keyColor="timesColor", bold=True) grids_arr.append((name, id, '{0}/{1}'.format(radioUrl, radioIcon), { "Title": name })) grids_sorted = grids_arr if sortBy == 0 else sorted( grids_arr, key=lambda grids_arr: grids_arr[0]) for name, link, icon, infos in grids_sorted: common.addDir(name, link, 21, icon, infos=infos, module=module)
def GetCategoriesList(iconimage): url = '{0}/vod/'.format(baseUrl) text = common.OpenURL(url) matches = re.compile(u'<div class="vod-slider">(.*?)<div class="tab-content">', re.S).findall(text) grids_arr = [] for match in matches: category = re.compile(u'<h2.*?>(.*?)</h2>.*?<a.*?href="(.*?)"', re.S).findall(match) if len(category) < 1: continue name, link = category[0] name = common.GetLabelColor(name.strip(), keyColor="prColor", bold=True) grids_arr.append((name, link)) grids_sorted = grids_arr if sortBy == 0 else sorted(grids_arr,key=lambda grids_arr: grids_arr[0]) for name, link in grids_sorted: common.addDir(name, '{0}/vod/{1}'.format(baseUrl, link), 1, iconimage, infos={"Title": name}, module=module)
def GetRadioCategoriesList(iconimage): name = common.GetLabelColor("כאן ב", bold=True, color="none") common.addDir(name, '{0}/live/radio.aspx?stationid=3'.format(baseUrl), 22, os.path.join(imagesDir, "bet.png"), infos={"Title": name}, module=module) name = common.GetLabelColor("כאן גימל", bold=True, color="none") common.addDir(name, '{0}/live/radio.aspx?stationid=9'.format(baseUrl), 22, os.path.join(imagesDir, "gimel.png"), infos={"Title": name}, module=module) name = common.GetLabelColor("כאן 88", bold=True, color="none") common.addDir(name, '{0}/live/radio.aspx?stationid=4'.format(baseUrl), 22, os.path.join(imagesDir, "88.png"), infos={"Title": name}, module=module) name = common.GetLabelColor("כאן תרבות", bold=True, color="none") common.addDir(name, '{0}/live/radio.aspx?stationid=5'.format(baseUrl), 22, os.path.join(imagesDir, "culture.png"), infos={"Title": name}, module=module) name = common.GetLabelColor("כאן קול המוסיקה", bold=True, color="none") common.addDir(name, '{0}/live/radio.aspx?stationid=7'.format(baseUrl), 22, os.path.join(imagesDir, "music.png"), infos={"Title": name}, module=module) name = common.GetLabelColor("כאן מורשת", bold=True, color="none") common.addDir(name, '{0}/live/radio.aspx?stationid=6'.format(baseUrl), 22, os.path.join(imagesDir, "moreshet.png"), infos={"Title": name}, module=module) name = common.GetLabelColor("כאן Reka", bold=True, color="none") common.addDir(name, '{0}/live/radio.aspx?stationid=10'.format(baseUrl), 22, os.path.join(imagesDir, "reka.png"), infos={"Title": name}, module=module)
def GetSeriesList(iconimage): url = '{0}/vod/'.format(baseUrl) result = GetUrlJson(url) if len(result) < 1: return grids_arr = [] seriesIDs = [] series = {} grids = result.get('Content', {}).get('PageGrid', {}) for grid in grids: for seriesID in grid.get('Posts', {}): try: if seriesID in seriesIDs or seriesID == 170768: continue serie = result.get('ItemStore', {}).get(str(seriesID), {}) link = serie.get('link') postType = serie.get('postType', '') if postType == 'item': if '/movies/' in link: link = link[:link.find('/movies/') +8].replace('/item', '') else: link = link[:link.find('/season') +1].replace('/item', '') page_2_level_heb = serie['coolaData'].get('page_2_level_heb') name = '' if page_2_level_heb is None else common.encode(page_2_level_heb, 'utf-8') elif postType != 'page': continue else: if len(common.url_parse(link).path.split('/')) > 4 and 'channel2-news' not in link: continue name = common.encode(serie['title'], 'utf-8') name = common.GetLabelColor(name, keyColor="prColor", bold=True) if link == '' or link in series and postType != 'page': continue series[link] = name seriesIDs.append(seriesID) pageTitle = serie.get('pageTitle', {}) description = '' if pageTitle is None else common.encode(pageTitle.get('description', ''), 'utf-8') matches = [grids_arr.index(x) for x in grids_arr if link == x[1]] if len(matches) == 1: grids_arr[matches[0]] = (name, link, common.encode(serie['images']['app_16x9'], 'utf-8'), {"Title": name, "Plot": description}) else: grids_arr.append((name, link, common.encode(serie['images']['app_16x9'], 'utf-8'), {"Title": name, "Plot": description})) except Exception as ex: xbmc.log(str(ex), 3) grids_sorted = grids_arr if sortBy == 0 else sorted(grids_arr,key=lambda grids_arr: grids_arr[0]) for name, link, icon, infos in grids_sorted: common.addDir(name, link, 1, icon, infos=infos, module=module)
def GetNewsCategoriesList(iconimage): url = 'https://13news.co.il/programs/' result = GetUrlJson(url) if len(result) < 1: return grids_arr = [] mainMenus = result.get('Header', {}).get('mainMenu', []) for mainMenu in mainMenus: if mainMenu['url'] == url: grids = mainMenu['children'] for grid in grids: name = common.GetLabelColor(common.UnEscapeXML(common.encode(grid['title'], 'utf-8')), keyColor="prColor", bold=True) link = grid['url'] grids_arr.append((name, link, iconimage, {"Title": name})) grids_sorted = grids_arr if sortBy == 0 else sorted(grids_arr,key=lambda grids_arr: grids_arr[0]) for name, link, icon, infos in grids_sorted: common.addDir(name, link, 1, icon, infos=infos, module=module)
def GetCategoriesList(iconimage): categories = GetCategories() grids_arr = [] for category in categories: name = common.GetLabelColor(category['Name'], keyColor="prColor", bold=True) grids_arr.append((name, category['ID'])) grids_sorted = grids_arr if sortBy == 0 else sorted( grids_arr, key=lambda grids_arr: grids_arr[0]) for name, id in grids_sorted: common.addDir(name, id, 1, iconimage, infos={"Title": name}, module=module)