Beispiel #1
0
def livefootballvideo_events():
	try:
		source = get_page_source(base_url)
	except: source ="";xbmcgui.Dialog().ok(translate(40000),translate(40128))
	if source:
		match = re.compile('"([^"]+)" alt="[^"]*"/>.*?.*?>([^<]+)</a>\s*</div>\s*<div class="date_time column"><span class="starttime time" rel="[^"]*">([^<]+)</span>.*?<span class="startdate date" rel="[^"]*">([^"]+).*?<span>([^<]+)</span></div>.*?team away column"><span>([^&<]+).*?href="([^"]+)">([^<]+)<').findall(source)
		for icon,comp,timetmp,datetmp,home,away,url,live in match:
			mes_dia = re.compile(', (.+?) (.+?)<').findall(datetmp)
			for mes,dia in mes_dia:
				dia = re.findall('\d+', dia)
				month = translate_months(mes)
				hora_minuto = re.compile('(\d+):(\d+)').findall(timetmp)
				try:
                                        import datetime
					from peertopeerutils import pytzimp
					d = pytzimp.timezone(str(pytzimp.timezone('Atlantic/Azores'))).localize(datetime.datetime(2014, int(month), int(dia[0]), hour=int(hora_minuto[0][0]), minute=int(hora_minuto[0][1])))
					timezona= settings.getSetting('timezone_new')
                                        my_location=pytzimp.timezone(pytzimp.all_timezones[int(timezona)])
                                        convertido=d.astimezone(my_location)
                                        fmt = "%d/%m %H:%M"
                                        time=convertido.strftime(fmt)
					
					if "Online" in live: time = '[B][COLOR green](Online)[/B][/COLOR]'
					else: time = '[B][COLOR orange]' + time + '[/B][/COLOR]'
					addDir(time + ' - [B]('+comp+')[/B] ' + home + ' vs ' + away,url,401,os.path.join(addonpath,'resources','art','football.png'),len(match),True,parser='livefootballvideo',parserfunction='sources')
				except: addDir('[B][COLOR orange]' + timetmp + ' ' + datetmp + '[/B][/COLOR] - [B]('+comp+')[/B] ' + home + ' vs ' + away,url,401,os.path.join(addonpath,'resources','art','football.png'),len(match),True,parser='livefootballvideo',parserfunction='sources')
def livefootballws_events():
	try:
		source = mechanize_browser(base_url)
	except: source = ""; xbmcgui.Dialog().ok(translate(40000),translate(40128))
	if source:
		items = re.findall('<div class="base custom" align="center"(.*?)</center></div><br></div>', source, re.DOTALL)
		number_of_items= len(items)
		for item in reversed(items):
			data = re.compile('<div style="text-align: center;">(.+?)</div>').findall(item)
			try:
				check = re.compile(">.+? (.+?):(.+?)").findall(data[-1].replace("color:",""))
				if not check and "Online" not in data[-1]:pass
				else:
					data_item = data[-1].replace("<strong>","").replace("</strong>","").replace('<span style="color: #008000;">','').replace("</span>","")
					url = re.compile('<a href="(.+?)">').findall(item)
					teams = re.compile('/.+?-(.+?).html').findall(url[0])
					try:
                                                match = re.compile('(.+?) (.+?) (.+?):(.*)').findall(data_item)
                                                import datetime
                                                from peertopeerutils import pytzimp
                                                timezona= settings.getSetting('timezone_new')
                                                d = pytzimp.timezone(str(pytzimp.timezone('Europe/Moscow'))).localize(datetime.datetime(2014, 6, int(match[0][0]), hour=int(match[0][2]), minute=int(match[0][3])))
                                                my_place=pytzimp.timezone(pytzimp.all_timezones[int(timezona)])
                                                convertido=d.astimezone(my_place)
                                                fmt = "%d %H:%M"
                                                time=convertido.strftime(fmt)
                                                addDir("[B][COLOR orange]("+translate(600012)+time+")[/COLOR][/B] "+teams[0],url[0],401,os.path.join(current_dir,'icon.png'),number_of_items,True,parser="livefootballws",parserfunction="streams")
					except:
						if '<span style="color: #000000;">' not in data_item:
							addDir("[B][COLOR green]("+data_item.replace('<br />','')+")[/COLOR][/B] "+teams[0],url[0],401,os.path.join(current_dir,'icon.png'),number_of_items,True,parser="livefootballws",parserfunction="streams")
						else: pass
			except: pass
