def MENUTYPE_1(url,firstpage=False):#11 #i = cache_list_stored() #stuff = '' response = webcache.request(url,ttl=1800)#cache it for 30min response = response.decode('utf-8') response = response.encode('ascii','ignore') #print excepttion match=re.compile(u'<td valign="top">(.+?)</table>', re.DOTALL).findall(response) for entry in match: match_name_a=re.compile('<div divType="prog_name".+?>(.+?)</div>').findall(entry) name_a = match_name_a[0] log('name_a: '+name_a) match_name_b=re.compile('title="(.+?)"').findall(entry) name_b = match_name_b[0] #print name_b #print name_b.encode('ascii','ignore') log('name_b: '+name_b) match_onclick=re.compile('onclick="(.+?)"').findall(entry) onclick = match_onclick[0] log('onclick: '+onclick) match_video=re.compile("'(.+?)'").findall(onclick) video = match_video[2] log('video: '+video) sd = match_video[4] log('sd: '+sd) match_thumb=re.compile('src="(.+?)"').findall(entry) thumb = match_thumb[0] replacement=re.compile('/s/(.+?)/').findall(video) if len(replacement) != 0 and replacement[0] != 'nhl': thumb = thumb.replace('/u/www/','/u/'+replacement[0]+'/')#for the team specific urls, idk why they do that log('thumb: '+thumb) name = name_a+' - '+name_b #name = name.replace(''',"'") #name_a = name_a.replace(''',"'") if sd == '1': video = video.replace('.mp4',u'_sd.mp4') #stuff = stuff + '<vid>'+name_a+'|'+video+'|'+'11'+'|'+thumb+'|'+name_b+'</vid>' addLink(html_parser.unescape(fix_name(name_a)),video,12,thumb,html_parser.unescape(fix_name(name_b))) #cache_store(stuff) if 'NÄCHSTE</a>' in response or 'NEXT</a>' in response: match_onclick=re.compile('onclick="(.+?)"').findall(response) if not '_search.searchMoviesByPage' in response: match_next=re.compile('\(\'(.+?)\',(.+?)\)').findall(match_onclick[-2]) menuid,page = match_next[0] else: match_next=re.compile('\((.+?)\)').findall(match_onclick[-2]) page = match_next[0] currentpage=re.compile('&pn=(.+?)&').findall(url) url = url.replace('&pn='+currentpage[0],'&pn='+page) addDir(__language__(30001).encode("utf-8"),url,11,'') if firstpage == False: if __settings__.getSetting('back_hidden') != 'true': i = i + 1 try: wnd = xbmcgui.Window(xbmcgui.getCurrentWindowId()) wnd.getControl(wnd.getFocusId()).selectItem(i) except: log('focusing not possible') xbmcplugin.endOfDirectory(int(sys.argv[1]), updateListing=True)
def LIST_VIDEOCENTER(url):#5 response = webcache.request(url,ttl=86400) match=re.compile('<table id="tblMenu".+?>(.+?)</div>', re.DOTALL).findall(response) #print match[0] match_topics=re.compile('<tr>(.+?)</table>', re.DOTALL).findall(match[0]) #match_topics=match[0].split('</table>') for topic in match_topics: #print topic match_name=re.compile('<td style.+?>(.+?)/td>', re.DOTALL).findall(topic) #match_name=re.compile('<td.+?>(.+?)</td>', re.DOTALL).findall(topic) name_a = match_name[0].replace('\n','').replace('<','') name_b = match_name[1].replace('\n','').replace('<','') #log('name_a: '+name_a) #log('name_b: '+name_b) match_id=re.compile('id="(.+?)"').findall(topic) id = match_id[0] #log('id: '+id) match_menuindex=re.compile('menuindex="(.+?)"').findall(topic) menuindex = match_menuindex[0] #log('menuindex: '+menuindex) match_menuid=re.compile('menuid="(.+?)"').findall(topic) menuid = match_menuid[0] #log('menuid: '+menuid) match_menutype=re.compile('menutype="(.+?)"').findall(topic) menutype = match_menutype[0] #log('menutype: '+menutype) name = name_a+' - '+name_b if menutype == '1': newurl = mainurl+'servlets/guide?channeldays=7&cid='+menuid+'&ispaging=false&large=true&menuChannelId='+menuid+'&menuChannelIndex='+menuindex+'&pn=1&ps=7&ptrs=3' addDir(fix_name(name_a),newurl,10,'',name_b) elif menutype == '0': newurl = mainurl+'servlets/browse?cid='+menuid+'&component=_browse&ispaging=false&large=true&menuChannelId='+menuid+'&menuChannelIndex='+menuindex+'&pm=0&pn=1&ps=12&ptrs=3' addDir(fix_name(name_a),newurl,10,'',name_b) elif menutype == '4': newurl = mainurl+'servlets/guide?channeldays=7&cid='+menuid+'&ispaging=false&large=true&menuChannelId='+menuid+'&menuChannelIndex='+menuindex+'&pn=1&ps=7&ptrs=3' addDir(fix_name(name_a),newurl,10,'',name_b) #log('Menutype not used: '+menutype) #log('Livestreams not working') elif menutype == '5': log('Menutype not used: '+menutype) log('Podcasts not working') elif menutype == '100': if url[-1] == '/': newurl = url else: newurl = url + '/' addDir(fix_name(name_a),newurl,1,'',fix_name(name_b)) else: log('Menutype not used: '+menutype) log('Name: '+fix_name(name))
def RESULTS(url,cache=True):#3 #link = getUrl(mainurl+'highlights'+url) if cache: link = webcache.request(url,ttl=2592000)#cache it for a month if it is not an active month else: link = webcache.request(url,ttl=1800)#cache it for 30min else match=re.compile('<game>(.+?)</game>', re.DOTALL).findall(link) for game in match: """ date = 'DATE' guestname = 'GUESTNAME' guestcity = 'GUESTCITY' guestgoals = 'GUESTGOALS' homename = 'HOMENAME' homecity = 'MOMECITY' homegoals = 'HOMEGOALS' url = 'URL' possiblethumb = 'POSSIBLETHUMB' """ match_date=re.compile('<game-date>(.+?)</game-date>', re.DOTALL).findall(game) match_guest=re.compile('<away-team>(.+?)</away-team>', re.DOTALL).findall(game) match_guest_name=re.compile('<name>(.+?)</name>', re.DOTALL).findall(match_guest[0]) match_guest_city=re.compile('<city>(.+?)</city>', re.DOTALL).findall(match_guest[0]) match_guest_goals=re.compile('<goals>(.+?)</goals>', re.DOTALL).findall(match_guest[0]) match_guest_logo=re.compile('<logo-40px>(.+?)</logo-40px>', re.DOTALL).findall(match_guest[0]) match_home=re.compile('<home-team>(.+?)</home-team>', re.DOTALL).findall(game) match_home_name=re.compile('<name>(.+?)</name>', re.DOTALL).findall(match_home[0]) match_home_city=re.compile('<city>(.+?)</city>', re.DOTALL).findall(match_home[0]) match_home_goals=re.compile('<goals>(.+?)</goals>', re.DOTALL).findall(match_home[0]) match_home_logo=re.compile('<logo-40px>(.+?)</logo-40px>', re.DOTALL).findall(match_home[0]) match_url=re.compile('<alt-video-clip>(.+?)</alt-video-clip>', re.DOTALL).findall(game) match_duration=re.compile('<video-duration>(.+?)</video-duration>', re.DOTALL).findall(game) match_possiblethumb=re.compile('<video-clip-thumbnail>(.+?)</video-clip-thumbnail>', re.DOTALL).findall(game) date = match_date[0] MM,DD,YYYY=date.split('/') guestname = match_guest_name[0] try: guestcity = match_guest_city[0]+' ' except: guestcity = '' guestgoals = match_guest_goals[0] homename = match_home_name[0] try: homecity = match_home_city[0]+' ' except: homecity = '' homegoals = match_home_goals[0] try: duration = match_duration[0] except: duration = False try: url = match_url[0] except: match_rtmp=re.compile('<video-clip>(.+?)</video-clip>', re.DOTALL).findall(game) url = match_rtmp[0]+' swfurl=http://nhl.cdn.neulion.net/u/videocenter/console.swf swfvfy=true' possiblethumb = match_possiblethumb[0] date_thumb = date.split('/') thumb = '' if int(date_thumb[2]) > 2010: thumb = possiblethumb if int(date_thumb[2]) == 2010 and int(date_thumb[0].replace('0','')) > 8: thumb = possiblethumb name = date+' '+homecity+homename+' vs. '+guestcity+guestname if xbmcplugin.getSetting(pluginhandle,"show_score") == 'true': name += ' - '+homegoals+':'+guestgoals name = name.replace('é','é') url = url.replace('<![CDATA[','') url = url.replace(']]>','') thumb = thumb.replace('<![CDATA[','') thumb = thumb.replace(']]>','') thumb = thumb.replace('_es','_eb') #addLinkOld(name,url,thumb,duration) addLinkOld(name,url,thumb,duration,True,match_home_city[0],match_guest_city[0],match_home_name[0],match_guest_name[0],largethumb(match_home_logo[0]),largethumb(match_guest_logo[0]),match_home_goals[0],match_guest_goals[0],DD,MM,YYYY)