def livefootballvideo_events(): try: source = abrir_url(base_url) except: source ="";mensagemok(traducao(40000),traducao(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 utils 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') lisboa=pytzimp.timezone(pytzimp.all_timezones[int(timezona)]) convertido=d.astimezone(lisboa) 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 wiziwig_events(url): conteudo=clean(abrir_url(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(', ') print datefinal,time1 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 utils 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') lisboa=pytzimp.timezone(pytzimp.all_timezones[int(timezona)]) convertido=d.astimezone(lisboa) 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') xbmc.executebuiltin("Container.SetViewMode(51)")
def livefootballvideo_events(): try: source = abrir_url(base_url) except: source = "" mensagemok(traducao(40000), traducao(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 utils 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') lisboa = pytzimp.timezone( pytzimp.all_timezones[int(timezona)]) convertido = d.astimezone(lisboa) 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 wiziwig_events(url): conteudo = clean(abrir_url(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(', ') print datefinal, time1 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 utils 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') lisboa = pytzimp.timezone(pytzimp.all_timezones[int(timezona)]) convertido = d.astimezone(lisboa) 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') xbmc.executebuiltin("Container.SetViewMode(51)")