Beispiel #3
0
def wiziwig_events(url):
    conteudo=clean(get_page_source(url))    
    eventos=re.compile('<div class="date" [^>]+>([^<]+)</div>\s*<span class="time" rel=[^>]+>([^<]+)</span> -\s*<span class="time" rel=[^>]+>([^<]+)</span>\s*</td>\s*<td class="home".+?<img[^>]* src="([^"]*)"[^>]*>([^<]+)<img [^>]+></td>(.*?)<td class="broadcast"><a class="broadcast" href="([^"]+)">Live</a></td>').findall(conteudo)
    for date,time1,time2,icon,team1,palha,url in eventos:
        if re.search('<td class="away">',palha):
            try:team2=' - ' + re.compile('<td class="away"><img.+?>(.+?)<img class="flag"').findall(palha)[0]
            except:team2=''
        else: team2=''
        datefinal=date.split(', ')
	try:
		month_day = re.compile('(.+?) (.*)').findall(datefinal[1])
		monthname = translate_months(month_day[0][0])
		dayname = int(month_day[0][1])
		hourname = int(time1.split(':')[0])
		minutesname = int(time1.split(':')[1])

		import datetime
                from peertopeerutils import pytzimp
                d = pytzimp.timezone(str(pytzimp.timezone('Europe/Madrid'))).localize(datetime.datetime(2014, monthname, dayname, hour=hourname, minute=minutesname))
                timezona= settings.getSetting('timezone_new')
                my_location=pytzimp.timezone(pytzimp.all_timezones[int(timezona)])
                convertido=d.astimezone(my_location)
                fmt = "%m-%d %H:%M"
                time=convertido.strftime(fmt)
		addDir('[B](' + str(time) + ')[/B] ' + team1 + team2,WiziwigURL + url,401,WiziwigURL + icon,len(eventos),True,parser='wiziwig',parserfunction='servers')
	except: addDir('[B](' + datefinal[1] + ' ' + time1 + ')[/B] ' + team1 + team2,WiziwigURL + url,401,WiziwigURL + icon,len(eventos),True,parser='wiziwig',parserfunction='servers')
    page_check = re.compile('<div class="stat">(.+?)pages(.+?)items</div>').findall(conteudo)
    if page_check:
        match = re.compile('.*href="(.+?)">&raquo;</a></li>').findall(conteudo)
        if match:
            addDir('[B][COLOR orange]Next page >>[/B][/COLOR]',WiziwigURL + match[0],401,os.path.join(current_dir,'icon.png'),1,True,parser='wiziwig',parserfunction='events')
    xbmc.executebuiltin("Container.SetViewMode(51)")
