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)')
pattern = "file: '([^']+)" matches = re.compile(pattern,re.DOTALL).findall(content) for match in matches: xbmc.log("[Formula-e] VOD video url="+match) video_source = 'vod' return (match, video_source) params = tools.parameters_string_to_dict(sys.argv[2]) mode = params.get('mode') url = params.get('url') if isinstance(url, type(str())): url = urllib.unquote_plus(url) if mode == 'listVideos': listVideos(url,'') elif mode == 'playVideo': playVideo(url) elif mode == 'play': tools.play(url) elif mode == 'videos': listVideos(url, '<div class="item1 video[^"]*">[^<]+<div class="container">[^<]+<a href="([^"]+)"[^<]+<img src="([^"]+)" alt="([^"]+)".*?<p class="dtc">(.*?)</p>') #listVideos(url, '<div class="item1 video[^"]*">[^<]+<div class="container">[^<]+<a href="([^"]+)"[^<]+<img src="([^"]+)" alt="([^"]+)".*?<p class="dtc">\s*([^<]*)[<span class="dateseparator">|</span>\s]*(\d{2}\s[a-zA-Z]{3}\s\d{2})*') elif mode == 'extendedhighlights': listVideos(url, '<div class="item1 vod[^"]*">[^<]+<div class="container">[^<]+<a href="([^"]+)"[^<]+<img src="([^"]+)" alt="([^"]+)".*?<div class="play">(.*?)</div>') else: index()