def playf4m(url, name): if not any(i in url for i in ['.f4m', '.ts', '.m3u8']): raise Exception() ext = url.split('?')[0].split('&')[0].split('|')[0].rsplit( '.')[-1].replace('/', '').lower() if not ext: ext = url if not ext in ['f4m', 'ts', 'm3u8']: raise Exception() params = urlparse.parse_qs(url) try: proxy = params['proxy'][0] except: proxy = None try: proxy_use_chunks = json.loads(params['proxy_for_chunks'][0]) except: proxy_use_chunks = True try: maxbitrate = int(params['maxbitrate'][0]) except: maxbitrate = 0 try: simpleDownloader = json.loads(params['simpledownloader'][0]) except: simpleDownloader = False try: auth_string = params['auth'][0] except: auth_string = '' try: streamtype = params['streamtype'][0] except: if ext == 'ts': streamtype = 'TSDOWNLOADER' elif ext == 'm3u8': streamtype = 'HLS' else: streamtype = 'HDS' try: swf = params['swf'][0] except: swf = None from F4mProxy import f4mProxyHelper f4mProxyHelper().playF4mLink(url, name, proxy, proxy_use_chunks, maxbitrate, simpleDownloader, auth_string, streamtype, False, swf)
def resolveUrl(url): try: if '.f4m' in url: url = url.replace('&mode=3', '').replace('?mode=3', '') if 'keshet' in url: ticket = myResolver.GetMinus2Ticket() url = "{0}?{1}&hdcore=3.0.3".format(url, ticket) from F4mProxy import f4mProxyHelper url = f4mProxyHelper().playF4mLink(urllib.unquote_plus(url)) elif "mode=" in url: matches = re.compile('^(.*?)[\?|&]mode=(\-?[0-9]+)(.*?)$', re.I + re.M + re.U + re.S).findall(url) if len(matches) > 0: url = matches[0][0] mode = matches[0][1] if len(matches[0]) > 2: url += matches[0][2] if mode == '0': mode = '-3' url = url[url.rfind(';') + 1:] url = myResolver.Resolve(url, mode) if url is None or url == "down": return None return url except Exception as ex: xbmc.log("{0}".format(ex), 3) return None
def resolveUrl(url): try: if '.f4m' in url: url = url.replace('&mode=3', '').replace('?mode=3', '') if 'keshet' in url: ticket = myResolver.GetMinus2Ticket() url = "{0}?{1}&hdcore=3.0.3".format(url, ticket) from F4mProxy import f4mProxyHelper url = f4mProxyHelper().playF4mLink(urllib.unquote_plus(url)) elif "mode=" in url: matches = re.compile('^(.*?)[\?|&]mode=(\-?[0-9]+)(.*?)$', re.I+re.M+re.U+re.S).findall(url) if len(matches) > 0: url = matches[0][0] mode = matches[0][1] if len(matches[0]) > 2: url += matches[0][2] if mode == '0': mode = '-3' url = url[url.rfind(';')+1:] url = myResolver.Resolve(url, mode) if url is None or url == "down": return None return url except Exception as ex: xbmc.log("{0}".format(ex), 3) return None
def PLAY(url, title): playmode = int(addon.getSetting('playmode')) iconimage = xbmc.getInfoImage("ListItem.Thumb") if playmode == 0: stype = '' if '.ts' in url: stype = 'TSDOWNLOADER' elif '.m3u' in url: stype = 'HLS' if stype: from F4mProxy import f4mProxyHelper f4mp = f4mProxyHelper() xbmcplugin.endOfDirectory(int(sys.argv[1]), cacheToDisc=False) f4mp.playF4mLink(url, name, proxy=None, use_proxy_for_chunks=False, maxbitrate=0, simpleDownloader=False, auth=None, streamtype=stype, setResolved=False, swf=None, callbackpath="", callbackparam="", iconImage=iconimage) return listitem = xbmcgui.ListItem(name, iconImage="DefaultVideo.png", thumbnailImage=iconimage) listitem.setInfo('video', {'Title': name}) listitem.setProperty("IsPlayable", "true") xbmc.Player().play(url, listitem)
def playF4mLink(url, name='PLD-PLAYER[COLOR lime]M3U[/COLOR]', proxy=None, use_proxy_for_chunks=False, auth_string=None, streamtype='TSDOWNLOADER', setResolved=False, swf=""): from F4mProxy import f4mProxyHelper player = f4mProxyHelper() #progress = xbmcgui.DialogProgress() #progress.create('Starting local proxy') if setResolved: urltoplay, item = player.playF4mLink(url, name, proxy, use_proxy_for_chunks, maxbitrate, simpleDownloader, auth_string, streamtype, setResolved, swf) item.setProperty("IsPlayable", "true") xbmcplugin.setResolvedUrl(int(sys.argv[1]), True, item) else: xbmcplugin.endOfDirectory(int(sys.argv[1]), cacheToDisc=False) player.playF4mLink(url, name, proxy, use_proxy_for_chunks, maxbitrate, simpleDownloader, auth_string, streamtype, setResolved, swf) return
def playF4mLink(url, name, proxy=None, use_proxy_for_chunks=False, auth_string=None, streamtype='HDS', setResolved=False, swf="", callbackpath="", callbackparam="", iconImage=""): from F4mProxy import f4mProxyHelper player = f4mProxyHelper() #progress = xbmcgui.DialogProgress() #progress.create('Starting local proxy') if setResolved: urltoplay, item = player.playF4mLink(url, name, proxy, use_proxy_for_chunks, maxbitrate, simpleDownloader, auth_string, streamtype, setResolved, swf, callbackpath, callbackparam, iconImage) item.setProperty("IsPlayable", "true") xbmcplugin.setResolvedUrl(int(sys.argv[1]), True, item) else: xbmcplugin.endOfDirectory(int(sys.argv[1]), cacheToDisc=False) player.playF4mLink(url, name, proxy, use_proxy_for_chunks, maxbitrate, simpleDownloader, auth_string, streamtype, setResolved, swf, callbackpath, callbackparam, iconImage) return
def f4m(self, url, name): try: if not any(i in url for i in ['.f4m', '.ts']): raise Exception() ext = url.split('?')[0].split('&')[0].split('|')[0].rsplit('.')[-1].replace('/', '').lower() if not ext: ext = url if not ext in ['f4m', 'ts']: raise Exception() params = urlparse.parse_qs(url) try: proxy = params['proxy'][0] except: proxy = None try: proxy_use_chunks = json.loads(params['proxy_for_chunks'][0]) except: proxy_use_chunks = True try: maxbitrate = int(params['maxbitrate'][0]) except: maxbitrate = 0 try: simpleDownloader = json.loads(params['simpledownloader'][0]) except: simpleDownloader = False try: auth_string = params['auth'][0] except: auth_string = '' try: streamtype = params['streamtype'][0] except: streamtype = 'TSDOWNLOADER' if ext == 'ts' else 'HLS' try: swf = params['swf'][0] except: swf = None from F4mProxy import f4mProxyHelper return f4mProxyHelper().playF4mLink(url, name, proxy, proxy_use_chunks, maxbitrate, simpleDownloader, auth_string, streamtype, False, swf) except: pass
def playF4mLink(url, name, proxy=None, use_proxy_for_chunks=False, auth_string=None, streamtype='HDS', setResolved=False): from F4mProxy import f4mProxyHelper player = f4mProxyHelper() maxbitrate = 0 simpleDownloader = False if setResolved: urltoplay, item = player.playF4mLink(url, name, proxy, use_proxy_for_chunks, maxbitrate, simpleDownloader, auth_string, streamtype, setResolved) item.setProperty("IsPlayable", "true") xbmcplugin.setResolvedUrl(h, True, item) else: xbmcplugin.endOfDirectory(h, cacheToDisc=False) player.playF4mLink(url, name, proxy, use_proxy_for_chunks, maxbitrate, simpleDownloader, auth_string, streamtype, setResolved) return
def livePlay(): if params['id'] == "rain": xbmcgui.Dialog().ok("提醒","因雨延賽") return if params['id'] == 'final': xbmcgui.Dialog().ok("提醒","比賽已經結束") return #response = urllib2.urlopen("http://www.cpbltv.com/channel/" + params['id'] + ".html").read() response = urllib2.urlopen("http://www.cpbltv.com/channel/" + params['url']).read() m = re.findall(r"live_offline", response) if m: xbmcgui.Dialog().ok("提醒","現在非直播時段") return choice = xbmcgui.Dialog().select('選擇解析度', live_resolution_list) data = { 'type':'live', 'id': params['id']} req = urllib2.Request("http://www.cpbltv.com/vod/player.html?&type=live&width=620&height=348&id="+params['id']+"&0.9397849941728333", urllib.urlencode(data)) response = urllib2.urlopen(req) #print response.read() m = re.findall(r"var play_url = \'(.*?)\'", response.read()) #m = re.findall(r"var play_url = '([\?\w\d\_\&\-\=]+)", response.read()) url = str(m[0]) player = f4mProxyHelper() player.playF4mLink(url, name="直播", resolution=choice)
def Playf4m(url, name=None, iconimage=None): i = url.find('http://') if url.find('keshet') > 0: makoTicket = urllib.urlopen( 'http://mass.mako.co.il/ClicksStatistics/entitlementsServices.jsp?et=gt&rv=akamai' ).read() result = json.loads(makoTicket) ticket = result['tickets'][0]['ticket'] url = "{0}?{1}&hdcore=3.0.3".format(url[i:], ticket) else: url = url[i:] channelName = "" programmeName = "" if name is not None: u, channelName, programmeName, icon = GetPlayingDetails( urllib.unquote_plus(name)) from F4mProxy import f4mProxyHelper player = f4mProxyHelper() xbmcplugin.endOfDirectory(int(sys.argv[1]), cacheToDisc=False) #player.playF4mLink(urllib.unquote_plus(url), name, use_proxy_for_chunks=True) player.playF4mLink(urllib.unquote_plus(url), programmeName, use_proxy_for_chunks=True, iconimage=iconimage, channelName=channelName)
def playLiveStream(self, name, url, image): if '.ts' in url: stype = 'TSDOWNLOADER' from F4mProxy import f4mProxyHelper f4mp = f4mProxyHelper() xbmcplugin.endOfDirectory(int(sys.argv[1]), cacheToDisc=False) f4mp.playF4mLink(url, name, proxy=None, use_proxy_for_chunks=False, maxbitrate=0, simpleDownloader=False, auth=None, streamtype=stype, setResolved=False, swf=None, callbackpath="", callbackparam="", iconImage=image) return item = control.item(path=url, iconImage=image, thumbnailImage=image) item.setInfo(type='Video', infoLabels={'title': name}) item.setProperty('Video', 'true') item.setProperty('IsPlayable', 'true') control.playlist.clear() control.player.play(url)
def play__(): # Lancer les liens oGui = cGui() oInputParameterHandler = cInputParameterHandler() sUrl = oInputParameterHandler.getValue('siteUrl').replace('P_L_U_S', '+') sTitle = oInputParameterHandler.getValue('sMovieTitle') sThumbnail = oInputParameterHandler.getValue('sThumbnail') # Special url with tag if '[' in sUrl and ']' in sUrl: sUrl = GetRealUrl(sUrl) playmode = '' if playmode == 0: stype = '' if '.ts' in sUrl: stype = 'TSDOWNLOADER' elif '.m3u' in sUrl: stype = 'HLS' if stype: from F4mProxy import f4mProxyHelper f4mp = f4mProxyHelper() xbmcplugin.endOfDirectory(int(sys.argv[1]), cacheToDisc=False) f4mp.playF4mLink(sUrl, sTitle, proxy=None, use_proxy_for_chunks=False, maxbitrate=0, simpleDownloader=False, auth=None, streamtype=stype, setResolved=False, swf=None, callbackpath="", callbackparam="", iconImage=sThumbnail) return if 'f4mTester' in sUrl: xbmc.executebuiltin('XBMC.RunPlugin(' + sUrl + ')') return else: oGuiElement = cGuiElement() oGuiElement.setSiteName(SITE_IDENTIFIER) oGuiElement.setTitle(sTitle) sUrl = sUrl.replace(' ', '%20') oGuiElement.setMediaUrl(sUrl) oGuiElement.setThumbnail(sThumbnail) oPlayer = cPlayer() oPlayer.clearPlayList() oPlayer.addItemToPlaylist(oGuiElement) # tout repetter # xbmc.executebuiltin("xbmc.playercontrol(RepeatAll)") oPlayer.startPlayer() return
def playF4mLink(url, name, proxy=None, use_proxy_for_chunks=False): from F4mProxy import f4mProxyHelper player = f4mProxyHelper() #progress = xbmcgui.DialogProgress() #progress.create('Starting local proxy') xbmcplugin.endOfDirectory(int(sys.argv[1]), cacheToDisc=False) player.playF4mLink(url, name, proxy, use_proxy_for_chunks, maxbitrate) return
def playF4mLink(url,name,proxy=None,use_proxy_for_chunks=False): from F4mProxy import f4mProxyHelper player=f4mProxyHelper() #progress = xbmcgui.DialogProgress() #progress.create('Starting local proxy') xbmcplugin.endOfDirectory(int(sys.argv[1]), cacheToDisc=False) player.playF4mLink(url, name, proxy, use_proxy_for_chunks,maxbitrate) return
def play__(): # Lancer les liens oInputParameterHandler = cInputParameterHandler() sUrl = oInputParameterHandler.getValue('siteUrl').replace('P_L_U_S', '+') sTitle = oInputParameterHandler.getValue('sMovieTitle') sThumbnail = oInputParameterHandler.getValue('sThumbnail') # Special url with tag if '[' in sUrl and ']' in sUrl: sUrl = GetRealUrl(sUrl) elif not xbmc.getInfoLabel('system.buildversion')[0:2] >= '19': stype = '' if '.ts' in sUrl: stype = 'TSDOWNLOADER' elif '.m3u' in sUrl: pass if stype: from F4mProxy import f4mProxyHelper f4mp = f4mProxyHelper() xbmcplugin.endOfDirectory(int(sys.argv[1]), cacheToDisc=True) f4mp.playF4mLink(sUrl, sTitle, proxy=None, use_proxy_for_chunks=False, maxbitrate=0, simpleDownloader=True, auth=None, streamtype=stype, setResolved=True, swf=None, callbackpath='', callbackparam='', iconImage=sThumbnail) return if 'dailymotion' in sUrl: showDailymotionStream(sUrl, sTitle, sThumbnail) return if 'f4mTester' in sUrl: xbmc.executebuiltin('XBMC.RunPlugin(' + sUrl + ')') return else: oGuiElement = cGuiElement() oGuiElement.setSiteName(SITE_IDENTIFIER) oGuiElement.setTitle(sTitle) sUrl = sUrl.replace(' ', '%20') oGuiElement.setMediaUrl(sUrl) oGuiElement.setThumbnail(sThumbnail) oPlayer = cPlayer() oPlayer.clearPlayList() oPlayer.addItemToPlaylist(oGuiElement) oPlayer.startPlayer()
def PlayChannel(url, name, iconimage, description, categoryName): try: if url.find("www.youtube.com") > 0: url = myResolver.GetYoutubeFullLink(url) elif url == "BB": url = myResolver.Resolve(url, -1) elif ".f4m" in url: url = url[url.find("http://") :] if "keshet" in url: ticket = myResolver.GetMinus2Ticket() url = "{0}?{1}&hdcore=3.0.3".format(url, ticket) from F4mProxy import f4mProxyHelper url = f4mProxyHelper().playF4mLink(urllib.unquote_plus(url)) elif "mode=" in url: matches = re.compile("^(.*?)[\?|&]mode=(\-?[0-9]+)(.*?)$", re.I + re.M + re.U + re.S).findall(url) if len(matches) > 0: url = matches[0][0] mode = matches[0][1] if len(matches[0]) > 2: url += matches[0][2] if mode == "3": if useIPTV: url = GetLivestreamerLink(url) else: return False else: if mode == "0": mode = "-3" url = url[url.rfind(";") + 1 :] url = myResolver.Resolve(url, mode, useRtmp=useRtmp) if url is None or url == "down": return False except Exception as ex: print ex print "Cannot resolve stream URL for channel '{0}'".format(urllib.unquote_plus(name)) xbmc.executebuiltin( "Notification({0}, Cannot resolve stream URL for channel '[COLOR {1}][B]{2}[/B][/COLOR]', {3}, {4})".format( AddonName, Addon.getSetting("chColor"), urllib.unquote_plus(name), 5000, __icon2__ ) ) return False channelName, programmeName = GetPlayingDetails(urllib.unquote_plus(name), categoryName) listItem = xbmcgui.ListItem(path=url) listItem.setInfo(type="Video", infoLabels={"title": programmeName}) # listItem.setInfo(type="Video", infoLabels={ "studio": channelName}) listItem.setInfo(type="Video", infoLabels={"tvshowtitle": channelName, "episode": "0", "season": "0"}) listItem.setInfo(type="Video", infoLabels={"plot": description}) if iconimage is not None: listItem.setThumbnailImage(iconimage) xbmcplugin.setResolvedUrl(handle=int(sys.argv[1]), succeeded=True, listitem=listItem) return True
def Playvid(url, name): playmode = int(addon.getSetting('chatplay')) chatslow = int(addon.getSetting('chatslow')) listhtml = utils.getHtml(url, hdr=cbheaders) iconimage = xbmc.getInfoImage("ListItem.Thumb") m3u8url = re.compile(r"jsplayer, '([^']+)", re.DOTALL | re.IGNORECASE).findall(listhtml) if m3u8url: m3u8stream = m3u8url[0] if chatslow == 1: m3u8stream = m3u8stream.replace('_fast','') else: m3u8stream = False if playmode == 0: if m3u8stream: videourl = m3u8stream else: utils.notify('Oh oh','Couldn\'t find a playable webcam link') return elif playmode == 1: if m3u8stream: from F4mProxy import f4mProxyHelper f4mp=f4mProxyHelper() f4mp.playF4mLink(m3u8stream,name,proxy=None,use_proxy_for_chunks=False, maxbitrate=0, simpleDownloader=False, auth=None, streamtype='HLS',setResolved=False,swf=None , callbackpath="",callbackparam="", iconImage=iconimage) return else: utils.notify('Oh oh','Couldn\'t find a playable webcam link') return elif playmode == 2: flv_info = [] embed = re.compile(r"EmbedViewerSwf\(*(.+?)\);", re.DOTALL).findall(listhtml)[0] for line in embed.split("\n"): data = re.search("""\s+["']([^"']+)["'],""", line) if data: flv_info.append(data.group(1)) streamserver = "rtmp://%s/live-edge"%(flv_info[2]) modelname = flv_info[1] username = flv_info[8] password = urllib.unquote(flv_info[12]) unknown = flv_info[13] swfurl = "https://chaturbate.com/static/flash/CBV_2p650.swf" videourl = "%s app=live-edge swfUrl=%s tcUrl=%s pageUrl=http://chaturbate.com/%s/ conn=S:%s conn=S:%s conn=S:2.650 conn=S:%s conn=S:%s playpath=mp4"%(streamserver,swfurl,streamserver,modelname,username,modelname,password,unknown) listitem = xbmcgui.ListItem(name, iconImage="DefaultVideo.png", thumbnailImage=iconimage) listitem.setInfo('video', {'Title': name, 'Genre': 'P**n'}) listitem.setProperty("IsPlayable","true") xbmc.Player().play(videourl, listitem)
def playF4mLink(url,name,proxy=None,use_proxy_for_chunks=False,auth_string=None,streamtype='HDS',setResolved=False): from F4mProxy import f4mProxyHelper player=f4mProxyHelper() if setResolved: urltoplay,item=player.playF4mLink(url, name, proxy, use_proxy_for_chunks,maxbitrate,simpleDownloader,auth_string,streamtype,setResolved) item.setProperty("IsPlayable", "true") xbmcplugin.setResolvedUrl(int(sys.argv[1]), True, item) else: xbmcplugin.endOfDirectory(int(sys.argv[1]), cacheToDisc=False) player.playF4mLink(url, name, proxy, use_proxy_for_chunks,maxbitrate,simpleDownloader,auth_string,streamtype,setResolved) return
def play__(): #Lancer les liens oGui = cGui() oInputParameterHandler = cInputParameterHandler() sUrl = oInputParameterHandler.getValue('siteUrl').replace('P_L_U_S', '+') sTitle = oInputParameterHandler.getValue('sMovieTitle') sThumbnail = oInputParameterHandler.getValue('sThumbnail') #Special url with tag if '[' in sUrl and ']' in sUrl: sUrl = GetRealUrl(sUrl) playmode = '' if playmode == 0: stype = '' if '.ts' in sUrl: stype = 'TSDOWNLOADER' elif '.m3u' in sUrl: stype = 'HLS' if stype: from F4mProxy import f4mProxyHelper f4mp = f4mProxyHelper() xbmcplugin.endOfDirectory(int(sys.argv[1]), cacheToDisc=False) f4mp.playF4mLink(sUrl, sTitle, proxy=None, use_proxy_for_chunks=False, maxbitrate=0, simpleDownloader=False, auth=None, streamtype=stype, setResolved=False, swf=None, callbackpath="", callbackparam="", iconImage=sThumbnail) return listitem = xbmcgui.ListItem(sTitle, iconImage="DefaultVideo.png", thumbnailImage=sThumbnail) listitem.setInfo('video', {'Title': sTitle}) listitem.setProperty("IsPlayable", "true") #xbmc.Player().play(sUrl, listitem) if 'f4mTester' in sUrl: xbmc.executebuiltin('XBMC.RunPlugin(' + sUrl + ')') else: xbmc.Player().play(sUrl, listitem) return
def playF4mLink2(url,name,proxy=None,use_proxy_for_chunks=False): from F4mProxy import f4mProxyHelper helper=f4mProxyHelper() url_to_play,stopEvent = helper.start_proxy(url, name, proxy, use_proxy_for_chunks) mplayer = MyPlayer() mplayer.stopPlaying = stopEvent listitem = xbmcgui.ListItem(name) mplayer.play(url_to_play,listitem) while True: if stopEvent.isSet(): break; xbmc.log('Sleeping...') xbmc.sleep(200) return
def playF4mLink(url,name,proxy=None,use_proxy_for_chunks=False,auth_string=None,streamtype='HDS',setResolved=False,swf="",iconImage=None): from F4mProxy import f4mProxyHelper player=f4mProxyHelper() #progress = xbmcgui.DialogProgress() #progress.create('Starting local proxy') if setResolved: urltoplay,item=player.playF4mLink(url, name, proxy, use_proxy_for_chunks,maxbitrate,simpleDownloader,auth_string,streamtype,setResolved,swf,iconImage) item.setProperty("IsPlayable", "true") xbmcplugin.setResolvedUrl(int(sys.argv[1]), True, item) else: xbmcplugin.endOfDirectory(int(sys.argv[1]), cacheToDisc=False) player.playF4mLink(url, name, proxy, use_proxy_for_chunks,maxbitrate,simpleDownloader,auth_string,streamtype,setResolved,swf,iconImage) return
def playF4mLink2(url, name, proxy=None, use_proxy_for_chunks=False): from F4mProxy import f4mProxyHelper helper = f4mProxyHelper() url_to_play, stopEvent = helper.start_proxy(url, name, proxy, use_proxy_for_chunks) mplayer = MyPlayer() mplayer.stopPlaying = stopEvent listitem = xbmcgui.ListItem(name) mplayer.play(url_to_play, listitem) while True: if stopEvent.isSet(): break xbmc.log('Sleeping...') xbmc.sleep(200) return
def playLiveStream(self, name, url, image): if '.ts' in url: stype = 'TSDOWNLOADER' from F4mProxy import f4mProxyHelper f4mp=f4mProxyHelper() xbmcplugin.endOfDirectory(int(sys.argv[1]), cacheToDisc=False) f4mp.playF4mLink(url,name,proxy=None,use_proxy_for_chunks=False, maxbitrate=0, simpleDownloader=False, auth=None, streamtype=stype,setResolved=False,swf=None , callbackpath="",callbackparam="", iconImage=image) return item = control.item(path=url, iconImage=image, thumbnailImage=image) item.setInfo(type='Video', infoLabels={'title': name}) item.setProperty('Video', 'true') item.setProperty('IsPlayable', 'true') control.playlist.clear() control.player.play(url)
def Play(params): url = params['url'] if url.find('//') == 0: url = url[2:] if url.find('http') == -1: url = 'http://' + url if 'ivi.ru' in url: if xbmc.getCondVisibility('System.HasAddon(plugin.video.ivi.ru)') == 0: ShowMessage(addon_name, "Для просмотра данного видео необходим плагин ivi.ru") return True id = re.findall('videoId=(\d+)', url) if id: id = id[0] print "IVI.RU, id = " + str(id) link = "plugin://plugin.video.ivi.ru?func=playid&id=" + id #xbmc.executebuiltin('XBMC.RunScript(plugin.video.ivi.ru,, ?func=playid&id=%s)' % (id)) else: print "IVI.RU video id is not found, " + url return True else: link = GetVideo(url) if link == False: return True if 'moonwalk.cc' in url and use_ahds: #PlayHDS(link) from F4mProxy import f4mProxyHelper import time helper = f4mProxyHelper() link, stopEvent = helper.start_proxy(link, "f4mstream") #print link item = xbmcgui.ListItem(path=link) item.setProperty('IsPlayable', 'true') xbmcplugin.setResolvedUrl(hos, True, item) player = xbmc.Player() time.sleep(20) while player.isPlaying(): #print "WAITING FOR PLAYER TO STOP" time.sleep(5) #print stopEvent, type(stopEvent) time.sleep(10) stopEvent.set() else: item = xbmcgui.ListItem(path=link) item.setProperty('IsPlayable', 'true') xbmcplugin.setResolvedUrl(hos, True, item)
def play__():#Lancer les liens oGui = cGui() oInputParameterHandler = cInputParameterHandler() sUrl = oInputParameterHandler.getValue('siteUrl').replace('P_L_U_S', '+') sTitle = oInputParameterHandler.getValue('sMovieTitle') sThumbnail = oInputParameterHandler.getValue('sThumbnail') #Special url with tag if '[' in sUrl and ']' in sUrl: sUrl = GetRealUrl(sUrl) playmode = '' if playmode == 0: stype = '' if '.ts' in sUrl: stype = 'TSDOWNLOADER' elif '.m3u' in sUrl: stype = 'HLS' if stype: from F4mProxy import f4mProxyHelper f4mp=f4mProxyHelper() xbmcplugin.endOfDirectory(int(sys.argv[1]), cacheToDisc=False) f4mp.playF4mLink(sUrl, sTitle, proxy=None, use_proxy_for_chunks=False, maxbitrate=0, simpleDownloader=False, auth=None, streamtype=stype, setResolved=False, swf=None, callbackpath="", callbackparam="", iconImage=sThumbnail) return if 'f4mTester' in sUrl: xbmc.executebuiltin('XBMC.RunPlugin(' + sUrl + ')') return else: oGuiElement = cGuiElement() oGuiElement.setSiteName(SITE_IDENTIFIER) oGuiElement.setTitle(sTitle) sUrl = sUrl.replace(' ','%20') oGuiElement.setMediaUrl(sUrl) oGuiElement.setThumbnail(sThumbnail) oPlayer = cPlayer() oPlayer.clearPlayList() oPlayer.addItemToPlaylist(oGuiElement) #tout repetter #xbmc.executebuiltin("xbmc.playercontrol(RepeatAll)") oPlayer.startPlayer() return
def Play(params): url = params['url'] if url.find('//') == 0: url = url[2:] if url.find('http') == -1: url = 'http://' + url if 'ivi.ru' in url: if xbmc.getCondVisibility('System.HasAddon(plugin.video.ivi.ru)') == 0: ShowMessage(addon_name, "Для просмотра данного видео необходим плагин ivi.ru") return True id = re.findall('videoId=(\d+)', url) if id: id = id[0] print "IVI.RU, id = " + str(id) link = "plugin://plugin.video.ivi.ru?func=playid&id=" + id #xbmc.executebuiltin('XBMC.RunScript(plugin.video.ivi.ru,, ?func=playid&id=%s)' % (id)) else: print "IVI.RU video id is not found, " + url return True else: link = GetVideo(url) if link == False: return True if 'moonwalk.cc' in url and use_ahds: #PlayHDS(link) from F4mProxy import f4mProxyHelper import time helper = f4mProxyHelper() link, stopEvent = helper.start_proxy(link, "f4mstream") #print link item = xbmcgui.ListItem(path = link) item.setProperty('IsPlayable', 'true') xbmcplugin.setResolvedUrl(hos, True, item) player = xbmc.Player() time.sleep(20) while player.isPlaying(): #print "WAITING FOR PLAYER TO STOP" time.sleep(5) #print stopEvent, type(stopEvent) time.sleep(10) stopEvent.set() else: item = xbmcgui.ListItem(path = link) item.setProperty('IsPlayable', 'true') xbmcplugin.setResolvedUrl(hos, True, item)
def Playf4m(url, name=None, iconimage=None): i = url.find('http://') if url.find('keshet') > 0: makoTicket = common.OPEN_URL('http://mass.mako.co.il/ClicksStatistics/entitlementsServices.jsp?et=gt&rv=akamai') result = json.loads(makoTicket) ticket = result['tickets'][0]['ticket'] url = "{0}%3F{1}%26hdcore%3D3.0.3".format(url[i:], ticket) else: url = url[i:] if name is not None: name = urllib.unquote_plus(name) from F4mProxy import f4mProxyHelper player = f4mProxyHelper() xbmcplugin.endOfDirectory(int(sys.argv[1]), cacheToDisc=False) #player.playF4mLink(urllib.unquote_plus(url), name, use_proxy_for_chunks=True) player.playF4mLink(urllib.unquote_plus(url), name, use_proxy_for_chunks=True, iconimage=iconimage)
def Playf4m(url, categoryName, name=None, iconimage=None): i = url.find('http://') if url.find('keshet') > 0: makoTicket = urllib.urlopen('http://mass.mako.co.il/ClicksStatistics/entitlementsServices.jsp?et=gt&rv=akamai').read() result = json.loads(makoTicket) ticket = result['tickets'][0]['ticket'] url = "{0}?{1}&hdcore=3.0.3".format(url[i:], ticket) else: url = url[i:] channelName = "" programmeName = "" if name is not None: u, channelName, programmeName, icon = GetPlayingDetails(urllib.unquote_plus(name), categoryName) from F4mProxy import f4mProxyHelper url = f4mProxyHelper().playF4mLink(urllib.unquote_plus(url)) Play(url, channelName, programmeName, iconimage)
def Playf4m(url, name=None, iconimage=None): i = url.find('http://') if url.find('keshet') > 0: makoTicket = urllib.urlopen('http://mass.mako.co.il/ClicksStatistics/entitlementsServices.jsp?et=gt&rv=akamai').read() result = json.loads(makoTicket) ticket = result['tickets'][0]['ticket'] url = "{0}?{1}&hdcore=3.0.3".format(url[i:], ticket) else: url = url[i:] channelName = "" programmeName = "" if name is not None: u, channelName, programmeName, icon = GetPlayingDetails(urllib.unquote_plus(name)) from F4mProxy import f4mProxyHelper player = f4mProxyHelper() xbmcplugin.endOfDirectory(int(sys.argv[1]), cacheToDisc=False) #player.playF4mLink(urllib.unquote_plus(url), name, use_proxy_for_chunks=True) player.playF4mLink(urllib.unquote_plus(url), programmeName, use_proxy_for_chunks=True, iconimage=iconimage, channelName=channelName)
def Playf4m(url, categoryName, name=None, iconimage=None): i = url.find('http://') if url.find('keshet') > 0: makoTicket = urllib.urlopen( 'http://mass.mako.co.il/ClicksStatistics/entitlementsServices.jsp?et=gt&rv=akamai' ).read() result = json.loads(makoTicket) ticket = result['tickets'][0]['ticket'] url = "{0}?{1}&hdcore=3.0.3".format(url[i:], ticket) else: url = url[i:] channelName = "" programmeName = "" if name is not None: u, channelName, programmeName, icon = GetPlayingDetails( urllib.unquote_plus(name), categoryName) from F4mProxy import f4mProxyHelper url = f4mProxyHelper().playF4mLink(urllib.unquote_plus(url)) Play(url, channelName, programmeName, iconimage)
def PLAY(url, title): playmode = int(addon.getSetting('playmode')) iconimage = xbmc.getInfoImage("ListItem.Thumb") if playmode == 0: if '.ts' in url: stype = 'TSDOWNLOADER' elif '.m3u' in url: stype = 'HLS' else: return from F4mProxy import f4mProxyHelper f4mp=f4mProxyHelper() f4mp.playF4mLink(url,name,proxy=None,use_proxy_for_chunks=False, maxbitrate=0, simpleDownloader=False, auth=None, streamtype=stype,setResolved=False,swf=None , callbackpath="",callbackparam="", iconImage=iconimage) return elif playmode == 1: listitem = xbmcgui.ListItem(name, iconImage="DefaultVideo.png", thumbnailImage=iconimage) listitem.setInfo('video', {'Title': name}) listitem.setProperty("IsPlayable","true") xbmc.Player().play(url, listitem)
def Playf4m(url, categoryName, name=None, iconimage=None): i = url.find('http://') if url.find('keshet') > 0: dvs = urllib.urlopen('http://www.mako.co.il/AjaxPage?jspName=FlashVODOnAir.jsp').read() result = json.loads(dvs) random.seed() random.shuffle(result) dv = result[0]["id"] makoTicket = urllib.urlopen('http://mass.mako.co.il/ClicksStatistics/entitlementsServices.jsp?et=gt&rv=akamai&dv={0}&lp='.format(dv)).read() result = json.loads(makoTicket) ticket = result['tickets'][0]['ticket'] url = "{0}?{1}&hdcore=3.0.3".format(url[i:], ticket) else: url = url[i:] channelName = "" programmeName = "" if name is not None: channelName, programmeName = GetPlayingDetails(urllib.unquote_plus(name), categoryName) from F4mProxy import f4mProxyHelper url = f4mProxyHelper().playF4mLink(urllib.unquote_plus(url)) Play(url, channelName, programmeName, iconimage)
def Oynat(name, url): url = url.replace('#', '|') if path.exists("/usr/lib/enigma2/python/Plugins/Extensions/KodiLite" ): # enigma2 Kodidirect pic = "DefaultFolder.png" li = xbmcgui.ListItem(name, iconImage="DefaultFolder.png", thumbnailImage=pic) player = xbmc.Player() player.play(url, li) else: if ".ts" in url and "VAVOO" not in url: import F4mProxy from F4mProxy import f4mProxyHelper player = f4mProxyHelper() player.playF4mLink(url, name, streamtype='TSDOWNLOADER') else: pic = "DefaultFolder.png" li = xbmcgui.ListItem(name, iconImage="DefaultFolder.png", thumbnailImage=pic) player = xbmc.Player() player.play(url, li)
def PlayChannel(url, name, iconimage, description, categoryName): try: if '.f4m' in url: url = url.replace('&mode=3', '').replace('?mode=3', '') if 'keshet' in url: ticket = myResolver.GetMinus2Ticket() url = "{0}?{1}&hdcore=3.0.3".format(url, ticket) from F4mProxy import f4mProxyHelper url = f4mProxyHelper().playF4mLink(urllib.unquote_plus(url)) elif "mode=" in url: matches = re.compile('^(.*?)[\?|&]mode=(\-?[0-9]+)(.*?)$', re.I+re.M+re.U+re.S).findall(url) if len(matches) > 0: url = matches[0][0] mode = matches[0][1] if len(matches[0]) > 2: url += matches[0][2] if mode == '0': mode = '-3' url = url[url.rfind(';')+1:] url = myResolver.Resolve(url, mode, useRtmp=useRtmp) if url is None or url == "down": return False except Exception as ex: xbmc.log("{0}".format(ex), 3) xbmc.log("Cannot resolve stream URL for channel '{0}'".format(urllib.unquote_plus(name)), 3) xbmc.executebuiltin("Notification({0}, Cannot resolve stream URL for channel '[COLOR {1}][B]{2}[/B][/COLOR]', {3}, {4})".format(AddonName, Addon.getSetting("chColor"), urllib.unquote_plus(name), 5000, __icon2__)) return False channelName, programmeName = GetPlayingDetails(urllib.unquote_plus(name), categoryName) listItem = xbmcgui.ListItem(path=url) listItem.setInfo(type="Video", infoLabels={"mediatype": "movie", "studio": channelName, "title": programmeName, "plot": description}) if iconimage is not None: listItem.setThumbnailImage(iconimage) xbmcplugin.setResolvedUrl(handle=int(sys.argv[1]), succeeded=True, listitem=listItem) return True
def Playf4m(url, name=None, iconimage=None): i = url.find('http://') if url.find('keshet') > 0: makoTicket = common.OPEN_URL( 'http://mass.mako.co.il/ClicksStatistics/entitlementsServices.jsp?et=gt&rv=akamai' ) result = json.loads(makoTicket) ticket = result['tickets'][0]['ticket'] url = "{0}%3F{1}%26hdcore%3D3.0.3".format(url[i:], ticket) else: url = url[i:] print url if name is not None: name = urllib.unquote_plus(name) from F4mProxy import f4mProxyHelper player = f4mProxyHelper() xbmcplugin.endOfDirectory(int(sys.argv[1]), cacheToDisc=False) #player.playF4mLink(urllib.unquote_plus(url), name, use_proxy_for_chunks=True) player.playF4mLink(urllib.unquote_plus(url), name, use_proxy_for_chunks=True, iconimage=iconimage)
def play__(): #Lancer les liens oInputParameterHandler = cInputParameterHandler() sUrl = oInputParameterHandler.getValue('siteUrl').replace('P_L_U_S', '+') sTitle = oInputParameterHandler.getValue('sMovieTitle') sThumbnail = oInputParameterHandler.getValue('sThumbnail') #Special url with tag if '[' in sUrl and ']' in sUrl: sUrl = GetRealUrl(sUrl) if 'dailymotion' in sUrl: oGui = cGui() oRequestHandler = cRequestHandler(sUrl) sHtmlContent = oRequestHandler.request() metadata = json.loads(sHtmlContent) if metadata['qualities']: sUrl = str(metadata['qualities']['auto'][0]['url']) headers = {'User-Agent': 'Android'} mb = requests.get(sUrl, headers=headers).text mb = re.findall('NAME="([^"]+)"\n(.+)', mb) mb = sorted(mb, reverse=True) for quality, url1 in mb: sHosterUrl = url1 oHoster = cHosterGui().checkHoster(sHosterUrl) if (oHoster != False): oHoster.setDisplayName(sTitle + ' ' + quality) oHoster.setFileName(sTitle + ' ' + quality) cHosterGui().showHoster(oGui, oHoster, sHosterUrl, sThumbnail) oGui.setEndOfDirectory() return playmode = '' if playmode == 0: stype = '' if '.ts' in sUrl: stype = 'TSDOWNLOADER' elif '.m3u' in sUrl: stype = 'HLS' if stype: from F4mProxy import f4mProxyHelper f4mp = f4mProxyHelper() xbmcplugin.endOfDirectory(int(sys.argv[1]), cacheToDisc=False) f4mp.playF4mLink(sUrl, sTitle, proxy=None, use_proxy_for_chunks=False, maxbitrate=0, simpleDownloader=False, auth=None, streamtype=stype, setResolved=False, swf=None, callbackpath="", callbackparam="", iconImage=sThumbnail) return if 'f4mTester' in sUrl: xbmc.executebuiltin('XBMC.RunPlugin(' + sUrl + ')') return else: oGuiElement = cGuiElement() oGuiElement.setSiteName(SITE_IDENTIFIER) oGuiElement.setTitle(sTitle) sUrl = sUrl.replace(' ', '%20') oGuiElement.setMediaUrl(sUrl) oGuiElement.setThumbnail(sThumbnail) oPlayer = cPlayer() oPlayer.clearPlayList() oPlayer.addItemToPlaylist(oGuiElement) #tout repetter xbmc.executebuiltin("xbmc.playercontrol(RepeatAll)") oPlayer.startPlayer() return
def playF4mLink(url, name, proxy=None, use_proxy_for_chunks=False): from F4mProxy import f4mProxyHelper player = f4mProxyHelper() player.playF4mLink(url, name, proxy, use_proxy_for_chunks) return
def playF4mLink(url,name,proxy=None,use_proxy_for_chunks=False): from F4mProxy import f4mProxyHelper player=f4mProxyHelper() player.playF4mLink(url, name, proxy, use_proxy_for_chunks) return
def PlayHDS(link, name = "f4mstream"): from F4mProxy import f4mProxyHelper player = f4mProxyHelper() player.playF4mLink(link, name)
def PlayChannel(url, name, iconimage, description, categoryName): try: if url.find('www.youtube.com') > 0: url = myResolver.GetYoutubeFullLink(url) elif url == "BB": url = myResolver.Resolve(url, -1) elif '.f4m' in url: url = url[url.find('http://'):] if 'keshet' in url: ticket = myResolver.GetMinus2Ticket() url = "{0}?{1}&hdcore=3.0.3".format(url, ticket) from F4mProxy import f4mProxyHelper url = f4mProxyHelper().playF4mLink(urllib.unquote_plus(url)) elif "mode=" in url: matches = re.compile('^(.*?)[\?|&]mode=(\-?[0-9]+)(.*?)$', re.I + re.M + re.U + re.S).findall(url) if len(matches) > 0: url = matches[0][0] mode = matches[0][1] if len(matches[0]) > 2: url += matches[0][2] if mode == '3': if useIPTV: url = GetLivestreamerLink(url) else: return False else: if mode == '0': mode = '-3' url = url[url.rfind(';') + 1:] url = myResolver.Resolve(url, mode, useRtmp=useRtmp) if url is None or url == "down": return False except Exception as ex: print ex print "Cannot resolve stream URL for channel '{0}'".format( urllib.unquote_plus(name)) xbmc.executebuiltin( "Notification({0}, Cannot resolve stream URL for channel '[COLOR {1}][B]{2}[/B][/COLOR]', {3}, {4})" .format(AddonName, Addon.getSetting("chColor"), urllib.unquote_plus(name), 5000, __icon2__)) return False channelName, programmeName = GetPlayingDetails(urllib.unquote_plus(name), categoryName) listItem = xbmcgui.ListItem(path=url) listItem.setInfo(type="Video", infoLabels={"title": programmeName}) #listItem.setInfo(type="Video", infoLabels={ "studio": channelName}) listItem.setInfo(type="Video", infoLabels={ "tvshowtitle": channelName, "episode": "0", "season": "0" }) listItem.setInfo(type="Video", infoLabels={"plot": description}) if iconimage is not None: listItem.setThumbnailImage(iconimage) xbmcplugin.setResolvedUrl(handle=int(sys.argv[1]), succeeded=True, listitem=listItem) return True
def Playvid(url, name, download=0): playmode = int(addon.getSetting('chatplay')) chatslow = int(addon.getSetting('chatslow')) listhtml = utils.getHtml(url, hdr=cbheaders) iconimage = xbmc.getInfoImage("ListItem.Thumb") info = "" listhtml = listhtml.replace('\\u0022', '"') m3u8url = re.compile(r'"hls_source":\s*"([^"]+m3u8)"', re.DOTALL | re.IGNORECASE).findall(listhtml) listhtml2 = listhtml.replace('<div class="data"></div>', '<div class="data"> </div>') match = re.compile( r'<div class="label">(.+?)</div>.+?<div class="data">(.+?)</div>', re.DOTALL | re.IGNORECASE).findall(listhtml2) for label, data in match: if label != "About Me:" and label != "Wish List:" and data != "None": info = info + "[B]" + label + "[/B] " + data + "\n" info = info.replace("&", "&").replace("<", "<").replace( ">", ">").replace("'", "'").replace(""", '"') if m3u8url: m3u8stream = m3u8url[0].replace('\\u002D', '-') if chatslow == 1: m3u8stream = m3u8stream.replace('_fast', '') else: m3u8stream = False if playmode == 0: if m3u8stream: videourl = m3u8stream else: utils.notify('Oh oh', 'Couldn\'t find a playable webcam link') return elif playmode == 1: if m3u8stream: from F4mProxy import f4mProxyHelper f4mp = f4mProxyHelper() f4mp.playF4mLink(m3u8stream, name, proxy=None, use_proxy_for_chunks=False, maxbitrate=0, simpleDownloader=False, auth=None, streamtype='HLS', setResolved=False, swf=None, callbackpath="", callbackparam="", iconImage=iconimage) return else: utils.notify('Oh oh', 'Couldn\'t find a playable webcam link') return elif playmode == 2: flv_info = [] embed = re.compile(r"EmbedViewerSwf\(*(.+?)\);", re.DOTALL).findall(listhtml)[0] for line in embed.split("\n"): data = re.search("""\s+["']([^"']+)["'],""", line) if data: flv_info.append(data.group(1)) streamserver = "rtmp://%s/live-edge" % (flv_info[2]) modelname = flv_info[1] username = flv_info[8] password = urllib.unquote(flv_info[12]) unknown = flv_info[13] swfurl = "https://chaturbate.com/static/flash/CBV_2p650.swf" videourl = "%s app=live-edge swfUrl=%s tcUrl=%s pageUrl=http://chaturbate.com/%s/ conn=S:%s conn=S:%s conn=S:2.650 conn=S:%s conn=S:%s playpath=mp4" % ( streamserver, swfurl, streamserver, modelname, username, modelname, password, unknown) listitem = xbmcgui.ListItem(name, iconImage="DefaultVideo.png", thumbnailImage=iconimage) listitem.setInfo('video', {'Title': name, 'Genre': 'P**n', 'Plot': info}) listitem.setProperty("IsPlayable", "true") xbmc.Player().play(videourl, listitem) username = name.split('[')[0].strip() if addon.getSetting("dwnld_stream") == "true" or download == 1: utils.dwnld_stream(videourl, username)
def PlayStream(sourceEtree, urlSoup, name, url): try: #url = urlSoup.url.text pDialog = xbmcgui.DialogProgress() pDialog.create('XBMC', 'Parsing the xml file') pDialog.update(10, 'fetching channel info') title = '' link = '' sc = '' try: link = urlSoup.item.link.text sc = sourceEtree.findtext('sname') title = urlSoup.item.title.text except: pass if link == '': timeD = 2000 #in miliseconds line1 = "couldn't read title and link" xbmc.executebuiltin('Notification(%s, %s, %d, %s)' % (__addonname__, line1, timeD, __icon__)) return False regexs = urlSoup.find('regex') pDialog.update(20, 'Parsing info') if (not regexs == None) and len(regexs) > 0: liveLink = getRegexParsed(urlSoup, link) else: liveLink = link if len(liveLink) == 0: timeD = 2000 #in miliseconds line1 = "couldn't read title and link" xbmc.executebuiltin('Notification(%s, %s, %d, %s)' % (__addonname__, line1, timeD, __icon__)) return False timeD = 2000 #in miliseconds line1 = "Resource found,playing now." pDialog.update(30, line1) liveLink = replaceSettingsVariables(liveLink) name += '-' + sc + ':' + title if (sc == 'GLArab' or sc == 'Local') and '$GL-' in liveLink: gcid = None try: gcid = urlSoup.item.glchannelid.text if gcid and len(gcid) == 0: gcid = None except: pass liveLink = replaceGLArabVariables(liveLink, pDialog, gcid, title) print 'title', title, liveLink if 'proxy' not in title.lower() and 'hd' in title.lower(): print 'inside here' start = time.time() from F4mProxy import f4mProxyHelper player = f4mProxyHelper() urlplayed = player.playF4mLink(liveLink, name, streamtype='HLS') done = time.time() elapsed = done - start if urlplayed and elapsed >= 3: return True else: return False if liveLink == "": return False if (sc == 'kar' or sc == 'Local') and '$KARLOGINCODE$' in liveLink: liveLink = replaceKARVariables(liveLink, pDialog, title) if liveLink == "": return False if (sc == 'yo' or (sc == 'Local' and ('yoolive.com' in liveLink or 'yooanime.com' in liveLink))): liveLink = replaceYOVariables(liveLink, pDialog, title) if liveLink == "": return False print 'liveLink', liveLink pDialog.close() listitem = xbmcgui.ListItem( label=str(name), iconImage="DefaultVideo.png", thumbnailImage=xbmc.getInfoImage("ListItem.Thumb"), path=liveLink) if not 'plugin.video.f4mTester' in liveLink: player = CustomPlayer.MyXBMCPlayer() start = time.time() #xbmc.Player().play( liveLink,listitem) player.play(liveLink, listitem) xbmc.sleep(2000) while player.is_active: xbmc.sleep(200) #return player.urlplayed done = time.time() elapsed = done - start if player.urlplayed and elapsed >= 3: return True else: return False else: xbmc.executebuiltin('XBMC.RunPlugin(' + liveLink + ')') return True except: traceback.print_exc(file=sys.stdout) return False
def PlayLiveLink ( name="9XM" ): url=get_channel_stream_by_name(name) player=f4mProxyHelper() player.playF4mLink(url, name)
def PlayLiveLink(name="9XM"): url = get_channel_stream_by_name(name) player = f4mProxyHelper() player.playF4mLink(url, name)
def playF4mLink(url,name,proxy=None,use_proxy_for_chunks=False,auth_string=None,streamtype='HDS',setResolved=False): from F4mProxy import f4mProxyHelper player=f4mProxyHelper() player.playF4mLink(url,name)
def PlayHDS(link, name="f4mstream"): from F4mProxy import f4mProxyHelper player = f4mProxyHelper() player.playF4mLink(link, name)
def play__(): # Lancer les liens oGui = cGui() oInputParameterHandler = cInputParameterHandler() sUrl = oInputParameterHandler.getValue('siteUrl').replace('P_L_U_S', '+') sTitle = oInputParameterHandler.getValue('sMovieTitle') sThumbnail = oInputParameterHandler.getValue('sThumbnail') sDesc = oInputParameterHandler.getValue('sDesc') # Special url with tag if '[' in sUrl and ']' in sUrl: sUrl = GetRealUrl(sUrl) elif not xbmc.getInfoLabel('system.buildversion')[0:2] >= '19': stype = '' if '.ts' in sUrl: stype = 'TSDOWNLOADER' elif '.m3u' in sUrl: pass if stype: from F4mProxy import f4mProxyHelper f4mp = f4mProxyHelper() xbmcplugin.endOfDirectory(int(sys.argv[1]), cacheToDisc=True) f4mp.playF4mLink(sUrl, sTitle, proxy=None, use_proxy_for_chunks=False, maxbitrate=0, simpleDownloader=True, auth=None, streamtype=stype, setResolved=True, swf=None, callbackpath='', callbackparam='', iconImage=sThumbnail) return if 'f4mTester' in sUrl: xbmc.executebuiltin('XBMC.RunPlugin(' + sUrl + ')') return # Bug specifique au flux france TV # eof detectedL elif 'ftven.fr' in sUrl: oGuiElement = cGuiElement() oGuiElement.setSiteName(SITE_IDENTIFIER) oGuiElement.setTitle(sTitle) sUrl = sUrl.replace(' ', '%20') oGuiElement.setMediaUrl(sUrl) oGuiElement.setThumbnail(sThumbnail) oGuiElement.setDescription(sDesc) from resources.lib.player import cPlayer oPlayer = cPlayer() oPlayer.clearPlayList() oPlayer.addItemToPlaylist(oGuiElement) oPlayer.startPlayer() else: oHoster = cHosterGui().checkHoster(sUrl) if (oHoster != False): oHoster.setDisplayName(sTitle) oHoster.setFileName(sTitle) cHosterGui().showHoster(oGui, oHoster, sUrl, sThumbnail) oGui.setEndOfDirectory()
def play__():#Lancer les liens oInputParameterHandler = cInputParameterHandler() sUrl = oInputParameterHandler.getValue('siteUrl').replace('P_L_U_S', '+') sTitle = oInputParameterHandler.getValue('sMovieTitle') sThumbnail = oInputParameterHandler.getValue('sThumbnail') #Special url with tag if '[' in sUrl and ']' in sUrl: sUrl = GetRealUrl(sUrl) if 'dailymotion' in sUrl: oGui = cGui() oRequestHandler = cRequestHandler(sUrl) sHtmlContent = oRequestHandler.request() metadata = json.loads(sHtmlContent) if metadata['qualities']: sUrl = str(metadata['qualities']['auto'][0]['url']) oRequestHandler = cRequestHandler(sUrl) oRequestHandler.addHeaderEntry('User-Agent', 'Android') mb = oRequestHandler.request() mb = re.findall('NAME="([^"]+)"\n(.+)',mb) mb = sorted(mb,reverse=True) for quality, url1 in mb: sHosterUrl = url1 oHoster = cHosterGui().checkHoster(sHosterUrl) if (oHoster != False): oHoster.setDisplayName(sTitle + ' ' +quality) oHoster.setFileName(sTitle + ' ' +quality) cHosterGui().showHoster(oGui, oHoster, sHosterUrl, sThumbnail) oGui.setEndOfDirectory() return playmode = '' if playmode == 0: stype = '' if '.ts' in sUrl: stype = 'TSDOWNLOADER' elif '.m3u' in sUrl: stype = 'HLS' if stype: from F4mProxy import f4mProxyHelper f4mp=f4mProxyHelper() xbmcplugin.endOfDirectory(int(sys.argv[1]), cacheToDisc=False) f4mp.playF4mLink(sUrl, sTitle, proxy=None, use_proxy_for_chunks=False, maxbitrate=0, simpleDownloader=False, auth=None, streamtype=stype, setResolved=False, swf=None, callbackpath="", callbackparam="", iconImage=sThumbnail) return if 'f4mTester' in sUrl: xbmc.executebuiltin('XBMC.RunPlugin(' + sUrl + ')') return else: oGuiElement = cGuiElement() oGuiElement.setSiteName(SITE_IDENTIFIER) oGuiElement.setTitle(sTitle) sUrl = sUrl.replace(' ','%20') oGuiElement.setMediaUrl(sUrl) oGuiElement.setThumbnail(sThumbnail) oPlayer = cPlayer() oPlayer.clearPlayList() oPlayer.addItemToPlaylist(oGuiElement) #tout repetter xbmc.executebuiltin("xbmc.playercontrol(RepeatAll)") oPlayer.startPlayer() return
def PlayStream(sourceEtree, urlSoup, name, url): try: #url = urlSoup.url.text pDialog = xbmcgui.DialogProgress() pDialog.create('XBMC', 'Parsing the xml file') pDialog.update(10, 'fetching channel info') title='' link='' sc='' try: link=urlSoup.item.link.text sc=sourceEtree.findtext('sname') title=urlSoup.item.title.text except: pass if link=='': timeD = 2000 #in miliseconds line1="couldn't read title and link" xbmc.executebuiltin('Notification(%s, %s, %d, %s)'%(__addonname__,line1, timeD, __icon__)) return False regexs = urlSoup.find('regex') pDialog.update(20, 'Parsing info') if (not regexs==None) and len(regexs)>0: liveLink= getRegexParsed(urlSoup,link) else: liveLink= link if len(liveLink)==0: timeD = 2000 #in miliseconds line1="couldn't read title and link" xbmc.executebuiltin('Notification(%s, %s, %d, %s)'%(__addonname__,line1, timeD, __icon__)) return False timeD = 2000 #in miliseconds line1="Resource found,playing now." pDialog.update(30, line1) liveLink=replaceSettingsVariables(liveLink) name+='-'+sc+':'+title if (sc=='GLArab' or sc=='Local') and '$GL-' in liveLink : gcid=None try: gcid = urlSoup.item.glchannelid.text if gcid and len(gcid)==0: gcid=None except: pass liveLink=replaceGLArabVariables(liveLink,pDialog,gcid, title) print 'title',title,liveLink if 'proxy' not in title.lower() and 'hd' in title.lower() and ':7777/' in liveLink: print 'inside here' start = time.time() from F4mProxy import f4mProxyHelper player=f4mProxyHelper() urlplayed=player.playF4mLink(liveLink, name, streamtype='HLS') done = time.time() elapsed = done - start if urlplayed and elapsed>=3: return True else: return False if liveLink=="": return False if (sc=='kar' or sc=='Local') and '$KARLOGINCODE$' in liveLink : liveLink=replaceKARVariables(liveLink,pDialog,title) if liveLink=="": return False if (sc=='yo' or (sc=='Local' and ('yoolive.com' in liveLink or 'yooanime.com' in liveLink))) : liveLink=replaceYOVariables(liveLink,pDialog,title) if liveLink=="": return False print 'liveLink',liveLink pDialog.close() listitem = xbmcgui.ListItem( label = str(name), iconImage = "DefaultVideo.png", thumbnailImage = xbmc.getInfoImage( "ListItem.Thumb" ), path=liveLink ) if not 'plugin.video.f4mTester' in liveLink: player = CustomPlayer.MyXBMCPlayer() start = time.time() #xbmc.Player().play( liveLink,listitem) player.play( liveLink,listitem) xbmc.sleep(2000) while player.is_active: xbmc.sleep(200) #return player.urlplayed done = time.time() elapsed = done - start if player.urlplayed and elapsed>=3: return True else: return False else: xbmc.executebuiltin('XBMC.RunPlugin('+liveLink+')') return True except: traceback.print_exc(file=sys.stdout) return False