Beispiel #4
0
def arenavision_schedule(url):
	headers = {
		"Cookie" : "beget=begetok; has_js=1;"
	}
	try:
		source = requests.get(url,headers=headers).text
	except: source="";xbmcgui.Dialog().ok(translate(40000),translate(40128))
	if source:
		match = re.findall('Bruselas(.*?)</footer>', source, re.DOTALL)
		for event in match:
			eventmatch = re.compile('(\d+)/(\d+)/(\d+) (.+?):(.+?) CET (.+?)<').findall(event)
			for dia,mes,year,hour,minute,evento in eventmatch:
				try:
					import datetime
					from peertopeerutils import pytzimp
					d = pytzimp.timezone(str(pytzimp.timezone('Europe/Madrid'))).localize(datetime.datetime(2000 + int(year), int(mes), int(dia), hour=int(hour), minute=int(minute)))
					timezona= settings.getSetting('timezone_new')
					my_location=pytzimp.timezone(pytzimp.all_timezones[int(timezona)])
					convertido=d.astimezone(my_location)
					fmt = "%d-%m-%y %H:%M"
					time=convertido.strftime(fmt)
				except:
					time='N/A'
				event_array = evento.split('/')
				event_name = ''
				event_channels = []
				i = 1
				for parc in event_array:
					if 'AV' in parc:
						event_channels.append(parc)
				try: addDir('[B][COLOR red]' + time + '[/B][/COLOR] ' + removeNonAscii(clean(event_array[0])),str(event_channels),401,os.path.join(current_dir,"icon.png"),1,False,parser="arenavision",parserfunction="arenavision_chooser")
				except:pass
def arenavision_schedule(url):
	headers = {
		"Cookie" : "beget=begetok; has_js=1;"
	}
	try:
		source = requests.get(url,headers=headers).text
	except: source="";xbmcgui.Dialog().ok(translate(40000),translate(40128))
	if source:
		match = re.findall('(.*?)</tr><tr><td class="auto-style3"', source, re.DOTALL)

		for event in match:
			eventmatch = re.compile('>(\d+)/(\d+)/(\d+)</td>\n<td class="auto-style3" style="width: 182px">(.+?):(.+?) CET</td>\n<td class="auto-style3" style="width: 188px">(.+?)</td>\n<td class="auto-style3" style="width: 283px">(.+?)</td>\n<td class="auto-style3" style="width: 685px">(.+?)<').findall(event)
			iii=1
			for dia,mes,year,hour,minute,modalidade,campeonato,evento in eventmatch:
				try:
					import datetime
					from peertopeerutils import pytzimp
					d = pytzimp.timezone(str(pytzimp.timezone('Europe/Madrid'))).localize(datetime.datetime(2000 + int(year), int(mes), int(dia), hour=int(hour), minute=int(minute)))
					timezona= settings.getSetting('timezone_new')
					my_location=pytzimp.timezone(pytzimp.all_timezones[int(timezona)])
					convertido=d.astimezone(my_location)
					fmt = "%d-%m-%y %H:%M"
					time=convertido.strftime(fmt)
				except:
					time='N/A'
				c1=re.findall('style="width: 317px">(.+?)</td>', event, re.DOTALL)
				c1=c1[0].split()
				c1=[ x for x in c1 if "/>" not in x ]
				for x in range(0,len(c1)):
					if c1[x][0]=='[':
						c1[x]=c1[x][0:4]+"]"
				dic={}
				dic["temp"]=[]
				for x in c1:
					if x[0]=='[':
						if x not in dic:
							dic[x] = dic.pop('temp')
						else:
							dic[x]=dic[x]+dic["temp"]
						dic["temp"]=[]
					else:
						dic["temp"]=dic["temp"]+[x]
				del(dic["temp"])
				event_channels=[]
				cores=["green","orange","blue","white","peru","gold","pink","red","darkcyan"]
				html_escape_table = {"&amp;": "&",'"': "&quot;","'": "&apos;",">": "&gt;","<": "&lt;"}
				flag=0
				for key in dic:
					for canais in dic[key]:
						for canal in canais.split("-"):
							event_channels.append('[B][COLOR '+cores[0]+']'+"AV"+str(canal) + "[/B][/COLOR] "  + '[B][COLOR yellow]' + str(key) + '[/B][/COLOR]')
							if str(canal)[0]=="S":
								del(cores[0])
								flag=1
						if flag!=1:
							del(cores[0])
						flag=0
				evento=evento.replace("&amp;", "&")
				try: addDir('[B][COLOR red]' + time + '[/B][/COLOR] ' + '[B][COLOR green]' + removeNonAscii(clean(modalidade)) + '[/B][/COLOR] '+ '[B][COLOR yellow]' + removeNonAscii(clean(evento)) + '[/B][/COLOR] '+ removeNonAscii(clean(campeonato)),str(event_channels),401,os.path.join(current_dir,"icon.png"),1,False,parser="arenavision",parserfunction="arenavision_chooser")
				except:pass	
