def TVIndexOLD(url): ################# TV Index ################# link=main.OPEN_URL(url) link=main.unescapes(link) match = re.findall('''<div class="view_img">\s*<a href="([^"]*?)" class="spec-border-ie" title="">\s*<img class="img-preview spec-border" src="([^']*?)" alt=" " style="background-color: #717171;"/>\s*</a>\s*</div>\s*<h5>\s*<a class="link" href=".+?title=".+?">([^"]*?)</a>\s*</h5><p class="left">([^"]*?)</p>''',link) dialogWait = xbmcgui.DialogProgress() ret = dialogWait.create('Please wait until Show list is cached.') totalLinks = len(match) loadedLinks = 0 remaining_display = 'Latest Episodes Loaded :: [B]'+str(loadedLinks)+' / '+str(totalLinks)+'[/B].' dialogWait.update(0, '[B]Will load instantly from now on[/B]',remaining_display) for thumb,url,name,season in match: #name=name.replace('\r','').replace('\n','').replace('\t','').replace(' ','').replace('\\','').replace('\xe2\x80\x99',"'").replace('\xe2\x80\x93','-').replace('\xe2\x80\x94','').replace('&-','-') name=main.unescapes(name) #main.addInfo(name+ ' ' + season,url,75,thumb,'','') main.addDirTE(name+ ' ' + season,url,75,thumb,'','','','','') loadedLinks = loadedLinks + 1 percent = (loadedLinks * 100)/totalLinks remaining_display = 'Latest Episodes Loaded :: [B]'+str(loadedLinks)+' / '+str(totalLinks)+'[/B].' dialogWait.update(percent,'[B]Will load instantly from now on[/B]',remaining_display) if (dialogWait.iscanceled()): return False dialogWait.close() del dialogWait nextpage=re.compile('><a href="([^"]*?)">»</a></li> </ul> </div> <div class="show_all_btn"><ul class="pagination"><li>').findall(link) for url in nextpage: main.addDir('[COLOR blue]Next Page -> [/COLOR]',url,1,art+'/next.png') xbmcplugin.setContent(int(sys.argv[1]), 'Tv-Shows')
def Episodes(url,name): ################# TV Episodes ################# link=main.OPEN_URL(url) link=main.unescapes(link) match = re.findall('<a class="link" href="([^"]*?)" title=".+?">.+?(Episode[^"]*?)</a></h5>',link) for url,showtitle in match: name=main.unescapes(name) main.addDirTE("[COLOR yellow]"+name+" "+showtitle+"[/COLOR]",url,75,'','','','','','')
def TVIndex(url,index=False): ################# TV Index ################# link=main.OPEN_URL(url) link=main.unescapes(link) match = re.findall('''<div class="view_img">\s*<a href="([^"]*?)" class="spec-border-ie" title="">\s*<img class="img-preview spec-border" src="([^']*?)" alt=" " style="background-color: #717171;"/>\s*</a>\s*</div>\s*<h5>\s*<a class="link" href=".+?title=".+?">([^"]*?)</a>\s*</h5><p class="left">([^"]*?)</p>''',link) dialogWait = xbmcgui.DialogProgress() ret = dialogWait.create('Please wait until Show list is cached.') totalLinks = len(match) loadedLinks = 0 remaining_display = 'Shows loaded :: [B]'+str(loadedLinks)+' / '+str(totalLinks)+'[/B].' dialogWait.update(0, '[B]Will load instantly from now on[/B]',remaining_display) xbmc.executebuiltin("XBMC.Dialog.Close(busydialog,true)") for url,thumb,name,season in match: main.addDirTE(name+ ' ' + season,url,75,thumb,'','','','','') loadedLinks = loadedLinks + 1 percent = (loadedLinks * 100)/totalLinks remaining_display = 'Shows loaded :: [B]'+str(loadedLinks)+' / '+str(totalLinks)+'[/B].' dialogWait.update(percent,'[B]Will load instantly from now on[/B]',remaining_display) if dialogWait.iscanceled(): return False dialogWait.close() del dialogWait nextpage=re.compile('><a href="([^"]*?)">»</a></li> </ul> </div> <div class="show_all_btn"><ul class="pagination"><li>').findall(link) for url in nextpage: main.addDir('[COLOR blue]Next Page -> [/COLOR]',url,1,art+'/next.png') xbmcplugin.setContent(int(sys.argv[1]), 'Movies') main.VIEWS()
def TvSeasons(url,name): ################# TV Seasons ################# link=main.OPEN_URL(url) link=main.unescapes(link) match=re.findall('<a href=\'([^"]*?)\'>(Season[^"]*?)</a>',link) for url,season in match: #name = 'Season ' +name main.addDir(name+' '+season,url,8,'')
def TVIndex3(url,name): ################# TV Genre Index ################# link=main.OPEN_URL(url) link=main.unescapes(link) match = re.findall('<div class="view_img">.+?<a href="([^"]*?)" class="spec-border-ie" title="">.+?<img class="img-preview spec-border show-thumbnail" src="([^"]*?)" alt=.+?class="link" href=".+?" title=".+?">([^"]*?)</a>',link) dialogWait = xbmcgui.DialogProgress() ret = dialogWait.create('Please wait until Show list is cached.') totalLinks = len(match) loadedLinks = 0 remaining_display = 'Tv Episodes loaded :: [B]'+str(loadedLinks)+' / '+str(totalLinks)+'[/B].' dialogWait.update(0, '[B]Will load instantly from now on[/B]',remaining_display) for url,thumb,name in match: name=name.replace('\r','').replace('\n','').replace('\t','').replace(' ','').replace('\\','').replace('\xe2\x80\x99',"'").replace('\xe2\x80\x93','-').replace('\xe2\x80\x94','').replace('&-','-') #main.addInfo(name,url,7,thumb,'','') main.addDirTE(name,url,7,thumb,'','','','','') loadedLinks = loadedLinks + 1 percent = (loadedLinks * 100)/totalLinks remaining_display = 'Tv Episodes loaded :: [B]'+str(loadedLinks)+' / '+str(totalLinks)+'[/B].' dialogWait.update(percent,'[B]Will load instantly from now on[/B]',remaining_display) if (dialogWait.iscanceled()): return False dialogWait.close() del dialogWait nextpage=re.compile('<a href="([^"]*?)">»</a></li> </ul> </div> <form method="post"').findall(link) for url in nextpage: main.addDir('[COLOR blue]Next Page -> [/COLOR]',url,5,art+'/next.png') xbmcplugin.setContent(int(sys.argv[1]), 'Tv-Shows')
def ListArtist(murl,thumb): html = main.OPENURL(murl) link=main.unescapes(html).decode('ascii', 'ignore') match = re.findall('(?sim)<a href=".+?">([^<]+)</a></b([^<]+)<br/>(.+?)<.+?<span class="year_column"> ([^<]+)</span>',link.replace(' ','')) for film,type,fname,year in match: type=type.replace('>','') fname = re.sub('<a href=".+?"','',fname) fname=fname.replace('>','') if type == '': type='(Movie)' if 'TV Series' in type: main.addDir(film+' [COLOR yellow]'+type+'[/COLOR] [COLOR aqua]'+fname+'[/COLOR][COLOR yellow]'+year+'[/COLOR]','TVx',20,thumb) else: main.addDir(film+' ('+year+') [COLOR yellow]'+type+'[/COLOR] [COLOR aqua]'+fname+'[/COLOR]','Movies',20,thumb)
def Play(name,url): ok=True namelist=[] urllist=[] infoLabels =main.GETMETAT(name,'','','') video_type='movie' season='' episode='' img=infoLabels['cover_url'] fanart =infoLabels['backdrop_url'] imdb_id=infoLabels['imdb_id'] infolabels = { 'supports_meta' : 'true', 'video_type':video_type, 'name':str(infoLabels['title']), 'imdb_id':str(infoLabels['imdb_id']), 'season':str(season), 'episode':str(episode), 'year':str(infoLabels['year']) } link=main.OPENURL(url) link=link.replace('\r','').replace('\n','').replace('\t','').replace(' ','') docUrl= re.compile('class="embeds-video"><iframe src="(.+?)"').findall(link) if docUrl: xbmc.executebuiltin("XBMC.Notification(Please Wait!,Collecting Links,3000)") link=main.OPENURL(docUrl[0]) link=link.replace('\r','').replace('\n','').replace('\t','').replace(' ','').replace('\/','/').replace('\\','=') match= re.compile('url_encoded_fmt_stream_map\":\"(.+?),\"').findall(link) if match: streams_map = str(match) stream= re.compile('url=u003d(.+?)=u0026type=u003d.+?=u0026quality=u003d(.+?),itag').findall(streams_map) for group1,group2 in stream:#Thanks to the-one for google-doc resolver stream_url = str(group1) stream_url = main.unescapes(stream_url) urllist.append(stream_url) stream_qlty = str(group2.upper()) if (stream_qlty == 'HD720'): stream_qlty = 'HD-720p' elif (stream_qlty == 'LARGE'): stream_qlty = 'SD-480p' elif (stream_qlty == 'MEDIUM'): stream_qlty = 'SD-360p' namelist.append(stream_qlty) dialog = xbmcgui.Dialog() answer =dialog.select("Quality Select", namelist) if answer != -1: xbmc.executebuiltin("XBMC.Notification(Please Wait!,Opening Link,3000)") stream_url2 = urllist[int(answer)] infoL={'Title': infoLabels['title'], 'Plot': infoLabels['plot'], 'Genre': infoLabels['genre']} # play with bookmark from resources.universal import playbackengine player = playbackengine.PlayWithoutQueueSupport(resolved_url=stream_url, addon_id=addon_id, video_type=video_type, title=str(infoLabels['title']),season=str(season), episode=str(episode), year=str(infoLabels['year']),img=img,infolabels=infoL, watchedCallbackwithParams=main.WatchedCallbackwithParams,imdb_id=imdb_id) #WatchHistory #if selfAddon.getSetting("whistory") == "true": # wh.add_item(mname+' '+'[COLOR green]FilmesOnline2[/COLOR]', sys.argv[0]+sys.argv[2], infolabels='', img=thumb, fanart='', is_folder=False) player.KeepAlive() return ok else: xbmc.executebuiltin("XBMC.Notification(Sorry!,Protected Link,5000)")
def SearchArtist(encode,murl): seapath=os.path.join(main.datapath,'Search') SeaFile=os.path.join(seapath,'SearchHistoryArtist') if 'Artist' in murl: surl=MainUrl+'/find?ref_=nv_sr_fn&q='+encode+'&s=nm' else: keyb = xbmc.Keyboard('', 'Search For Artist by Name') keyb.doModal() if (keyb.isConfirmed()): search = keyb.getText() encode=urllib.quote(search) surl=MainUrl+'/find?ref_=nv_sr_fn&q='+encode+'&s=nm' if not os.path.exists(SeaFile): open(SeaFile,'w').write('search="%s",'%encode) else: open(SeaFile,'a').write('search="%s",'%encode) html = main.OPENURL(surl) link=main.unescapes(html).decode('ascii', 'ignore') match = re.findall('(?sim)<img src="([^"]+)" /></a> </td> <td class="result_text"> <a href="([^"]+)" >([^<]+)</a> <small>\((.+?), <a href=".+?" >([^<]+)</a>([^<]+)\)</small>',link.replace(' ','')) for thumb,url,name,job,star,year in match: thumbs=thumb.split('_V1')[0] if 'http' not in job: main.addDir(name+' [COLOR orange]'+job+'[/COLOR] [COLOR aqua]'+star+'[/COLOR][COLOR yellow]'+year+'[/COLOR]',MainUrl+url,488,thumbs+'_V1_SY317_CR124,0,214,317_AL_.jpg')
def SearchArtist(encode,murl): seapath=os.path.join(main.datapath,'Search') SeaFile=os.path.join(seapath,'SearchHistoryArtist') if 'Artist' in murl: surl='http://www.imdb.com/find?ref_=nv_sr_fn&q='+encode+'&s=nm' else: keyb = xbmc.Keyboard('', 'Search For Artist by Name') keyb.doModal() if (keyb.isConfirmed()): search = keyb.getText() encode=urllib.quote(search) surl='http://www.imdb.com/find?ref_=nv_sr_fn&q='+encode+'&s=nm' if not os.path.exists(SeaFile): open(SeaFile,'w').write('search="%s",'%encode) else: open(SeaFile,'a').write('search="%s",'%encode) html = main.OPENURL(surl) link=main.unescapes(html).decode('ascii', 'ignore') match = re.findall('(?sim)<img src="([^"]+)" /></a> </td> <td class="result_text"> <a href="([^"]+)" >([^<]+)</a> <small>\((.+?), <a href=".+?" >([^<]+)</a>([^<]+)\)</small>',link.replace(' ','')) for thumb,url,name,job,star,year in match: thumbs=thumb.split('_V1')[0] if 'http' not in job: main.addDir(name+' [COLOR orange]'+job+'[/COLOR] [COLOR aqua]'+star+'[/COLOR][COLOR yellow]'+year+'[/COLOR]',MainUrl+url,488,thumbs+'_V1_SY317_CR124,0,214,317_AL_.jpg')
def Play(name, url): ok = True namelist = [] urllist = [] infoLabels = main.GETMETAT(name, '', '', '') video_type = 'movie' season = '' episode = '' img = infoLabels['cover_url'] fanart = infoLabels['backdrop_url'] imdb_id = infoLabels['imdb_id'] infolabels = { 'supports_meta': 'true', 'video_type': video_type, 'name': str(infoLabels['title']), 'imdb_id': str(infoLabels['imdb_id']), 'season': str(season), 'episode': str(episode), 'year': str(infoLabels['year']) } link = main.OPENURL(url) link = link.replace('\r', '').replace('\n', '').replace('\t', '').replace(' ', '') docUrl = re.compile('class="embeds-video"><iframe src="(.+?)"').findall( link) if docUrl: xbmc.executebuiltin( "XBMC.Notification(Please Wait!,Collecting Links,3000)") link = main.OPENURL(docUrl[0]) link = link.replace('\r', '').replace('\n', '').replace('\t', '').replace( ' ', '').replace('\/', '/').replace('\\', '=') match = re.compile('url_encoded_fmt_stream_map\":\"(.+?),\"').findall( link) if match: streams_map = str(match) stream = re.compile( 'url=u003d(.+?)=u0026type=u003d.+?=u0026quality=u003d(.+?),itag' ).findall(streams_map) for group1, group2 in stream: #Thanks to the-one for google-doc resolver stream_url = str(group1) stream_url = main.unescapes(stream_url) urllist.append(stream_url) stream_qlty = str(group2.upper()) if (stream_qlty == 'HD720'): stream_qlty = 'HD-720p' elif (stream_qlty == 'LARGE'): stream_qlty = 'SD-480p' elif (stream_qlty == 'MEDIUM'): stream_qlty = 'SD-360p' namelist.append(stream_qlty) dialog = xbmcgui.Dialog() answer = dialog.select("Quality Select", namelist) if answer != -1: xbmc.executebuiltin( "XBMC.Notification(Please Wait!,Opening Link,3000)") stream_url2 = urllist[int(answer)] infoL = { 'Title': infoLabels['title'], 'Plot': infoLabels['plot'], 'Genre': infoLabels['genre'] } # play with bookmark from resources.universal import playbackengine player = playbackengine.PlayWithoutQueueSupport( resolved_url=stream_url, addon_id=addon_id, video_type=video_type, title=str(infoLabels['title']), season=str(season), episode=str(episode), year=str(infoLabels['year']), img=img, infolabels=infoL, watchedCallbackwithParams=main.WatchedCallbackwithParams, imdb_id=imdb_id) #WatchHistory #if selfAddon.getSetting("whistory") == "true": # wh.add_item(mname+' '+'[COLOR green]FilmesOnline2[/COLOR]', sys.argv[0]+sys.argv[2], infolabels='', img=thumb, fanart='', is_folder=False) player.KeepAlive() return ok else: xbmc.executebuiltin("XBMC.Notification(Sorry!,Protected Link,5000)")