示例#1
0
def getNextRace():
	data = tools.getUrl('http://www.fiaformulae.com')
	matches = re.compile('<div id="startTime">(.*?)</div>.*?<div id="countdown">[^<]+<p>([^<]+)', re.DOTALL).findall(data)

	for date, location in matches:
		date = tools.cleanText(date)

	color = 'green' if date<3600 else 'red'
	
	days = int(date)/86400
	hours = (int(date)/3600) - (int(days)*24)
	
	return '[COLOR '+color+']'+translation(30000)+' ['+location+'] ('+str(days)+' '+translation(30008)+' & '+str(hours)+' '+translation(30009)+' '+translation(30010)+')[/COLOR]'
示例#2
0
def playVideo(url):
	xbmc.log("[Formula-e] url='%s')" % url)
	
	content = tools.getUrl(url)
	(video_id, video_source) = findVideo(content)
	
	if video_source == 'dailymotion':
		dailymotion.playDailyMotionVideo(video_id)
	elif video_source == 'youtube':
		tools.play('plugin://plugin.video.youtube/play/?video_id='+video_id)
	elif video_source == 'vod':
		tools.play(video_id)
	else:
		print '[Formula-e] No playable video found'
		xbmc.executebuiltin('XBMC.Notification(Info:, "No playable video found", 5000)')
示例#3
0
def listVideos(url, pattern):
	data = tools.getUrl(url)

	matches = re.compile(pattern, re.DOTALL).findall(data)

	for match in matches:
		tools.log("listVideos->match: "+str(match))
		
	for scrapedurl, scrapedthumbnail, scrapedtitle, scrapeddate in matches:
		scrapedtitle = tools.cleanText(scrapedtitle)
		scrapeddate = scrapeddate.replace('<span class="dateseparator">|</span>\r\n                            ', ' | ').strip()
		tools.addLink(scrapedtitle+" ["+scrapeddate+"]", scrapedurl, 'playVideo', scrapedthumbnail)

	xbmcplugin.endOfDirectory(pluginhandle)
	
	if forceViewMode:
		tools.set_view(viewMode)