Beispiel #6
0
def livefootballvideo_events():
    try:
        source = get_page_source(base_url)
    except:
        source = ""
        xbmcgui.Dialog().ok(translate(40000), translate(40128))
    if source:
        match = re.compile(
            '<a href=".+?" title=".+?">(.+?)</a>\n</div>\n.+?<span class="starttime time" rel=".+?">(.+?)</span>.+?<span class="startdate date".+?rel=".+?">(.+?)/span>.+?\n<div class="team column"><.+?<span>(.+?)</span></div>\n.+?\n.+?class=".+?"><span>(.+?)</span>.+?\n.+?\n<a class=".+?" href="(.+?)">\n(.+?) </a>'
        ).findall(source)
        for comp, timetmp, datetmp, home, away, url, live in match:
            mes_dia = re.compile(', (.+?) (.+?)<').findall(datetmp)
            for mes, dia in mes_dia:
                dia = re.findall('\d+', dia)
                month = translate_months(mes)
                hora_minuto = re.compile('(\d+):(\d+)').findall(timetmp)
                try:
                    import datetime
                    from peertopeerutils import pytzimp
                    d = pytzimp.timezone(
                        str(pytzimp.timezone('Atlantic/Azores'))).localize(
                            datetime.datetime(2014,
                                              int(month),
                                              int(dia[0]),
                                              hour=int(hora_minuto[0][0]),
                                              minute=int(hora_minuto[0][1])))
                    timezona = settings.getSetting('timezone_new')
                    my_location = pytzimp.timezone(
                        pytzimp.all_timezones[int(timezona)])
                    convertido = d.astimezone(my_location)
                    fmt = "%d/%m %H:%M"
                    time = convertido.strftime(fmt)

                    if "Online" in live:
                        time = '[B][COLOR green](Online)[/B][/COLOR]'
                    else:
                        time = '[B][COLOR orange]' + time + '[/B][/COLOR]'
                    addDir(time + ' - [B](' + comp + ')[/B] ' + home + ' vs ' +
                           away,
                           url,
                           401,
                           os.path.join(addonpath, 'resources', 'art',
                                        'football.png'),
                           len(match),
                           True,
                           parser='livefootballvideo',
                           parserfunction='sources')
                except:
                    addDir('[B][COLOR orange]' + timetmp + ' ' + datetmp +
                           '[/B][/COLOR] - [B](' + comp + ')[/B] ' + home +
                           ' vs ' + away,
                           url,
                           401,
                           os.path.join(addonpath, 'resources', 'art',
                                        'football.png'),
                           len(match),
                           True,
                           parser='livefootballvideo',
                           parserfunction='sources')
Beispiel #7
0
def arenavision_schedule(url):
    headers = {"Cookie": "beget=begetok; has_js=1;"}
    try:
        source = requests.get(url, headers=headers).text
    except:
        source = ""
        xbmcgui.Dialog().ok(translate(40000), translate(40128))
    if source:
        match = re.findall('Bruselas(.*?)</footer>', source, re.DOTALL)
        for event in match:
            eventmatch = re.compile(
                '(\d+)/(\d+)/(\d+) (.+?):(.+?) CET (.+?)<').findall(event)
            for dia, mes, year, hour, minute, evento in eventmatch:
                try:
                    import datetime
                    from peertopeerutils import pytzimp
                    d = pytzimp.timezone(str(
                        pytzimp.timezone('Europe/Madrid'))).localize(
                            datetime.datetime(2000 + int(year),
                                              int(mes),
                                              int(dia),
                                              hour=int(hour),
                                              minute=int(minute)))
                    timezona = settings.getSetting('timezone_new')
                    my_location = pytzimp.timezone(
                        pytzimp.all_timezones[int(timezona)])
                    convertido = d.astimezone(my_location)
                    fmt = "%d-%m-%y %H:%M"
                    time = convertido.strftime(fmt)
                except:
                    time = 'N/A'
                event_array = evento.split('/')
                event_name = ''
                event_channels = []
                i = 1
                for parc in event_array:
                    if 'AV' in parc:
                        event_channels.append(parc)
                try:
                    addDir('[B][COLOR red]' + time + '[/B][/COLOR] ' +
                           removeNonAscii(clean(event_array[0])),
                           str(event_channels),
                           401,
                           os.path.join(current_dir, "icon.png"),
                           1,
                           False,
                           parser="arenavision",
                           parserfunction="arenavision_chooser")
                except:
                    pass
