def buildSubMenu(inputParams): """ Creates the submenu for a category """ ressort = inputParams['ressort'].replace(".", "-") offset = int(inputParams['offset']) fetchsize = int(inputParams['fetchsize']) videoCount = 0 for x in range(0, fetchsize): url = "{0}/multimedia/videos/ressort-{1}/?ot=de.faz.ot.www.teaser.more.mmo&type=VIDEO&offset={2}".format(WEB_PAGE_BASE, ressort, str(offset + x)) log("fetch ressorts: {0}".format(url)) content = fetchFromUrl(url) if content is not None: videoCount = videoCount + parseVideos(content) # add 'next' menu item if more videos available if videoCount > 0: params = {'title':'Next Page', 'ressort':inputParams['ressort'], 'fetchsize':inputParams['fetchsize']} params['offset'] = offset + fetchsize link = util.makeLink(params) util.addMenuItem(params['title'], link) # add 'main menu' item params = {'title':'Main Menu'} link = util.makeLink(params) util.addMenuItem(params['title'], link) util.endListing()
def buildMenu(): url = 'http://el7l.tv/online2/12/_%D8%A7%D9%81%D9%84%D8%A7%D9%85_%D8%B9%D8%B1%D8%A8%D9%8A%D8%A9/1.html' response = requests.get(url) if response and response.status_code == 200: cont = response.text videos = util.extractAll(cont, '<div class="file_index">', '/div>') for video in videos: t = util.extract(video, 'alt="', '"') v = util.extract(video, 'a href="http://el7l.tv/online', '"') vp = 'http://el7l.tv/play' + v i = util.extract(video, 'img src="', '"') params = {'listing': 1} params['title'] = t params['video'] = vp params['image'] = i link = util.makeLink(params) util.addMenuItem(params['title'], link, 'DefaultVideo.png', params['image'], True) else: util.showError(ADDON_ID, 'Could not open URL %s to create menu' % (url)) pages = {'page': 1} page_link = util.makeLink(pages) util.addMenuItem('Next Page:>> ', page_link, None, None, True) util.endListing()
def listGames(params, fanart=None, my_string=None): emu_core = params['c'] roms_folder = params['f'] #pattern = ".*\.(jpg|png|JPG|PNG|txt|TXT|nfo|NFO)$" pattern = "^.*\.(?!jpg$|png$|JPG$|PNG$|txt$|TXT$|nfo$|NFO$).+$" if os.path.isdir(roms_folder): for file in sorted(os.listdir(roms_folder)): if emu_core == "scummvm": pattern = "^.*\.(exe|scum|scummvm|ap|sou|map|sm0|sm1|rsc|ims|dat|lfl|lec|blk|out|gme|voc|000|001|002|003|004|005|006|007|008|009|010|011|1|100|101|1C|455|512|(a)|ad|add|aif|ald|all|ang|ask|aud|avd|avi|b25c|babayaga|bak|bbm|bdf|bin|blb|brs|c00|cab|cat|cel|cfg|chk|clg|clm|clt|clu|cps|csc|cup|d64|dcp|dll|dmu|dnr|drv|dsk|dum|ega|egg|ex1|flac|fmc|fnt|fon|gjd|gmc|gra|grv|he0|he2|hep|hpf|hrs|ico|imd|img|in|ine|inf|ini|itk|la0|la1|lic|man|map|mdi|mdt|mhk|mid|mor|mpc|mpc|msg|mus|nib|nl|nut|obj|ogg|ovr|pak|pat|pcx|pe2|pic|pix|pkd|pmv|prc|prg|qa|raw|rbt|rec|res|rl2|rlb|rom|san|sav|scn|scr|seq|set|smk|smp|snd|sng|sound|sp|spr|stk|stk|str|syn|sys|sys16|tab|tex|tga|tlk|tmi|txt|v16|v56|vga|vmd|w32|wav|win|z|zfs)$" if os.path.isdir(os.path.join(roms_folder,str(file))): for file2 in os.listdir(os.path.join(roms_folder,str(file))): if re.match(pattern, file2): myParam = {} myParam['c'] = emu_core myParam['r'] = os.path.join(roms_folder,str(file),str(file2)) util.addMenuItem(util.getScummNiceName(str(file)), util.makeLink(myParam), icon=util.findIcon(roms_folder,str(file)), thumbnail=None, folder=True, fanart=fanart) break else: pattern = "^.*\.(?!jpg$|png$|JPG$|PNG$|txt$|TXT$|nfo$|NFO$).+$" if re.match(pattern, file) and not os.path.isdir(os.path.join(roms_folder,str(file))): myParam = {} myParam['c'] = emu_core myParam['r'] = os.path.join(roms_folder,str(file)) util.addMenuItem(util.removeExtensions(str(file)), util.makeLink(myParam), icon=util.findIcon(roms_folder,str(file)), thumbnail=None, folder=True, fanart=fanart) else: util.okDialog("Roms folder not found.", "Please review Simple Launcher configuration.")
def menuLink(params): caption = 'try HD first: #1--OK.ru ,#2--openload(try it several clicks until work) ' action = {'info': 1} cap_link = util.makeLink(action) util.addMenuItem(caption, cap_link, icon, fanart, False) url = (params['video']) videoPage = requests.get(url) if videoPage and videoPage.status_code == 200: cont = videoPage.text vidlinks = util.extractAll(cont, '<div id="tab', '/div>') for vidlink in vidlinks: t = util.extract(vidlink, '://', '/') v = util.extract(vidlink, 'SRC="', '"') or util.extract( vidlink, 'src="', '"') paramz = {'play': 1} paramz['title'] = t paramz['videolink'] = v paramz['image'] = params['image'] link = util.makeLink(paramz) util.addMenuItem(paramz['title'], link, 'DefaultVideo.png', paramz['image'], False) else: util.showError(ADDON_ID, 'Could not open URL %s to create menu' % (url)) util.endListing()
def search(): dialog = xbmcgui.Dialog() i = dialog.input('Enter Movie Name:', type=xbmcgui.INPUT_ALPHANUM) q = urllib.quote(i, safe="%/:=&?~#+!$,;'@()*[]") baseurl = 'https://www.google.com.sa/search?rlz=1C1CHZL_enSA679SA679&espv=2&q=el7al.tv+' print q url = baseurl + q + '&oq=el7al.tv+' + q + '&gs_l=serp.3...33231.51533.0.52317.42.30.8.0.0.0.211.4360.0j21j4.25.0....0...1c.1.64.serp..11.22.2813.0..0j30i10k1j0i13k1j0i13i30k1j0i7i30k1j35i39k1j0i131k1j0i10i30k1j0i13i10k1.w4AW4pCV-E4' response = requests.get(url) if response and response.status_code == 200: cont = response.text videos = util.extractAll(cont, '<a href="/url?q=http://el7l.tv/online', 'class="_cD"') for video in videos: t = util.extract(video, '>', '</a>') t1 = (t.replace('\n', '').replace('\t', '').replace('</b>', '').replace('<b>', '').lstrip()) u1 = (util.extract(video, '/', '&')) u = 'http://el7l.tv/play/' + u1 params = {'search': 1} params['url'] = u params['title'] = t1 link = util.makeLink(params) util.addMenuItem(params['title'], link, None, None, True) util.endListing() else: util.showError(ADDON_ID, 'Could not open URL %s to create menu' % (url))
def home(): action = {'new': 0, 'page': 1} t = 'أفلام عربية جديدة' title = (t).decode('utf-8') link = util.makeLink(action) util.addMenuItem(title, link, fanart, None, True) action = {'old': 0, 'page': 1} t = 'زمن الفن الجميل ' title = (t).decode('utf-8') link = util.makeLink(action) util.addMenuItem(title, link, fanart, None, True) action = {'spec': 1, 'page': 1} t = 'أفلام عربية للكبار ' title = (t).decode('utf-8') link = util.makeLink(action) util.addMenuItem(title, link, fanart, None, True) action = {'srch': 0} t = 'SEARCH ' title = (t).decode('utf-8') link = util.makeLink(action) util.addMenuItem(title, link, icon, None, True) action = {'hlp': 1} t = 'If you could not Read List: click here:>> ' title = (t).decode('utf-8') link = util.makeLink(action) util.addMenuItem(title, link, icon, None, True) util.endListing()
def buildMenu(): for channel in sorted(channels.keys()): params = {'play': 1} params['channel'] = channel link = util.makeLink(params) util.addMenuItem(channel, link, 'DefaultVideo.png', 'DefaultVideo.png') util.endListing()
def ololink(params): caption = 'If you have trouble:goto:https://sites.google.com/site/kokiarbic/help' action = {'info': 1} cap_link = util.makeLink(action) util.addMenuItem(caption, cap_link, icon, fanart, False) url = (params['video']) videoPage = requests.get(url) if videoPage and videoPage.status_code == 200: cont = videoPage.text vidlinks = util.extractAll(cont, '"playerst"', '/iframe>') for vidlink in vidlinks: t = 'Movielink' v = util.extract(vidlink, 'SRC="', '"') or util.extract( vidlink, 'src="', '"') paramz = {'play': 1} paramz['title'] = t paramz['videolink'] = v paramz['image'] = params['image'] link = util.makeLink(paramz) util.addMenuItem(paramz['title'], link, 'DefaultVideo.png', paramz['image'], False) else: util.showError(ADDON_ID, 'Could not open URL %s to create menu' % (url)) util.endListing()
def launchMenu(params): util.addMenuItem(EMU_WILL_RUN_MESSAGE, link=None, icon=None, thumbnail=None, folder=True, fanart=None) util.runRetroarchMenu()
def buildMenu(): url = "http://nottstv.com/programmes/" response = urllib2.urlopen(url) path = addon.getAddonInfo('path') if response and response.getcode() == 200: content = response.read() params = {'programme': 1} params['label'] = "Notts TV News Reports" params['tag'] = "news" link = util.makeLink(params) util.addMenuItem(params['label'], link, 'news.png', path + '/images/news.png', True) programmes = util.extractAll(content, 'http://nottstv.com/programmes/', '</a>') for programmelist in programmes: if "jQuery" in programmelist: continue programme = programmelist.split('">') if programme[1] == "Programmes": continue params = {'programme': 1} params['label'] = programme[1] params['tag'] = programme[0] link = util.makeLink(params) thumb = 'DefaultVideo.png' if programme[1] == 'Nottingham Now and Then': thumb = path + '/images/nowandthen.png' if programme[1] == 'Mass Bolero': thumb = path + '/images/massbolero.png' if programme[1] == 'The 6:30 Show': thumb = path + '/images/630show.png' if programme[1] == 'Channel 8 Debate': thumb = path + '/images/8debate.png' if programme[1] == 'Day in the Life': thumb = path + '/images/dayinthelife.png' if programme[1] == 'Inside Industry Week': thumb = path + '/images/insideindustry.jpg' if programme[1] == 'Noise Floor': thumb = path + '/images/noisefloor.png' if programme[1] == 'The Boot Room': thumb = path + '/images/bootroom.png' if programme[1] == 'The Locker Room': thumb = path + '/images/lockerroom.png' if programme[1] == 'Working Week': thumb = path + '/images/workingweek.png' print path util.addMenuItem(params['label'], link, thumb, thumb, True) util.addCategory('>> Current Affairs', 'current-affairs') util.addCategory('>> Entertainment', 'entertainment') util.addCategory('>> Lifestyle', 'lifestyle') util.addCategory('>> Sport', 'sport', path + '/images/sport.jpg') util.addCategory('>> Music', 'music') util.addCategory('>> Specials', 'specials') util.endListing() else: util.showError('plugin.video.nottstv', 'Could not open URL %s to create menu' % (url)) pass
def playGame(params): emu_core = params['c'] rom_file = params['r'] util.addMenuItem(EMU_WILL_RUN_MESSAGE, link=None, icon=None, thumbnail=None, folder=True, fanart=None) util.runEmulator(emu_core, rom_file)
def parseRessorts(content): """ Parses the html content for categories """ for x in re.findall(r"<a.*fazAjaxContentChanger.*ressort=(\d\.\d*).*>(.*)</a>", content): params = {} params['title'] = x[1] params['ressort'] = x[0] params['offset'] = 0 params['fetchsize'] = 3 link = util.makeLink(params) util.addMenuItem(params['title'], link) util.endListing()
def buildSubMenu(params): response = urllib2.urlopen(params['video']) if response and response.getcode() == 200: content = response.read() videos = util.extractAll(content, '<td width="40%" align="center">', '/td>') for video in videos: params = {'play':1} params['video'] = WEB_PAGE_BASE + util.extract(video, 'a href="', '\"') params['image'] = WEB_PAGE_BASE + util.extract(video, 'img src="', '\"') params['title'] = util.extract(video, '<p align="center">', '</p>') link = util.makeLink(params) util.addMenuItem(params['title'], link, 'DefaultVideo.png', params['image'], False) util.endListing() else: util.showError(ADDON_ID, 'Could not open URL %s to create menu' % (url))
def buildMenu(): url = WEB_PAGE_BASE + '/livetv' response = urllib2.urlopen(url) if response and response.getcode() == 200: content = response.read() video = util.extract(content, '<a class="channel_link"', '</a>') params = {'play':1} params['video'] = WEB_PAGE_BASE + util.extract(video,'href="','\"') params['image'] = util.extract(video,'img src="','\"') params['title'] = util.extract(video,'channel="','\"') link = util.makeLink(params) util.addMenuItem(params['title'], link, 'DefaultVideo.png', params['image'], False) else: util.showError(ADDON_ID, 'Could not open URL %s to create menu' %(url))
def buildPlay(inputParams): url = WEB_PAGE_BASE + inputParams['link'] response = urllib2.urlopen(url) if response and response.getcode() == 200: content = response.read() links = util.extractAll(content, '<div class="col">', '</span>') for link in links: params = {'makePlay':1} params['title'] = util.extract(link,'data-original-title="','\"') params['link'] = util.extract(link,'href="','\"') params['image'] = util.extract(link,'img src="','"') link = util.makeLink(params) util.addMenuItem(params['title'], link, params['image'], params['image'], True) util.endListing() xbmc.executebuiltin("Container.SetViewMode(506)") else: util.showError(ADDON_ID, 'Could not open URL SHOW %s to create menu' %(url))
def buildMenu(): url = WEB_PAGE_BASE response = urllib2.urlopen(url) if response and response.getcode() == 200: content = response.read() videos = util.extractAll(content, '<video duration', '</video>') for video in videos: params = {'play': 1} params['video'] = util.extract(video, 'video_id="', '"') params['image'] = util.extract(video, 'default_thumb="', '"') params['title'] = util.extract(video, '<title><![CDATA[', ']]') link = util.makeLink(params) util.addMenuItem(params['title'], link, 'DefaultVideo.png', params['image'], False) util.endListing() else: util.showError(ADDON_ID, 'Could not open URL %s to create menu' % (url))
def buildMenu(): url = WEB_PAGE_BASE response = urllib2.urlopen(url) if response and response.getcode() == 200: content = response.read() params = {} videos = util.extractInfo(content, STARTSTRING, ENDSTRING) for video in videos: linkTitle = util.makeTitle(video) params = {'play':1} params['video'] = 'http://www.tvkstella.pl/play.php?id=%s' % video params['image'] = 'http://www.tvkstella.pl/img/nowe/%s.jpg' % video params['title'] = linkTitle link = util.makeLink(params) util.addMenuItem(linkTitle, link, 'DefaultVideo.png', params['image'], False) util.endListing() else: util.showError(ADDON_ID, 'Could not open URL %s to create menu' % (url))
def buildCategories(): url = WEB_PAGE_BASE + '/the-loai/music' response = urllib2.urlopen(url) if response and response.getcode() == 200: content = response.read() links = util.extractAll(content, 'idscroll="', '<ul class="thumn">') for link in links: params = {'makeCategories':1} params['link'] = util.extract(link,'href="','\"') params['title'] = util.extract(link,'/1">','</a>') link = util.makeLink(params) util.addMenuItem(params['title'], link, 'DefaultVideo.png', 'DefaultVideo.png', True) util.endListing() xbmc.executebuiltin("Container.SetViewMode(506)") else: util.showError(ADDON_ID, 'Could not open URL CATEGORIES %s to create menu' %(url))
def buildMenu(): url = 'http://play.fpt.vn/' response = urllib2.urlopen(url) if response and response.getcode() == 200: content = response.read() makeLinks = util.extract(content, '"nav navbar-nav menu"', '</ul>') links = util.extractAll(makeLinks,'<li >','a>') for link in links: params = {'key':'makeMenu'} params['link'] = util.extract(link,'href="','\"') params['title'] = util.extract(link,'\">','</') link = util.makeLink(params) util.addMenuItem(params['title'], link, 'DefaultVideo.png', 'DefaultVideo.png', True) util.endListing() xbmc.executebuiltin("Container.SetViewMode(500)") else: util.showError(ADDON_ID, 'Could not open URL CATEGORIES %s to create menu' %(url))
def buildMenu(): url = WEB_PAGE_BASE + '/livetv' response = urllib2.urlopen(url) if response and response.getcode() == 200: content = response.read() videos = util.extractAll(content, '<a class="channel_link"', '</a>') for video in videos: params = {'play': 1} params['video'] = WEB_PAGE_BASE + util.extract( video, 'href="', '\"') params['image'] = util.extract(video, 'img src="', '\"') params['title'] = util.extract(video, 'channel="', '\"') link = util.makeLink(params) util.addMenuItem(params['title'], link, 'DefaultVideo.png', params['image'], False) xbmc.executebuiltin("Container.SetViewMode(52)") util.endListing() else: util.showError(ADDON_ID, 'Could not open URL %s to create menu' % (url))
def buildMenu(): url = WEB_PAGE_BASE + 'tv_rec.php' response = urllib2.urlopen(url) if response and response.getcode() == 200: content = response.read() videos = util.extractAll(content, '<td class="td_ser">', '</td>') for video in videos: params = {'play': 1} params['video'] = WEB_PAGE_BASE + util.extract( video, '<a href="', '"') params['image'] = "" params['title'] = util.extract( video, 'title="', '"').decode('windows-1251').encode('utf-8') link = util.makeLink(params) util.addMenuItem(params['title'], link, 'DefaultVideo.png', params['image'], False) util.endListing() else: util.showError(ADDON_ID, 'Could not open URL %s to create menu' % (url))
def listGames(params, fanart=None, my_string=None): emu_core = params['c'] roms_folder = params['f'] #pattern = ".*\..*" #pattern = ".*\.(jpg|png|JPG|PNG|txt|TXT|nfo|NFO)$" pattern = "^.*\.(?!jpg$|png$|JPG$|PNG$|txt$|TXT$|nfo$|NFO$).+$" #regexObj = re.compile(".*\.so") for root, dirs, files in os.walk(roms_folder, topdown=False): for file in filter(lambda x: re.match(pattern, x), files): myParam = {} myParam['c'] = emu_core myParam['r'] = os.path.join(roms_folder, str(file)) util.addMenuItem(util.removeExtensions(str(file)), util.makeLink(myParam), icon=util.findIcon(roms_folder, str(file)), thumbnail=None, folder=True, fanart=fanart)
def buildPlay(inputParams): url = WEB_PAGE_BASE + inputParams['link'] response = urllib2.urlopen(url) if response and response.getcode() == 200: content = response.read() links = util.extract(content, 'a href="#">«', 'href="#">»') extractLinks = util.extractAll(links,'a href="','"') for link in extractLinks: params = {'key':'makePlaymakePlay'} params['title'] = util.extractTitle(link) params['link'] = link params['image'] = inputParams['image'] link = util.makeLink(params) util.addMenuItem(params['title'], link, params['image'], params['image'], False) util.endListing() xbmc.executebuiltin("Container.SetViewMode(500)") else: util.showError(ADDON_ID, 'Could not open URL PLAY %s to create menu' %(url))
def searchp(params): url = (params['url']) videoPage = requests.get(url) if videoPage and videoPage.status_code == 200: cont = videoPage.text vidlinks = util.extractAll(cont, '<div id="tab', '/div>') for vidlink in vidlinks: t = util.extract(vidlink, '://', '/') v = util.extract(vidlink, 'SRC="', '"') or util.extract( vidlink, 'src="', '"') paramz = {'play': 1} paramz['title'] = t paramz['videolink'] = v paramz['image'] = icon link = util.makeLink(paramz) util.addMenuItem(paramz['title'], link, paramz['image'], None, False) util.endListing() else: util.showError(ADDON_ID, 'Could not open URL %s to create menu' % (url))
def special(params): page = int(params['page']) p = 'page:' + str(page) util.addMenuItem(p, None, None, None, False) % (page) Baseurl = 'http://el7l.tv/online2/13/%D8%A7%D9%81%D9%84%D8%A7%D9%85_%D8%B9%D8%B1%D8%A8%D9%8A%D8%A9_%D9%84%D9%84%D9%83%D8%A8%D8%A7%D8%B1_%D9%81%D9%82%D8%B7/' url = Baseurl + '%d.html' % (page) response = requests.get(url) if response and response.status_code == 200: cont = response.text videos = util.extractAll(cont, '<div class="file_index">', '/div>') for video in videos: t = util.extract(video, 'alt="', '"') v = util.extract(video, 'a href="http://el7l.tv/online', '"') vp = 'http://el7l.tv/play' + v i = util.extract(video, 'img src="', '"') params = {'listing': 1} params['title'] = t params['video'] = vp params['image'] = i link = util.makeLink(params) util.addMenuItem(params['title'], link, 'DefaultVideo.png', params['image'], True) else: util.showError(ADDON_ID, 'Could not open URL %s to create menu' % (url)) parms = {'spec': 1, 'page': str(page + 1)} page_link = util.makeLink(parms) util.addMenuItem('Next Page:>> ', page_link, None, None, True) util.endListing()
def getTaggedEpisodes(tag): if tag == "now%20and%20then": url = "http://api.brightcove.com/services/library?command=search_videos&token=1N4JCL3KisuyvNlDIPdrJGpatQ1dVXuaCRtD88vFyCqx6Va1G_yGtg..&video_fields=id,name,videoStillURL,tags&sort_by=start_date:desc&any=custom_fields:" + tag elif tag == "channel%208%20debate": url = "http://api.brightcove.com/services/library?command=search_videos&token=1N4JCL3KisuyvNlDIPdrJGpatQ1dVXuaCRtD88vFyCqx6Va1G_yGtg..&video_fields=id,name,videoStillURL,tags&sort_by=start_date:desc&any=custom_fields:" + tag else: url = "http://api.brightcove.com/services/library?command=search_videos&token=1N4JCL3KisuyvNlDIPdrJGpatQ1dVXuaCRtD88vFyCqx6Va1G_yGtg..&video_fields=id,name,videoStillURL,tags&sort_by=start_date:desc&all=tag:" + tag response = urllib2.urlopen(url) if response and response.getcode() == 200: content = response.read() episodes = json.loads(content) for episode in episodes['items']: params = {'episode': 1} params['label'] = episode['name'] params['id'] = episode['id'] params['thumb'] = episode['videoStillURL'] thumb = episode['videoStillURL'] link = util.makeLink(params) util.addMenuItem(params['label'], link, thumb, thumb, False) util.endListing() else: util.showError('plugin.video.nottstv', 'Could not open URL %s to create menu' % (url)) pass
def showLiveTV(): ipaddress = addon.getSetting("ipaddress") if ipaddress == '': xbmc.executebuiltin( 'XBMC.Notification(Info:,"IP Address Not Set",3000,' + addon.getAddonInfo('icon') + ')') else: playlist = "http://" + ipaddress + "/Live/Channels/getList?tvOnly=0&avoidHD=0&allowHidden=0&fields=name,id,zap,isDVB,hidden,rank,isHD,logo" response = urllib2.urlopen(playlist) if response and response.getcode() == 200: channels = json.loads(response.read()) for channel in channels: if channel['hidden'] == False and (channel['zap'] < 225 or channel['zap'] > 300): params = {'playlivetv': 1} params['label'] = str( channel['zap']) + ' ' + channel['name'] params[ 'url'] = "http://" + ipaddress + "/Live/Channels/get?channelId=" + channel[ 'id'] params['id'] = channel['id'] if channel.has_key('logo') == True: params['thumb'] = channel['logo'] else: params[ 'thumb'] = "http://" + ipaddress + "/Live/Channels/getLogo?zap=" + str( channel['zap']) params['zap'] = channel['zap'] thumb = params['thumb'] util.addMenuItem(params['label'], util.makeLink(params), thumb, thumb, False) util.endListing() else: util.notify('plugin.video.eetv', 'Could not open URL %s to create menu' % (url)) pass
def showMainMenu(): params = {'livetv': 1, 'foo': 'bar'} link = util.makeLink(params) util.addMenuItem('Live TV', link, 'DefaultVideo.png', 'DefaultVideo.png', True) params = {'arqivamenu': 1} link = util.makeLink(params) util.addMenuItem('Arqiva Connect', link, 'DefaultVideo.png', 'DefaultVideo.png', True) params = {'recordings': 'no'} link = util.makeLink(params) util.addMenuItem('Recordings', link, 'DefaultVideo.png', 'DefaultVideo.png', True) util.endListing() pass
def buildMenu(fanart=None, searchString='SEARCH'): if util.getConfig("core_1_lib"): myParam = {} myParam['f'] = util.getConfig("core_1_folder") myParam['c'] = util.getCoreName(util.getConfig("core_1_lib")) myParam['l'] = util.getConfig("core_1_lib") myIcon = util.getCoreIcon(myParam['l']) util.addMenuItem(util.getCoreNiceName(util.getConfig("core_1_lib")), util.makeLink(myParam), icon=myIcon, thumbnail=None, folder=True, fanart=fanart) if util.getConfig("core_2_lib"): myParam = {} myParam['f'] = util.getConfig("core_2_folder") myParam['c'] = util.getCoreName(util.getConfig("core_2_lib")) myParam['l'] = util.getConfig("core_2_lib") myIcon = util.getCoreIcon(myParam['l']) util.addMenuItem(util.getCoreNiceName(util.getConfig("core_2_lib")), util.makeLink(myParam), icon=myIcon, thumbnail=None, folder=True, fanart=fanart) if util.getConfig("core_3_lib"): myParam = {} myParam['f'] = util.getConfig("core_3_folder") myParam['c'] = util.getCoreName(util.getConfig("core_3_lib")) myParam['l'] = util.getConfig("core_3_lib") myIcon = util.getCoreIcon(myParam['l']) util.addMenuItem(util.getCoreNiceName(util.getConfig("core_3_lib")), util.makeLink(myParam), icon=myIcon, thumbnail=None, folder=True, fanart=fanart) if util.getConfig("core_4_lib"): myParam = {} myParam['f'] = util.getConfig("core_4_folder") myParam['c'] = util.getCoreName(util.getConfig("core_4_lib")) myParam['l'] = util.getConfig("core_4_lib") myIcon = util.getCoreIcon(myParam['l']) util.addMenuItem(util.getCoreNiceName(util.getConfig("core_4_lib")), util.makeLink(myParam), icon=myIcon, thumbnail=None, folder=True, fanart=fanart) if util.getConfig("core_5_lib"): myParam = {} myParam['f'] = util.getConfig("core_5_folder") myParam['c'] = util.getCoreName(util.getConfig("core_5_lib")) myParam['l'] = util.getConfig("core_5_lib") myIcon = util.getCoreIcon(myParam['l']) util.addMenuItem(util.getCoreNiceName(util.getConfig("core_5_lib")), util.makeLink(myParam), icon=myIcon, thumbnail=None, folder=True, fanart=fanart) if util.getConfig("core_6_lib"): myParam = {} myParam['f'] = util.getConfig("core_6_folder") myParam['c'] = util.getCoreName(util.getConfig("core_6_lib")) myParam['l'] = util.getConfig("core_6_lib") myIcon = util.getCoreIcon(myParam['l']) util.addMenuItem(util.getCoreNiceName(util.getConfig("core_6_lib")), util.makeLink(myParam), icon=myIcon, thumbnail=None, folder=True, fanart=fanart) if util.getConfig("core_7_lib"): myParam = {} myParam['f'] = util.getConfig("core_7_folder") myParam['c'] = util.getCoreName(util.getConfig("core_7_lib")) myParam['l'] = util.getConfig("core_7_lib") myIcon = util.getCoreIcon(myParam['l']) util.addMenuItem(util.getCoreNiceName(util.getConfig("core_7_lib")), util.makeLink(myParam), icon=myIcon, thumbnail=None, folder=True, fanart=fanart) if util.getConfig("core_8_lib"): myParam = {} myParam['f'] = util.getConfig("core_8_folder") myParam['c'] = util.getCoreName(util.getConfig("core_8_lib")) myParam['l'] = util.getConfig("core_8_lib") myIcon = util.getCoreIcon(myParam['l']) util.addMenuItem(util.getCoreNiceName(util.getConfig("core_8_lib")), util.makeLink(myParam), icon=myIcon, thumbnail=None, folder=True, fanart=fanart) if util.getConfig("core_9_lib"): myParam = {} myParam['f'] = util.getConfig("core_9_folder") myParam['c'] = util.getCoreName(util.getConfig("core_9_lib")) myParam['l'] = util.getConfig("core_9_lib") myIcon = util.getCoreIcon(myParam['l']) util.addMenuItem(util.getCoreNiceName(util.getConfig("core_9_lib")), util.makeLink(myParam), icon=myIcon, thumbnail=None, folder=True, fanart=fanart) if util.getConfig("core_10_lib"): myParam = {} myParam['f'] = util.getConfig("core_10_folder") myParam['c'] = util.getCoreName(util.getConfig("core_10_lib")) myParam['l'] = util.getConfig("core_10_lib") myIcon = util.getCoreIcon(myParam['l']) util.addMenuItem(util.getCoreNiceName(util.getConfig("core_10_lib")), util.makeLink(myParam), icon=myIcon, thumbnail=None, folder=True, fanart=fanart) if util.getConfig("core_11_lib"): myParam = {} myParam['f'] = util.getConfig("core_11_folder") myParam['c'] = util.getCoreName(util.getConfig("core_11_lib")) myParam['l'] = util.getConfig("core_11_lib") myIcon = util.getCoreIcon(myParam['l']) util.addMenuItem(util.getCoreNiceName(util.getConfig("core_11_lib")), util.makeLink(myParam), icon=myIcon, thumbnail=None, folder=True, fanart=fanart) if util.getConfig("core_12_lib"): myParam = {} myParam['f'] = util.getConfig("core_12_folder") myParam['c'] = util.getCoreName(util.getConfig("core_12_lib")) myParam['l'] = util.getConfig("core_12_lib") myIcon = util.getCoreIcon(myParam['l']) util.addMenuItem(util.getCoreNiceName(util.getConfig("core_12_lib")), util.makeLink(myParam), icon=myIcon, thumbnail=None, folder=True, fanart=fanart) if util.getConfig("core_13_lib"): myParam = {} myParam['f'] = util.getConfig("core_13_folder") myParam['c'] = util.getCoreName(util.getConfig("core_13_lib")) myParam['l'] = util.getConfig("core_13_lib") myIcon = util.getCoreIcon(myParam['l']) util.addMenuItem(util.getCoreNiceName(util.getConfig("core_13_lib")), util.makeLink(myParam), icon=myIcon, thumbnail=None, folder=True, fanart=fanart) if util.getConfig("core_14_lib"): myParam = {} myParam['f'] = util.getConfig("core_14_folder") myParam['c'] = util.getCoreName(util.getConfig("core_14_lib")) myParam['l'] = util.getConfig("core_14_lib") myIcon = util.getCoreIcon(myParam['l']) util.addMenuItem(util.getCoreNiceName(util.getConfig("core_14_lib")), util.makeLink(myParam), icon=myIcon, thumbnail=None, folder=True, fanart=fanart) if util.getConfig("core_15_lib"): myParam = {} myParam['f'] = util.getConfig("core_15_folder") myParam['c'] = util.getCoreName(util.getConfig("core_15_lib")) myParam['l'] = util.getConfig("core_15_lib") myIcon = util.getCoreIcon(myParam['l']) util.addMenuItem(util.getCoreNiceName(util.getConfig("core_15_lib")), util.makeLink(myParam), icon=myIcon, thumbnail=None, folder=True, fanart=fanart) # Add direct call to retroarch menu myParam = {} myParam['m'] = "show+menu" util.addMenuItem(EMU_MENU_LABEL, util.makeLink(myParam), icon=None, thumbnail=None, folder=True, fanart=fanart)
def showRecordings(show_series): ipaddress = addon.getSetting("ipaddress") if ipaddress == '': xbmc.executebuiltin( 'XBMC.Notification(Info:,"IP Address Not Set",3000,' + addon.getAddonInfo('icon') + ')') else: recordings = "http://" + ipaddress + "/PVR/Records/getList?type=regular&avoidHD=0&tvOnly=0" try: response = urllib2.urlopen(recordings) if response and response.getcode() == 200: path = addon.getAddonInfo('path') recordings = json.loads(response.read()) recordings_array = [] known_series = {} # Need to sort by event.name for rec in recordings: if rec['event'].has_key('serieId'): series_id = rec['event']['serieId'] else: series_id = "n/a" if series_id == show_series or (series_id == 'n/a' and show_series == 'no'): # Showing the series I wish to show, or the episode was not in a series, therefore we want to show the episode params = {'playrecording': 1} params['id'] = rec['id'] if rec['event'].has_key('icon'): params['icon'] = rec['event']['icon'] else: params['icon'] = "DefaultVideo.png" if rec['event'].has_key('description'): params['plot'] = rec['event']['description'] else: params['plot'] = "" params['label'] = rec['event']['name'] start = datetime.datetime.fromtimestamp( rec['event']['startTime']) start = start.strftime("%d/%m/%Y %H:%M") params['label'] = params['label'] + " : " + start start = datetime.datetime.fromtimestamp( rec['event']['startTime']) start = start.strftime("%Y-%m-%d %H:%M") params['sort_label'] = params['label'] + " : " + start recordings_array.append(params) elif known_series.has_key( series_id) == False and show_series == 'no': # Showing a placeholder to the series menu params = {'recordings': series_id} params['id'] = rec['id'] if rec['event'].has_key('icon'): params['icon'] = rec['event']['icon'] else: params['icon'] = "DefaultVideo.png" if rec['event'].has_key('description'): params['plot'] = rec['event']['description'] else: params['plot'] = "" params['label'] = rec['event']['name'] + " >> " params['sort_label'] = params['label'] recordings_array.append(params) known_series[series_id] = True recordings_array.sort(key=lambda x: x['sort_label'], reverse=False) for rec in recordings_array: print rec['label'] + " : " + rec['sort_label'] if rec.has_key('recordings'): isFolder = True else: isFolder = False util.addMenuItem(rec['label'], util.makeLink(rec), rec['icon'], rec['icon'], isFolder, rec['plot']) util.endListing() else: xbmc.executebuiltin( 'XBMC.Notification(Info:,"Is the EE Box Turned On?",3000,' + addon.getAddonInfo('icon') + ')') except urllib2.HTTPError as e: reply = e.read() if reply.find('Error 503'): dialog = xbmcgui.Dialog() turnon = dialog.yesno( "Turn EE TV Box On?", "It looks like your EE TV Box is in standby.", "Would you like to press the on/off button?", "", "No", "Yes") if turnon: power_on = "http://" + ipaddress + "/RemoteControl/KeyHandling/sendKey?avoidLongPress=1&key=on_off" try: urllib2.urlopen(power_on) xbmc.executebuiltin( 'XBMC.Notification(Info:,"Your EE TV Box should be waking up, please wait a few seconds and try again.",10000,' + addon.getAddonInfo('icon') + ')') except urllib2.HTTPError as e: reply = e.read() xbmc.executebuiltin( 'XBMC.Notification(Info:,"Error : ' + reply + '",10000,' + addon.getAddonInfo('icon') + ')') else: xbmc.executebuiltin('XBMC.Notification(Info:,"Error : ' + reply + '",10000,' + addon.getAddonInfo('icon') + ')') #xbmc.executebuiltin('XBMC.Notification(Info:,"HTTP ERROR Is the EE Box Turned On?",3000,'+addon.getAddonInfo('icon')+')') pass