Beispiel #8
0
def rojadirecta_events():
	try:
		source = get_page_source(base_url)
	except: source = "";xbmcgui.Dialog().ok(translate(40000),translate(40128))
	if source:
		match = re.findall('<span class="(\d+)".*?<div class="menutitle".*?<span class="t">([^<]+)</span>(.*?)</div>',source,re.DOTALL)
		for id,time,eventtmp in match:
			try:
                                import datetime
                                from peertopeerutils import pytzimp
                                d = pytzimp.timezone(str(pytzimp.timezone('Europe/Madrid'))).localize(datetime.datetime(2014, 6, 7, hour=int(time.split(':')[0]), minute=int(time.split(':')[-1])))
                                timezona= settings.getSetting('timezone_new')
                                my_location=pytzimp.timezone(pytzimp.all_timezones[int(timezona)])
                                convertido=d.astimezone(my_location)
                                fmt = "%H:%M"
                                time=convertido.strftime(fmt)
			except:pass
    			eventnospanish = re.compile('<span class="es">(.+?)</span>').findall(eventtmp)
    			if eventnospanish:
        			for spanishtitle in eventnospanish:
            				eventtmp = eventtmp.replace('<span class="es">' + spanishtitle + '</span>','')
    			eventclean=eventtmp.replace('<span class="en">','').replace('</span>','').replace(' ()','').replace('</time>','').replace('<span itemprop="name">','')
			matchdois = re.compile('(.*)<b>\s*(.*?)\s*</b>').findall(eventclean)	
    			for sport,event in matchdois:
        			express = '<span class="submenu" id="sub' + id+ '">.*?</span>\s*</span>'
        			streams = re.findall(express,source,re.DOTALL)
        			print streams
        			for streamdata in streams:        			
            				p2pstream = re.compile('<td>P2P</td>\n.+?<td>([^<]*)</td>\n.+?<td>([^<]*)</td>\n.+?<td>([^<]*)</td>\n.+?<td>([^<]*)</td>\n.+?<td><b><a.+?href="(.+?)"').findall(streamdata)
            				already = False
            				for canal,language,tipo,qualidade,urltmp in p2pstream:
               					if "Sopcast" in tipo or "Acestream" in tipo:
                    					if already == False:
                        					addLink("[B][COLOR orange]"+time+ " - " + sport + " - " + event + "[/B][/COLOR]",'',os.path.join(current_dir,'icon.png'))
                       						already = True
							if "ArenaVision" in canal: thumbnail = os.path.join(current_dir,'media','arenavisionlogo.png')
							elif "Vertigo" in canal: thumbnail = os.path.join(current_dir,'media','vertigologo.png')
							elif "Vikingo" in canal: thumbnail = os.path.join(current_dir,'media','vikingologo.png')
							elif "futbolsinlimites" in canal: thumbnail = os.path.join(current_dir,'media','futbolsinlimiteslogo.png')
							elif "La Catedral" in canal: thumbnail = os.path.join(current_dir,'media','lacatedrallogo.png')
							else: thumbnail = os.path.join(current_dir,'icon.png')
                   					addDir("[B]["+tipo.replace("<","").replace(">","")+"][/B]-"+canal.replace("<","").replace(">","")+" - ("+language.replace("<","").replace(">","")+") - ("+qualidade.replace("<","").replace(">","")+" Kbs)",urltmp.replace("goto/",""),401,thumbnail,43,False,parser='rojadirecta',parserfunction='resolve_and_play')
                   			p2pdirect = re.compile('<td>P2P</td><td></td><td></td><td>(.+?)</td><td></td><td>.+?href="(.+?)"').findall(streamdata)
                   			for tipo,link in p2pdirect:
                   				if tipo == "SopCast" and "sop://" in link:
                   					addDir("[B][SopCast][/B]- (no info)",link,401,os.path.join(current_dir,'icon.png'),43,False,parser='rojadirecta',parserfunction='resolve_and_play')
	xbmc.executebuiltin("Container.SetViewMode(51)")
Beispiel #9
0
def rojadirecta_events():
    try:
        source = get_page_source(base_url)
    except:
        source = ""
        xbmcgui.Dialog().ok(translate(40000), translate(40128))
    if source:
        match = re.findall(
            '<span class="(\d+)".*?<div class="menutitle".*?<span class="t">([^<]+)</span>(.*?)</div>',
            source, re.DOTALL)
        for id, time, eventtmp in match:
            try:
                import datetime
                from peertopeerutils import pytzimp
                d = pytzimp.timezone(str(
                    pytzimp.timezone('Europe/Madrid'))).localize(
                        datetime.datetime(2014,
                                          6,
                                          7,
                                          hour=int(time.split(':')[0]),
                                          minute=int(time.split(':')[-1])))
                timezona = settings.getSetting('timezone_new')
                my_location = pytzimp.timezone(
                    pytzimp.all_timezones[int(timezona)])
                convertido = d.astimezone(my_location)
                fmt = "%H:%M"
                time = convertido.strftime(fmt)
            except:
                pass
            eventnospanish = re.compile(
                '<span class="es">(.+?)</span>').findall(eventtmp)
            if eventnospanish:
                for spanishtitle in eventnospanish:
                    eventtmp = eventtmp.replace(
                        '<span class="es">' + spanishtitle + '</span>', '')
            eventclean = eventtmp.replace('<span class="en">', '').replace(
                '</span>',
                '').replace(' ()',
                            '').replace('</time>',
                                        '').replace('<span itemprop="name">',
                                                    '')
            matchdois = re.compile('(.*)<b>\s*(.*?)\s*</b>').findall(
                eventclean)
            for sport, event in matchdois:
                express = '<span class="submenu" id="sub' + id + '">.*?</span>\s*</span>'
                streams = re.findall(express, source, re.DOTALL)
                for streamdata in streams:
                    p2pstream = re.compile(
                        '<td>P2P</td>\n.+?<td>([^<]*)</td>\n.+?<td>([^<]*)</td>\n.+?<td>([^<]*)</td>\n.+?<td>([^<]*)</td>\n.+?<td><b><a.+?href="(.+?)"'
                    ).findall(streamdata)
                    already = False
                    for canal, language, tipo, qualidade, urltmp in p2pstream:
                        if "Sopcast" in tipo or "Acestream" in tipo:
                            if already == False:
                                addLink(
                                    "[B][COLOR orange]" + time + " - " +
                                    sport + " - " + event + "[/B][/COLOR]", '',
                                    os.path.join(current_dir, 'icon.png'))
                                already = True
                            if "ArenaVision" in canal:
                                thumbnail = os.path.join(
                                    current_dir, 'media',
                                    'arenavisionlogo.png')
                            elif "Vertigo" in canal:
                                thumbnail = os.path.join(
                                    current_dir, 'media', 'vertigologo.png')
                            elif "Vikingo" in canal:
                                thumbnail = os.path.join(
                                    current_dir, 'media', 'vikingologo.png')
                            elif "futbolsinlimites" in canal:
                                thumbnail = os.path.join(
                                    current_dir, 'media',
                                    'futbolsinlimiteslogo.png')
                            elif "La Catedral" in canal:
                                thumbnail = os.path.join(
                                    current_dir, 'media', 'lacatedrallogo.png')
                            else:
                                thumbnail = os.path.join(
                                    current_dir, 'icon.png')
                            addDir(
                                "[B][" +
                                tipo.replace("<", "").replace(">", "") +
                                "][/B]-" +
                                canal.replace("<", "").replace(">", "") +
                                " - (" +
                                language.replace("<", "").replace(">", "") +
                                ") - (" +
                                qualidade.replace("<", "").replace(">", "") +
                                " Kbs)",
                                urltmp.replace("goto/", ""),
                                401,
                                thumbnail,
                                43,
                                False,
                                parser='rojadirecta',
                                parserfunction='resolve_and_play')
                    p2pdirect = re.compile(
                        '<td>P2P</td><td></td><td></td><td>(.+?)</td><td></td><td>.+?href="(.+?)"'
                    ).findall(streamdata)
                    for tipo, link in p2pdirect:
                        if tipo == "SopCast" and "sop://" in link:
                            addDir("[B][SopCast][/B]- (no info)",
                                   link,
                                   401,
                                   os.path.join(current_dir, 'icon.png'),
                                   43,
                                   False,
                                   parser='rojadirecta',
                                   parserfunction='resolve_and_play')
    xbmc.executebuiltin("Container.SetViewMode(51)")
Beispiel #10
0
def arenavision_schedule(url):
    headers = {"Cookie": "beget=begetok; has_js=1;"}
    try:
        source = requests.get(url, headers=headers).text
    except:
        source = ""
        xbmcgui.Dialog().ok(translate(40000), translate(40128))
    if source:
        match = re.findall('(.*?)</tr><tr><td class="auto-style3"', source,
                           re.DOTALL)

        for event in match:
            eventmatch = re.compile(
                '>(\d+)/(\d+)/(\d+)</td>\n<td class="auto-style3" style="width: 182px">(.+?):(.+?) CET</td>\n<td class="auto-style3" style="width: 188px">(.+?)</td>\n<td class="auto-style3" style="width: 283px">(.+?)</td>\n<td class="auto-style3" style="width: 685px">(.+?)<'
            ).findall(event)
            iii = 1
            for dia, mes, year, hour, minute, modalidade, campeonato, evento in eventmatch:
                try:
                    import datetime
                    from peertopeerutils import pytzimp
                    d = pytzimp.timezone(str(
                        pytzimp.timezone('Europe/Madrid'))).localize(
                            datetime.datetime(2000 + int(year),
                                              int(mes),
                                              int(dia),
                                              hour=int(hour),
                                              minute=int(minute)))
                    timezona = settings.getSetting('timezone_new')
                    my_location = pytzimp.timezone(
                        pytzimp.all_timezones[int(timezona)])
                    convertido = d.astimezone(my_location)
                    fmt = "%d-%m-%y %H:%M"
                    time = convertido.strftime(fmt)
                except:
                    time = 'N/A'
                c1 = re.findall('style="width: 317px">(.+?)</td>', event,
                                re.DOTALL)
                c1 = c1[0].split()
                c1 = [x for x in c1 if "/>" not in x]
                for x in range(0, len(c1)):
                    if c1[x][0] == '[':
                        c1[x] = c1[x][0:4] + "]"
                dic = {}
                dic["temp"] = []
                for x in c1:
                    if x[0] == '[':
                        if x not in dic:
                            dic[x] = dic.pop('temp')
                        else:
                            dic[x] = dic[x] + dic["temp"]
                        dic["temp"] = []
                    else:
                        dic["temp"] = dic["temp"] + [x]
                del (dic["temp"])
                event_channels = []
                cores = [
                    "green", "orange", "blue", "white", "peru", "gold", "pink",
                    "red", "darkcyan"
                ]
                html_escape_table = {
                    "&amp;": "&",
                    '"': "&quot;",
                    "'": "&apos;",
                    ">": "&gt;",
                    "<": "&lt;"
                }
                flag = 0
                for key in dic:
                    for canais in dic[key]:
                        for canal in canais.split("-"):
                            event_channels.append('[B][COLOR ' + cores[0] +
                                                  ']' + "AV" + str(canal) +
                                                  "[/B][/COLOR] " +
                                                  '[B][COLOR yellow]' +
                                                  str(key) + '[/B][/COLOR]')
                            if str(canal)[0] == "S":
                                del (cores[0])
                                flag = 1
                        if flag != 1:
                            del (cores[0])
                        flag = 0
                evento = evento.replace("&amp;", "&")
                try:
                    addDir('[B][COLOR red]' + time + '[/B][/COLOR] ' +
                           '[B][COLOR green]' +
                           removeNonAscii(clean(modalidade)) +
                           '[/B][/COLOR] ' + '[B][COLOR yellow]' +
                           removeNonAscii(clean(evento)) + '[/B][/COLOR] ' +
                           removeNonAscii(clean(campeonato)),
                           str(event_channels),
                           401,
                           os.path.join(current_dir, "icon.png"),
                           1,
                           False,
                           parser="arenavision",
                           parserfunction="arenavision_chooser")
                except:
                    pass
Beispiel #11
0
def livefootballws_events():
    try:
        source = mechanize_browser(base_url)
    except:
        source = ""
        xbmcgui.Dialog().ok(translate(40000), translate(40128))
    if source:
        items = re.findall(
            '<div class="base custom" align="center"(.*?)</center></div><br></div>',
            source, re.DOTALL)
        number_of_items = len(items)
        for item in reversed(items):
            data = re.compile(
                '<div style="text-align: center;">(.+?)</div>').findall(item)
            try:
                check = re.compile(">.+? (.+?):(.+?)").findall(
                    data[-1].replace("color:", ""))
                if not check and "Online" not in data[-1]: pass
                else:
                    data_item = data[-1].replace("<strong>", "").replace(
                        "</strong>",
                        "").replace('<span style="color: #008000;">',
                                    '').replace("</span>", "")
                    url = re.compile('<a href="(.+?)">').findall(item)
                    teams = re.compile('/.+?-(.+?).html').findall(url[0])
                    try:
                        match = re.compile('(.+?) (.+?) (.+?):(.*)').findall(
                            data_item)
                        import datetime
                        from peertopeerutils import pytzimp
                        timezona = settings.getSetting('timezone_new')
                        d = pytzimp.timezone(
                            str(pytzimp.timezone('Europe/Moscow'))).localize(
                                datetime.datetime(2014,
                                                  6,
                                                  int(match[0][0]),
                                                  hour=int(match[0][2]),
                                                  minute=int(match[0][3])))
                        my_place = pytzimp.timezone(
                            pytzimp.all_timezones[int(timezona)])
                        convertido = d.astimezone(my_place)
                        fmt = "%d %H:%M"
                        time = convertido.strftime(fmt)
                        addDir("[B][COLOR orange](" + translate(600012) +
                               time + ")[/COLOR][/B] " + teams[0],
                               url[0],
                               401,
                               os.path.join(current_dir, 'icon.png'),
                               number_of_items,
                               True,
                               parser="livefootballws",
                               parserfunction="streams")
                    except:
                        if '<span style="color: #000000;">' not in data_item:
                            addDir("[B][COLOR green](" +
                                   data_item.replace('<br />', '') +
                                   ")[/COLOR][/B] " + teams[0],
                                   url[0],
                                   401,
                                   os.path.join(current_dir, 'icon.png'),
                                   number_of_items,
                                   True,
                                   parser="livefootballws",
                                   parserfunction="streams")
                        else:
                            pass
            except:
                pass