def make_programs_list(url): try: params = utils.get_url(url) programs = comm.get_series_from_feed(params['series'], category=params['category']) ok = True for p in programs: listitem = xbmcgui.ListItem(label=p.get_list_title(), iconImage=p.get_thumbnail(), thumbnailImage=p.get_thumbnail()) listitem.setInfo('video', p.get_xbmc_list_item()) listitem.setProperty('IsPlayable', 'true') if hasattr(listitem, 'addStreamInfo'): listitem.addStreamInfo('audio', p.get_xbmc_audio_stream_info()) listitem.addStreamInfo('video', p.get_xbmc_video_stream_info()) # Build the URL for the program, including the list_info url = "%s?play=true&%s" % (sys.argv[0], p.make_xbmc_url()) # Add the program item to the list ok = xbmcplugin.addDirectoryItem(handle=int(sys.argv[1]), url=url, listitem=listitem, isFolder=False, totalItems=len(programs)) xbmcplugin.endOfDirectory(handle=int(sys.argv[1]), succeeded=ok) xbmcplugin.setContent(handle=int(sys.argv[1]), content='episodes') except: utils.handle_error('Unable to fetch program list')
def l111111l_SBK_(name,url,mode,iconimage,season): u=sys.argv[0]+l1l111_SBK_ (u"ࠤࡂࡹࡷࡲ࠽ࠣ৽")+urllib.quote_plus(url)+l1l111_SBK_ (u"ࠥࠪࡲࡵࡤࡦࠥ৾")+str(mode)+l1l111_SBK_ (u"ࠦࠫࡴࡡࡧࡀࠦ")+urllib.quote_plus(name)+l1l111_SBK_ (u"ࠧࠬࡳࡦࡣࡶࡳࡳࡃࠢ")+str(season) xbmcplugin.setContent(int(sys.argv[1]), l1l111_SBK_ (u"࠭ࡍࡰࡸࡩࡸ࠭ਁ")) l11lll1l1_SBK_=xbmcgui.ListItem(name, iconImage=l1l111_SBK_ (u"ࠢࡧࡣࡱࡥࡷࡺࡲࡪࠦਂ"), thumbnailImage=iconimage) l11lll1l1_SBK_.setProperty(l1l111_SBK_ (u"ࠨࡨࡤࡲࡦࡸࡴࡠࡰࡥࠧਃ"), __FANART__) xbmcplugin.addDirectoryItem(handle=int(sys.argv[1]),url=u,listitem=l11lll1l1_SBK_,isFolder=True) return True
def getEpisodeList(self, url): contentType,main_page = common.getData(url) episodeList = re.compile('<ol class="episode-list".*?</ol>').findall(main_page) episodes = re.compile('data-json.*?tooltipTitle":"(.*?)&.*?:"(.*?)".*?:"(.*?)&.*?href="(.*?)"').findall(episodeList[0]) for title, summary, img, url in episodes: episodeNum = re.compile('(\d.*?)/').findall(url)[0] contentType, page = common.getData('http://video2.walla.co.il/?w=null/null/' + episodeNum + '/@@/video/flv_pl') titleMatches = re.compile('<title>(.*?)</title>(.*)<subtitle>(.*?)<').findall(page) if (len(titleMatches)) == 1: title = titleMatches[0][0] images = re.compile('<preview_pic>(.*?)</preview_pic>').findall(page) if (len(images)) >= 1: iconImage = images[0] details = re.compile('<synopsis>(.*?)</synopsis>').findall(page) if (len(details)) > 0: epiDetails = details[0] timeInSeconds = re.compile('<duration>(.*?)</duration>').findall(page) if not timeInSeconds == None and not len(timeInSeconds[0]) <= 0: time = int(timeInSeconds[0]) / 60 else: time = '00:00' url = 'rtmp://waflaWBE.walla.co.il/ app=vod/ swfvfy=true swfUrl=http://i.walla.co.il/w9/swf/video_swf/vod/walla_vod_player_adt.swf?95 tcurl=rtmp://waflaWBE.walla.co.il/vod/ pageurl=http://walla.co.il/ playpath=' + re.compile('<src>(.*?)</src>').findall(page)[0] common.addLink(contentType,title, url, iconImage, str(time), epiDetails) nextPage = re.compile('<a class="in_blk p_r" href="(.*?)" style=""></a>').findall(main_page) if (len(nextPage)) > 0: addDir('UTF-8',__language__(30001), __BASE_URL__ + nextPage[0], self.MODES.GET_EPISODES_LIST, 'DefaultFolder.png', __NAME__) xbmcplugin.setContent(int(sys.argv[1]), 'episodes') xbmc.executebuiltin("Container.SetViewMode(500)")
def setView(content, viewType): if content: xbmcplugin.setContent(int(sys.argv[1]), content) if addon.get_setting('auto-view') == 'true': print addon.get_setting(viewType) if addon.get_setting(viewType) == 'Info': VT = '504' elif addon.get_setting(viewType) == 'Info2': VT = '503' elif addon.get_setting(viewType) == 'Info3': VT = '515' elif addon.get_setting(viewType) == 'Fanart': VT = '508' elif addon.get_setting(viewType) == 'Poster Wrap': VT = '501' elif addon.get_setting(viewType) == 'Big List': VT = '51' elif viewType == 'default-view': VT = addon.get_setting(viewType) print viewType print VT xbmc.executebuiltin("Container.SetViewMode(%s)" % ( int(VT) ) ) xbmcplugin.addSortMethod( handle=int( sys.argv[ 1 ] ), sortMethod=xbmcplugin.SORT_METHOD_UNSORTED ) xbmcplugin.addSortMethod( handle=int( sys.argv[ 1 ] ), sortMethod=xbmcplugin.SORT_METHOD_LABEL ) xbmcplugin.addSortMethod( handle=int( sys.argv[ 1 ] ), sortMethod=xbmcplugin.SORT_METHOD_VIDEO_RATING ) xbmcplugin.addSortMethod( handle=int( sys.argv[ 1 ] ), sortMethod=xbmcplugin.SORT_METHOD_DATE ) xbmcplugin.addSortMethod( handle=int( sys.argv[ 1 ] ), sortMethod=xbmcplugin.SORT_METHOD_PROGRAM_COUNT ) xbmcplugin.addSortMethod( handle=int( sys.argv[ 1 ] ), sortMethod=xbmcplugin.SORT_METHOD_VIDEO_RUNTIME ) xbmcplugin.addSortMethod( handle=int( sys.argv[ 1 ] ), sortMethod=xbmcplugin.SORT_METHOD_GENRE ) xbmcplugin.addSortMethod( handle=int( sys.argv[ 1 ] ), sortMethod=xbmcplugin.SORT_METHOD_MPAA_RATING )
def listA(name, type, url, thumb): link = GetHttpData(url) match1 = re.compile("<!-- 剧集列表 start -->(.+?)<!-- 剧集列表 end -->", re.DOTALL).findall(link) match2 = re.compile('<div class="left">(.+?)</div>', re.DOTALL).findall(match1[0]) if match2: match = re.compile(r"'videoListCon', '(.+?)'", re.DOTALL).findall(match2[0]) if match: FindItems(type, match1[0]) for url in match: link = GetHttpData("http://www.juchang.com" + url) link = link.decode("gbk").encode("utf8") FindItems(type, link) match2 = re.compile('<a href="#" class="one"(.+?)<a class="two"', re.DOTALL).findall(link) if match2: match3 = re.compile(r"'videoListCon','(.+?)'", re.DOTALL).findall(match2[0]) for urla in match3: link = GetHttpData("http://www.juchang.com" + urla) link = link.decode("gbk").encode("utf8") FindItems(type, link) else: FindItems(type, match1[0]) else: FindItems(type, match1[0]) xbmcplugin.setContent(int(sys.argv[1]), "movies") xbmcplugin.endOfDirectory(int(sys.argv[1]))
def getEpisodeList(urlbase, inUrl, pattern, modulename, mode, patternFeatured='', patternmore='class="in_blk p_r"\sstyle=""\shref="(.*?)"'): ## get all the rest of the episodes contentType,mainPage = getData(inUrl) if patternFeatured != '': urls = re.compile(patternFeatured).findall(mainPage) urls += re.compile(pattern).findall(mainPage) else: urls = re.compile(pattern).findall(mainPage) ## for each episode we get the episode page to parse all the info from for path in urls: contentType,page = getData(urlbase + path + '/@@/video/flv_pl') titleMatches = re.compile('<title>(.*?)</title>(.*)<subtitle>(.*?)<').findall(page) if (len(titleMatches)) == 1: title = titleMatches[0][0] images = re.compile('<preview_pic>(.*?)</preview_pic>').findall(page) if (len(images)) >= 1: iconImage = images[0] details = re.compile('<synopsis>(.*?)</synopsis>').findall(page) if (len(details)) > 0: epiDetails = details[0] timeInSeconds = re.compile('<duration>(.*?)</duration>').findall(page) if not timeInSeconds == None and not len(timeInSeconds[0]) <= 0: time = int(timeInSeconds[0]) / 60 else: time = '00:00' url = 'rtmp://waflaWBE.walla.co.il/ app=vod/ swfvfy=true swfUrl=http://i.walla.co.il/w9/swf/video_swf/vod/walla_vod_player_adt.swf?95 tcurl=rtmp://waflaWBE.walla.co.il/vod/ pageurl=http://walla.co.il/ playpath=' + re.compile('<src>(.*?)</src>').findall(page)[0] addLink(contentType,title, url, iconImage, str(time), epiDetails) nextPage = re.compile(patternmore).findall(mainPage) if (len(nextPage)) > 0: addDir('UTF-8',__language__(30001), urlbase + nextPage[0], mode, 'DefaultFolder.png', modulename) xbmcplugin.setContent(int(sys.argv[1]), 'episodes')
def CATEGORIES(): contentType, page = getData('http://vod.walla.co.il/') topMenuBloc = re.compile('<nav class="fc main-nav"(.*?)</nav>').findall(page) bottomGroupBloc = re.compile('<nav class="fc footer-logos".*?</nav>').findall(page) items = re.compile('<li><a href="(.*?)">(.*?)<').findall(topMenuBloc[0]) i = 1 for url, title in items: if i >= 4: break module = '00000' + str(i) iconImage = xbmc.translatePath(os.path.join(__PLUGIN_PATH__, 'cache', 'images', 'wallaBase', module + '.png')) addDir('UTF-8', title, 'http://vod.walla.co.il' + url, 1, iconImage, module) i=i+1 bottomItems = re.compile('<td.*?<a href="(.*?)"><img src="(.*?)" alt="(.*?)"').findall(bottomGroupBloc[0]) for url, img, title in bottomItems: iconImage = getImage(img, 'wallaBase') if url.startswith('http'): elementId = re.compile("http://(.*?)\.").findall(url) addDir('UTF-8', title, url, 1, iconImage, elementId[0]) print 'url='+url print 'eid='+elementId[0] else : elementId = url #re.compile("channel/(.*?)/").findall(url) addDir('UTF-8', title, 'http://vod.walla.co.il' + url, 1, iconImage, elementId[0]) xbmcplugin.setContent(int(sys.argv[1]), 'tvshows')
def TVIndex2(url,name): ################# TV TAG Index ################# link=main.OPEN_URL(url) link=link.replace('\r','').replace('\n','').replace('\t','').replace(' ','').replace('\\','') match = re.findall('src="http://www.thedarewall.com/tv/templates/svarog/timthumb.php[?]src=([^"]*)&w=[^"]*&h=[^"]*&zc=1" alt=" "/> </a> </div> <h5> <a 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 thumb,url,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('<li><a href="([^"]*)">»</a></li> </ul></div><form method="post"').findall(link) for url in nextpage: main.addDir('[COLOR blue]Next Page -> [/COLOR]',url,3,art+'/next.png') xbmcplugin.setContent(int(sys.argv[1]), 'Tv-Shows')
def TVIndex3(url,name): ################# TV Genre Index ################# link=main.OPENURL(url) link=link.replace('\r','').replace('\n','').replace('\t','').replace(' ','') 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 Premiers(url,name): ################# Premiers ################# link=main.OPEN_URL(url) link=link.replace('\r','').replace('\n','').replace('\t','').replace(' ','').replace('\\','') match = re.findall('<a href="([^"]*)" style=".+?background-image: url([^"]*);".+?><h2>([^"]*)</h2>',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('">'," ") thumb = base_url + thumb url = 'http://www.thedarewall.com/' + url 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 xbmcplugin.setContent(int(sys.argv[1]), 'Tv-Shows')
def TVIndex(url): ################# TV Index ################# link=main.OPEN_URL(url) link=link.replace('\r','').replace('\n','').replace('\t','').replace(' ','').replace('\\','') match = re.findall('<img class="img-preview spec-border" src="([^"]*?)" alt=" " style="background.+?<a class="link" href="([^"]*?)" title=".+?">([^"]*?)</a>.+?</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('&-','-') #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 LISTSHOWS(murl,channel,index=False): link=main.OPENURL(murl) link=link.replace('\r','').replace('\n','').replace('\t','').replace(' ','') match = re.findall('<div class="titleline"><h2 class="forumtitle"><a href="(.+?)">(.+?)</a></h2></div>',link) label='TV Shows' if not len(match) > 0: match = re.findall('<h3 class="threadtitle">.+?<a class=".+?" href="(.+?)" id=".+?">(.+?)</a></h3>', link) label = 'Movies' dialogWait = xbmcgui.DialogProgress() ret = dialogWait.create('Please wait until ' + label + ' Show list is cached.') totalLinks = len(match) loadedLinks = 0 remaining_display = label + ' 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,name in match: if "color" in name: name=name.replace('<b><font color=red>','[COLOR red]').replace('</font></b>','[/COLOR]') name=name.replace('<b><font color="red">','[COLOR red]').replace('</font></b>','[/COLOR]') if label == 'Movies': main.addDirX(name, MainUrl+url,39,'',searchMeta=True, metaType='Movies') else: main.addTVInfo(name,MainUrl+url,38,getShowImage(channel,name),'','') loadedLinks = loadedLinks + 1 percent = (loadedLinks * 100)/totalLinks remaining_display = label + ' 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 xbmcplugin.setContent(int(sys.argv[1]), label) main.VIEWS()
def LISTEPISODES(tvshowname,url): link=main.OPENURL(url) link=link.replace('\r','').replace('\n','').replace('\t','').replace(' ','') match = re.findall('<a class=".+?" href="(.+?)" id=".+?">(.+?)</a>',link) dialogWait = xbmcgui.DialogProgress() ret = dialogWait.create('Please wait until ['+tvshowname+'] Episodes are cached.') totalLinks = len(match) loadedLinks = 0 remaining_display = 'Episodes 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,name in match: if "Online" not in name: continue name=name.replace(tvshowname,'').replace('Watch Online','') name=main.removeNonASCII(name) main.addTVInfo(name,MainUrl+url,39,'','','') loadedLinks = loadedLinks + 1 percent = (loadedLinks * 100)/totalLinks remaining_display = '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 match=re.findall('<div id="above_threadlist" class="above_threadlist">(.+?)</div>',link) for string in match: match1=re.findall('<a href="(.+?)" title="(.+?)">[0-9]+</a>', string) for url, page in match1: main.addTVInfo(page,MainUrl+url,38,'','','') dialogWait.close() del dialogWait xbmcplugin.setContent(int(sys.argv[1]), 'TV Shows') main.VIEWS()
def list_episodes(self, movie_id): xbmcplugin.setContent(int(sys.argv[1]), 'episodes') query_params = {'movieid': movie_id} m = self.__request__('movie', query_params)['r'] _id = m['MovieID'] name = m['MovieName'] aka = m['KnownAs'] trailer = m['Trailer'] poster = m['Poster'] if 'Poster214x321' in m: poster = m['Poster214x321'] runtime = m['Runtime'] plot = m['PlotVI'] rating = m['ImdbRating'] country = m['Country'] release_date = m['ReleaseDate'] backdrop = m['Backdrop'] banner = m['Banner'] num_episodes = m['Episode'] thumbs = sorted(m['Thumbs'].keys(), key=lambda x: int(x)) for thumb in thumbs: t = unicode.join(u'',[u'Tập', ' ', thumb]) item = xbmcgui.ListItem(t) item.setInfo(type="Video", infoLabels={"Label": name, "Title": t, "Plot": plot, 'Year': release_date}) epThumb = m['Thumbs'][thumb] item.setArt({'poster': epThumb, 'thumb': epThumb}) item.setProperty("Fanart_Image", backdrop) u = self.__build_url__({'action': 'play_movie', 'movie_id': _id, 'episode': thumb}) xbmcplugin.addDirectoryItem(handle=int(sys.argv[1]),url=u,listitem=item,isFolder=False) xbmcplugin.endOfDirectory(int(sys.argv[1]), cacheToDisc=True)
def YEARB(murl): link=main.OPENURL(murl) link=link.replace('\r','').replace('\n','').replace('\t','').replace(' ','') match=re.compile('<div class="movie_pic"><a href="(.+?)" target=".+?"> <img src="(.+?)" width=".+?" height=".+?" /> </a></div> <div class=".+?"> <div class=".+?"> <h1><a href=".+?" target=".+?"> (.+?) </a></h1> <div class=".+?">Genre: <a href=".+?" target=\'.+?\'>(.+?)</a>.+?Release:.+?Views: <span> (.+?) </span>.+?<span id=RateCount.+?> (.+?) </span> votes.+?<div id=".+?">score:<span id=Rate_.+?>(.+?)</span>').findall(link) dialogWait = xbmcgui.DialogProgress() ret = dialogWait.create('Please wait until Movie list is cached.') totalLinks = len(match) loadedLinks = 0 remaining_display = 'Movies loaded :: [B]'+str(loadedLinks)+' / '+str(totalLinks)+'[/B].' dialogWait.update(0, '[B]Will load instantly from now on[/B]',remaining_display) for url,thumb,name,genre,views,votes,rating in match: name=name.replace('-','').replace('&','').replace('acute;','') furl= 'http://movie25.com/'+url main.addInfo(name+'[COLOR blue] Views: '+views+'[/COLOR] [COLOR red]Votes: '+votes+'[/COLOR] [COLOR green]Rating: '+rating+'[/COLOR]',furl,3,thumb,genre,'') loadedLinks = loadedLinks + 1 percent = (loadedLinks * 100)/totalLinks remaining_display = 'Movies 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 ye = murl[39:44] r = re.findall("Next</a><a href='search.php.?page=.+?year=.+?'>Last</a>",link) if r: main.addDir('[COLOR red]Enter Page #[/COLOR]',murl,208,art+'/gotopage.png') main.addDir('[COLOR blue]Page 2[/COLOR]','http://www.movie25.com/search.php?page=2&year='+str(ye),9,art+'/next2.png') xbmcplugin.setContent(int(sys.argv[1]), 'Movies') main.VIEWS()
def ATLES(): r = requests.get('https://voila.metabroadcast.com/1.0/schedules/?annotations=broadcasts,images,description&apiKey=public:64a03c33f9a64c2b80b6f58cd218e5c8&from=now&count=1&id=hmfk,hmfj,hmfh,hmfg,hmff,hmfd,hmfc,hmfb,hm7x,hmb5,hmb4,hkzf,hn46,hn45,hm7h,hn4f,hn4d,hn4b,hmd6,hn4m,hn4k,hn4h,hn4v,hn4w,hn4r,hn4z,hn4x,hn4y,hmv9,hkzr,hk78,hk79,hk76,hkqs,hk72,hmbs,hmbr,hmbq,hmbv,hmbt,hm74,hmbx,hmbc,hmbg,hmbf,hkz5,hkz4,hkz7,hkz6,hmbn,hkz2,hk7n,hk7m,hk7j,hk7k,hk7h,hk7f,hk7g,hk7d,hk7b,hk7c,hk7z,hk7x,hk7y,hk7v,hk7w,hk7t,hk7r,hk7s,hk7p,hk7q,hkzm,hmb2,hkzn,hmb7,hkzh,hkzk,hkzj,hkzd,hkzg,hmb8,hn88,hkzc,hkzb,hkzy,hkzx,hkzz,hkzt,hkzw,hkzv,hkzq,hkzp,hkzs,hm7c,hkwn,hkwm,hkwj,hkwk,hkwh,hkwb,hpb8,hkwz,hkwx,hkwy,hpb2,hn86,hn87,hkwp,hn85,hmwz,hpb6,hkws,hk94,hk95,hk96,hn84,hk92,hpb5,hk99,hpbj,hn8n,hn8b,hpbc,hn8g,hpbz,hpby,hkw9,hkw6,hkw7,hn8p,hkw5,hn8t,hk9d,hk9f,hk9g,hk9b,hk9c,hk9m,hk9n,hk9h,hk9k,hk9t,hk9v,hk9w,hk9p,hk9r,hk9s,hk9x,hk9y,hk9z,hk2d,hk2g,hk2f,hnxn,hk2c,hk2b,hk2m,hnxc,hk2n,hk2h,hk2k,hk2j,hk2t,hk2w,hk2v,hk2q,hk2p,hk2s,hk2r,hnxp,hnxq,hk2y,hk2x,hnxt,hk2z,hkyd,hkyf,hkyg,hkyb,hkyc,hkym,hkyn,hkyh,hkyj,hkyk,hkyt,hkyv,hkyw,hkyp,hkyq,hkyr,hkys,hkyx,hkyy,hkyz,hk25,hk24,hk27,hk26,hk22,hk29,hnx7,hnx4,hmvz,hky4,hky5,hky6,hky7,hky2,hky8,hky9,hkq7,hn5h,hmsm,hn5q,hkq2,hmsy,hn8c,hpbg,hn8z,hn8y,hk6h,hk6k,hk6j,hk6m,hk6n,hk6c,hk6b,hk6d,hk6g,hk6f,hk6y,hk6x,hk6z,hk6q,hk6p,hk6s,hk6r,hk6t,hk6w,hk6v,hn24,hm6z,hm6y,hm6w,hm6t,hn28,hn29,hpbt,hm6h,hm6d,hkrd,hkrg,hkrf,hkrc,hkrb,hkrm,hkrn,hkrh,hkrj,hk69,hk68,hkrv,hkrq,hkrs,hkrr,hk62,hk65,hk64,hk67,hk66,hn2v,hn2q,hn2r,hn2s,hn2x,hm62,hn2d,hn2c,hmzv,hn9t,hn9w,hn9p,hn9y,hn9z,hn9g,hpcf,hn9c,hn9b,hpcm,hn9n,hn9h,hpck,hpcj,hmhb,hk8m,hk8k,hk8j,hk8h,hk8w,hk8v,hk8t,hk8s,hk8r,hk8q,hk8p,hk8z,hk8y,hk8x,hn95,hn94,hn97,hn96,hn92,hk28,hn98,hkrt,hk87,hk86,hk85,hk84,hk82,hk89,hk88,hm2p,hm2w,hm2y,hkv7,hn68,hkqx,hkqy,hkqz,hkqt,hkry,hn64,hkrx,hnxb,hkqk,hkrz,hkvh,hkvk,hkvj,hkvm,hkvn,hkvc,hkvb,hkvd,hkvg,hkvf,hm22,hmcs,hm27,hkvp,hn6x,hn6y,hkq8,hkq9,hmvy,hkq4,hn6r,hn6s,hn6t,hn6v,hn6h,hnws,hn6k,hn6b,hmvc,hn6g,hny5,hny4,hny7,hny2,hmd8,hny9,hn2y,hk52,hk54,hk55,hk56,hk57,hk58,hk59,hmdt,hmdw,hmdv,hmdy,hmdx,hmdz,hkx7,hkx6,hkx5,hkx4,hkx2,hkx9,hkx8,hnyt,hk5b,hk5c,hk5d,hk5f,hk5g,hk5h,hk5j,hk5k,hk5m,hk5n,hnyz,hk5p,hk5q,hk5r,hnyf,hk5t,hk5v,hk5w,hk5x,hk5y,hk5z,hnyj,hmd5,hkxf,hmd7,hkxd,hkxc,hkxb,hmd2,hkxk,hkxj,hkxh,hkxw,hkxv,hk5s,hkxs,hkxr,hkxq,hkxp,hkxz,hkxy,hkxx,hmyz,hmyn,hmyj,hmyk,hmd4,hpcy,hmrp,hkw4,hn9f,hnzm,hnzn,hnzd,hmd9,hnzf,hkt4,hnzc,hn9m,hnzx,hnzz,hm56,hm54,hm55,hkxt,hn9k,hnz8,hkq6,hnz5,hnz6,hnz7,hnz2,hnx9,hm5c,hn7y,hn7q,hn7t,hn7k,hn7c,hn7d,hpdp,hpdr,hpdw,hpdb,hpdc,hpdd,hpdf,hpdm,hk4c,hk4b,hk4g,hk4f,hk4d,hk4k,hk4j,hk4h,hk4n,hk4m,hk4s,hk4r,hk4q,hk4p,hk4w,hk4v,hk4t,hk4z,hk4y,hk4x,hpc8,hk42,hk47,hk46,hk45,hk44,hk49,hk48,hm77,hmqf,hmqt,hnxg,hnw9,hmc5,hmc6,hnw7,hnw6,hnw5,hnw4,hkz9,hkz8,hnwz,hnwy,hnwx,hmcv,hmcx,hmcy,hmcz,hmpy,hmcb,hmcf,hmcg,hmcj,hmck,hmcm,hmcn,hm4h,hkt7,hm4r,hkt9,hkt8,hm4z,hnbd,hktk,hktj,hkth,hnbh,hktn,hktm,hnxy,hktr,hktq,hktp,hktw,hktv,hktz,hkty,hmxb') match=re.compile('image":"(.+?)".+?parent":{"title":"(.+?)","id":".+?"},"start_date":".+?","id":"(.+?)".+?content":\[{"id":".+?","type":"(.+?)","title":"(.+?)","description":"(.+?)","image":"(.+?)"').findall(r.content) for channel,name,ids,types,title,description,image in match: addDir3('%s - [COLOR yellow] Now: - %s[/COLOR]'%(name,title),ids,15,channel,image,'[COLOR yellow]%s[/COLOR] - %s'%(types,description)) xbmcplugin.setContent(int(sys.argv[1]), 'movies') xbmc.executebuiltin("Container.SetViewMode(515)")
def __init__(self): self._parse_argv() self.tokens = {} sortLetterList = list() # 0 if false, 1 if true hasParentItem = xbmc.getCondVisibility('System.GetBool(filelists.showparentdiritems)') ignoreArticles = xbmc.getCondVisibility('System.GetBool(filelists.ignorethewhensorting)') wid = xbmcgui.getCurrentWindowId() currentWindow = xbmcgui.Window(wid) # get sort tokens from advancedsettings.xml f = xbmcvfs.File(xbmc.translatePath('special://userdata/advancedsettings.xml')) advancedsettings = f.read() f.close() if advancedsettings: root = ET.fromstring(advancedsettings) sorttokens = root.find('sorttokens') # user specified tokens, proceed to create dictionary if sorttokens is not None: self.tokens = { token.text.encode('utf-8') : u'' for token in sorttokens.findall('token') } if self.TYPE == "scroll": xbmcplugin.setResolvedUrl(handle=self.handle, succeeded=False, listitem=xbmcgui.ListItem()) containerId = self._get_view_mode() targetList = currentWindow.getControl(containerId) targetList.selectItem(int(self.pos)) currentWindow.setFocus(targetList) elif self.path: xbmcplugin.setContent(self.handle, 'files') self._parse_files(sortLetterList, hasParentItem, ignoreArticles) xbmcplugin.addDirectoryItems(self.handle, sortLetterList) xbmcplugin.endOfDirectory(handle=self.handle) return
def listViewingActivity(): if not singleProfile: setProfile() xbmcplugin.setContent(pluginhandle, "movies") content = opener.open("https://api-global.netflix.com/desktop/account/viewinghistory").read() content = json.loads(content) count = 0 tvshows = [] for item in content["viewedItems"]: videoID = str(item["movieID"]) title = item["title"].encode('utf-8') if ":" in title: tvshowTitle = title.split(":")[0] if tvshowTitle in tvshows and not showAllEpisodesInVA: continue tvshows.append(tvshowTitle) date = item["dateStr"].encode('utf-8') title = date+" - "+title added = listVideo(videoID, title, "", True, hideMoviesInVA) if added: count += 1 if count == 40: break if forceView: xbmc.executebuiltin('Container.SetViewMode('+viewIdActivity+')') xbmcplugin.endOfDirectory(pluginhandle)
def IPTV3(): try: r = requests.get(ADDON.getSetting('PASTE1')) match=re.compile('#EXTINF:.+?,(.+?)[\n<"].+?http(.+?)[\n#>" ]', re.DOTALL).findall(r.text.replace('\n\n','\n')) for name,url in match: GRAB(name,url) except: pass try: r = requests.get(ADDON.getSetting('PASTE2')) match=re.compile('#EXTINF:.+?,(.+?)[\n<"].+?http(.+?)[\n#>" ]', re.DOTALL).findall(r.text.replace('\n\n','\n')) for name,url in match: GRAB(name,url) except: pass try: r = open(ADDON.getSetting('PASTE1'),'r') match=re.compile('#EXTINF:.+?,(.+?)[\n<"].+?http(.+?)[\n#>" ]', re.DOTALL).findall(r.read()) for name,url in match: GRAB(name,url) except: pass try: r = open(ADDON.getSetting('PASTE2'),'r') match=re.compile('#EXTINF:.+?,(.+?)[\n<"].+?http(.+?)[\n#>" ]', re.DOTALL).findall(r.read()) for name,url in match: GRAB(name,url) except: pass xbmcplugin.setContent(int(sys.argv[1]), 'movies') xbmc.executebuiltin("Container.SetViewMode(515)")
def listVideos(url): if not singleProfile: setProfile() xbmcplugin.setContent(pluginhandle, "movies") content = opener.open(url).read() if not 'id="page-LOGIN"' in content: if singleProfile and 'id="page-ProfilesGate"' in content: forceChooseProfile() else: if '<div id="queue"' in content: content = content[content.find('<div id="queue"'):] content = content.replace("\\t","").replace("\\n", "").replace("\\", "") match1 = re.compile('<span id="dbs(.+?)_.+?alt=".+?" src="(.+?)"', re.DOTALL).findall(content) match2 = re.compile('<span class="title "><a id="b(.+?)_', re.DOTALL).findall(content) if match1: for videoID, thumbUrl in match1: listVideo(videoID, "", thumbUrl, False, False) elif match2: for videoID in match2: listVideo(videoID, "", "", False, False) match = re.compile('&pn=(.+?)&', re.DOTALL).findall(url) if match: currentPage = match[0] nextPage = str(int(currentPage)+1) addDir(translation(30001), url.replace("&pn="+currentPage+"&", "&pn="+nextPage+"&"), 'listVideos', "") if forceView: xbmc.executebuiltin('Container.SetViewMode('+viewIdVideos+')') xbmcplugin.endOfDirectory(pluginhandle) else: deleteCookies() xbmc.executebuiltin('XBMC.Notification(Info:,'+str(translation(30127))+',10000)')
def listEpisodes(seriesID, season): xbmcplugin.setContent(pluginhandle, "episodes") content = getSeriesInfo(seriesID) content = json.loads(content) for test in content["episodes"]: for item in test: episodeSeason = str(item["season"]) if episodeSeason == season: episodeID = str(item["episodeId"]) episodeNr = str(item["episode"]) episodeTitle = item["title"].encode('utf-8') duration = item["runtime"] bookmarkPosition = item["bookmarkPosition"] playcount=0 if (float(bookmarkPosition)/float(duration))>=0.9: playcount=1 desc = item["synopsis"].encode('utf-8') try: thumb = item["stills"][0]["url"] except: thumb = "" addEpisodeDir(episodeTitle, episodeID, 'playVideo', thumb, desc, str(duration), season, episodeNr, seriesID, playcount) if forceView: xbmc.executebuiltin('Container.SetViewMode('+viewIdEpisodes+')') xbmcplugin.endOfDirectory(pluginhandle)
def LISTFMA(murl): link=main.OPENURL(murl) link=link.replace('\r','').replace('\n','').replace('\t','').replace(' ','') match=re.compile('<img class=\'.+?\' src=\'(.+?)\' alt=\'.+?\' />.+?<a class=\'.+?\' href=\'/(.+?)\'>(.+?)</a>.+?<a href=\'/movies/year/.+?\'>(.+?)</a>.+?<a href=\'/movies/genre/.+?\'>(.+?)</a>.+?</span><span class=".+?">(.+?)</span>').findall(link) dialogWait = xbmcgui.DialogProgress() ret = dialogWait.create('Please wait until Movie list is cached.') totalLinks = len(match) loadedLinks = 0 remaining_display = 'Movies loaded :: [B]'+str(loadedLinks)+' / '+str(totalLinks)+'[/B].' dialogWait.update(0,'[B]Will load instantly from now on[/B]',remaining_display) for thumb,url,name, year, gen, desc in match: main.addPlayM(name,'http://www.freemoviesaddict.com/'+url,569,thumb,desc,'','',gen,year) loadedLinks = loadedLinks + 1 percent = (loadedLinks * 100)/totalLinks remaining_display = 'Movies 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 paginate = re.compile('<span class="pagination_next"><a class="pagination_link" href="(.+?)">').findall(link) if len(paginate)>0: main.addDir('Next','http://www.freemoviesaddict.com/'+paginate[0],568,art+'/next2.png') main.GA("FMA","list") xbmcplugin.setContent(int(sys.argv[1]), 'Movies') main.VIEWS()
def r_sub2_genres(url): next_url = url xbmc.log('Next_URL: ' + str(next_url)) r = requests.get(url) print r.cookies kookie1 = r.cookies print ' Kookie1= ' + str(kookie1) print 'Kookie= ' + str(r.cookies)[54:-72] kookie = str(r.cookies)[54:-72] opener = urllib2.build_opener() opener.addheaders.append(('Cookie', kookie)) f = opener.open(url) page = f.read() match = re.compile('href="(.+?)" rel="internal"><img class="radioCover" src="(.+?)" alt="(.+?)" ').findall(page) for url,image,title in match: url = str(url).replace('/en/radio', 'http://listen.radionomy.com').replace('/index', '.m3u') h = HTMLParser.HTMLParser() try: title = h.unescape(title) except UnicodeDecodeError: continue try: add_directory3(title,url,140, defaultfanart ,image,plot='') except KeyError: continue xbmcplugin.setContent(pluginhandle, 'songs') plot = 1 add_directory2('Next Page>>', next_url, 133, defaultfanart, defaultimage, plot) xbmc.executebuiltin("Container.SetViewMode("+str(confluence_views[6])+")") #xbmc.executebuiltin("Container.SetViewMode("+str(confluence_views[0])+")") xbmcplugin.endOfDirectory(addon_handle)
def PlayVideo1(url, listitem): addon_handle = int(sys.argv[1]) xbmcplugin.setContent(addon_handle, 'video') li = xbmcgui.ListItem('[COLOR dodgerblue][B]PLAY STREAM[/B][/COLOR] >> ', iconImage='http://maps.synthicity.com/activemaps/images/button_black_play.png', thumbnailImage= 'http://maps.synthicity.com/activemaps/images/button_black_play.png') li.setProperty('fanart_image', 'https://raw.githubusercontent.com/TheYid/My-Repo/master/repository.TheYid/fanart.jpg') xbmcplugin.addDirectoryItem(handle=addon_handle, url=url, listitem=li) xbmcplugin.endOfDirectory(addon_handle)
def r_next_page(url,plot): next_url = url data = {'scrollOffset':plot} session = Session() session.head('http://www.radionomy.com') response = session.post( url =url, data=data, headers=headers) plot = plot + 1 match = re.compile('href="(.+?)" rel="internal"><img class="radioCover" src="(.+?)" alt="(.+?)" ').findall(str(response.text)) for url,image,title in match: url = str(url).replace('/en/radio', 'http://listen.radionomy.com').replace('/index', '.m3u') h = HTMLParser.HTMLParser() try: title = h.unescape(title) except UnicodeDecodeError: continue image = image.replace('s67.jpg', 's400.jpg') try: add_directory3(title,url,140, defaultfanart ,image,plot='') except KeyError: continue xbmcplugin.setContent(pluginhandle, 'songs') add_directory2('Next Page>>', next_url, 133, defaultfanart, defaultimage, plot) xbmc.executebuiltin("Container.SetViewMode("+str(confluence_views[6])+")") xbmcplugin.endOfDirectory(addon_handle)
def seasons(series_name, series_id, thumb): xbmcplugin.setContent(plugin_handle, 'seasons') seasons = get.seasons_data(series_id) for season in seasons: add.season(season) xbmcplugin.addSortMethod(plugin_handle, xbmcplugin.SORT_METHOD_LABEL) xbmcplugin.endOfDirectory(plugin_handle)
def videos(url, video_type, offset, run_as_widget=False): if '' == offset: page = 0 else: page = int(offset) loading_progress = show_loading_progress(run_as_widget) xbmcplugin.setContent(plugin_handle, 'movies') list_id = None genre_id = None if 'genre' in url: genre_id = url.split('?')[1] elif 'list?' in url: data = url.split('?')[1] if 'mylist' in data: root_list = lolomos.get_root_list() list_id = lolomos.get_mylist(root_list)[0] else: list_id = data video_metadata = None if list_id: video_metadata = get.videos_in_list(list_id, page) elif genre_id: video_metadata = get.videos_in_genre(genre_id, page) if video_metadata: add_videos_to_directory(loading_progress, run_as_widget, video_metadata, video_type, page, url) if generic_utility.get_setting('force_view') == 'true' and not run_as_widget: xbmc.executebuiltin('Container.SetViewMode(' + generic_utility.get_setting('view_id_videos') + ')') xbmcplugin.endOfDirectory(plugin_handle)
def end_call(self,movies=False) : if movies : xbmcplugin.setContent(int(sys.argv[1]),'movies') xbmcplugin.setPluginCategory(handle=int(sys.argv[1]),category=__language__(30000)) xbmcplugin.addSortMethod(handle=int(sys.argv[ 1 ]),sortMethod=xbmcplugin.SORT_METHOD_UNSORTED) xbmcplugin.addSortMethod(handle=int(sys.argv[ 1 ]),sortMethod=xbmcplugin.SORT_METHOD_LABEL) xbmcplugin.addSortMethod(handle=int(sys.argv[ 1 ]),sortMethod=xbmcplugin.SORT_METHOD_DURATION) xbmcplugin.addSortMethod(handle=int(sys.argv[ 1 ]),sortMethod=xbmcplugin.SORT_METHOD_EPISODE) xbmcplugin.addSortMethod(handle=int(sys.argv[ 1 ]),sortMethod=xbmcplugin.SORT_METHOD_FILE) xbmcplugin.addSortMethod(handle=int(sys.argv[ 1 ]),sortMethod=xbmcplugin.SORT_METHOD_GENRE) xbmcplugin.addSortMethod(handle=int(sys.argv[ 1 ]),sortMethod=xbmcplugin.SORT_METHOD_LABEL) xbmcplugin.addSortMethod(handle=int(sys.argv[ 1 ]),sortMethod=xbmcplugin.SORT_METHOD_LABEL_IGNORE_THE) xbmcplugin.addSortMethod(handle=int(sys.argv[ 1 ]),sortMethod=xbmcplugin.SORT_METHOD_MPAA_RATING) xbmcplugin.addSortMethod(handle=int(sys.argv[ 1 ]),sortMethod=xbmcplugin.SORT_METHOD_NONE) xbmcplugin.addSortMethod(handle=int(sys.argv[ 1 ]),sortMethod=xbmcplugin.SORT_METHOD_PLAYLIST_ORDER) xbmcplugin.addSortMethod(handle=int(sys.argv[ 1 ]),sortMethod=xbmcplugin.SORT_METHOD_PRODUCTIONCODE) xbmcplugin.addSortMethod(handle=int(sys.argv[ 1 ]),sortMethod=xbmcplugin.SORT_METHOD_PROGRAM_COUNT) xbmcplugin.addSortMethod(handle=int(sys.argv[ 1 ]),sortMethod=xbmcplugin.SORT_METHOD_SIZE) xbmcplugin.addSortMethod(handle=int(sys.argv[ 1 ]),sortMethod=xbmcplugin.SORT_METHOD_SONG_RATING) xbmcplugin.addSortMethod(handle=int(sys.argv[ 1 ]),sortMethod=xbmcplugin.SORT_METHOD_STUDIO) xbmcplugin.addSortMethod(handle=int(sys.argv[ 1 ]),sortMethod=xbmcplugin.SORT_METHOD_STUDIO_IGNORE_THE) xbmcplugin.addSortMethod(handle=int(sys.argv[ 1 ]),sortMethod=xbmcplugin.SORT_METHOD_TITLE) xbmcplugin.addSortMethod(handle=int(sys.argv[ 1 ]),sortMethod=xbmcplugin.SORT_METHOD_TITLE_IGNORE_THE) xbmcplugin.addSortMethod(handle=int(sys.argv[ 1 ]),sortMethod=xbmcplugin.SORT_METHOD_TRACKNUM) xbmcplugin.addSortMethod(handle=int(sys.argv[ 1 ]),sortMethod=xbmcplugin.SORT_METHOD_UNSORTED) xbmcplugin.addSortMethod(handle=int(sys.argv[ 1 ]),sortMethod=xbmcplugin.SORT_METHOD_VIDEO_RATING) xbmcplugin.addSortMethod(handle=int(sys.argv[ 1 ]),sortMethod=xbmcplugin.SORT_METHOD_VIDEO_RUNTIME) xbmcplugin.addSortMethod(handle=int(sys.argv[ 1 ]),sortMethod=xbmcplugin.SORT_METHOD_VIDEO_TITLE) xbmcplugin.addSortMethod(handle=int(sys.argv[ 1 ]),sortMethod=xbmcplugin.SORT_METHOD_VIDEO_YEAR) xbmcplugin.endOfDirectory(int(sys.argv[1]))
def videoList(self, videoList): if videoList == None or len(videoList) == 0: return total = len(videoList) for i in videoList: try: name, url, image, date, genre, plot, title, show = i['name'], i['url'], i['image'], i['date'], i['genre'], i['plot'], i['title'], i['show'] try: fanart = i['fanart'] except: fanart = '0' meta = {'name': name, 'title': title, 'studio': show, 'premiered': date, 'genre': genre, 'plot': plot, 'image': image, 'fanart': fanart} sysmeta = urllib.quote_plus(json.dumps(meta)) sysurl = urllib.quote_plus(url) if fanart == '0': fanart = addonFanart if image == '0': image = addonFanart if show == '0': meta.update({'studio': addonName}) if plot == '0': meta.update({'plot': addonDesc}) meta = dict((k,v) for k, v in meta.iteritems() if not v == '0') u = '%s?action=videos_parts&url=%s&meta=%s' % (sys.argv[0], sysurl, sysmeta) cm = [] cm.append((language(30401).encode("utf-8"), 'RunPlugin(%s?action=item_play)' % (sys.argv[0]))) cm.append((language(30403).encode("utf-8"), 'RunPlugin(%s?action=item_queue)' % (sys.argv[0]))) cm.append((language(30404).encode("utf-8"), 'RunPlugin(%s?action=playlist_open)' % (sys.argv[0]))) cm.append((language(30406).encode("utf-8"), 'RunPlugin(%s?action=view_videos)' % (sys.argv[0]))) cm.append((language(30405).encode("utf-8"), 'RunPlugin(%s?action=settings_open)' % (sys.argv[0]))) item = xbmcgui.ListItem(name, iconImage="DefaultVideo.png", thumbnailImage=image) item.setProperty("Fanart_Image", fanart) item.setInfo(type="Video", infoLabels = meta) item.setProperty("Video", "true") item.setProperty("IsPlayable", "true") item.addContextMenuItems(cm, replaceItems=True) xbmcplugin.addDirectoryItem(handle=int(sys.argv[1]),url=u,listitem=item,totalItems=total,isFolder=True) except: pass try: next = videoList[0]['next'] if next == '': raise Exception() name, url, image = language(30361).encode("utf-8"), next, addonNext u = '%s?action=videos&url=%s' % (sys.argv[0], urllib.quote_plus(url)) item = xbmcgui.ListItem(name, iconImage="DefaultFolder.png", thumbnailImage=image) item.setInfo( type="Video", infoLabels={"title": name, "plot": addonDesc}) item.setProperty("Fanart_Image", addonFanart) item.addContextMenuItems([], replaceItems=False) xbmcplugin.addDirectoryItem(handle=int(sys.argv[1]),url=u,listitem=item,isFolder=True) except: pass xbmcplugin.setContent(int(sys.argv[1]), 'episodes') xbmcplugin.endOfDirectory(int(sys.argv[1]), cacheToDisc=True) for i in range(0, 200): if xbmc.getCondVisibility('Container.Content(episodes)'): return index().container_view('videos', {'skin.confluence' : 504}) xbmc.sleep(100)
def __init__(self): global action params = {} splitparams = sys.argv[2][sys.argv[2].find('?') + 1:].split('&') for param in splitparams: if (len(param) > 0): splitparam = param.split('=') key = splitparam[0] try: value = splitparam[1].encode("utf-8") except: value = splitparam[1] params[key] = value try: action = urllib.unquote_plus(params["action"]) except: action = None try: channel = urllib.unquote_plus(params["channel"]) except: channel = None if action == None: channels().get() elif action == 'dialog': channels().dialog() elif action == 'epg_menu': contextMenu().epg(channel) elif action == 'refresh': index().container_refresh() elif action == 'play': resolver().run(channel) xbmcplugin.setContent(int(sys.argv[1]), 'Episodes') xbmcplugin.setPluginFanart(int(sys.argv[1]), addonFanart) xbmcplugin.endOfDirectory(int(sys.argv[1])) return
import xbmc, xbmcgui, xbmcplugin, xbmcaddon from BeautifulSoup import BeautifulSoup from BeautifulSoup import BeautifulStoneSoup import demjson #import mechanize try: from sqlite3 import dbapi2 as sqlite except: from pysqlite2 import dbapi2 as sqlite pluginhandle = int(sys.argv[1]) xbmcplugin.setContent(pluginhandle, 'musicvideos') addon = xbmcaddon.Addon('plugin.video.baeble') pluginpath = addon.getAddonInfo('path') datapath = xbmc.translatePath( 'special://profile/addon_data/plugin.video.baeble/') if not os.path.exists(datapath): os.makedirs(datapath) #cachepath = xbmc.translatePath(addon.getSetting('cache-folder')) VIDEOSSQL = os.path.join(pluginpath, 'videos.sqlite') BASE = 'http://www.baeblemusic.com' fanart = os.path.join(pluginpath, 'fanart.jpg') vicon = os.path.join(pluginpath, 'icon.png')
from resources.lib.common_addon import Addon from resources.lib import gdrive from resources.lib import cloudyvideos addon_id = 'plugin.video.footballhighlightssubreddit' addon = Addon(addon_id, sys.argv) icon = addon.queries.get('icon', '') art = xbmc.translatePath( os.path.join('special://home/addons/' + addon_id + '/resources/art/')) my_addon = xbmcaddon.Addon(addon_id) base_url = sys.argv[0] addon_handle = int(sys.argv[1]) args = urlparse.parse_qs(sys.argv[2][1:]) xbmcplugin.setContent(addon_handle, 'movies') data = None CVRef = 'http://reddit.com/footballhighlights' CVUA = 'Mozilla/5.0 (X11; Ubuntu; Linux i686; rv:36.0) Gecko/20100101 Firefox/36.0' CVHeader = { 'Referer': CVRef, 'User-Agent': CVUA, } __settings__ = xbmcaddon.Addon(id='plugin.video.footballhighlightssubreddit') max_video_quality = __settings__.getSetting('max_video_quality') qual = [360, 480, 720, 1080] max_video_quality = qual[int(max_video_quality)] DASH = __settings__.getSetting('DASH') saved_searches = __settings__.getSetting('saved_searches_1') + ','\
'https://www.svoboda.org/z/959':xt(os.path.join(Pdir, 'media', 'svoboda.jpg')), 'https://www.svoboda.org/music/episodes':xt(os.path.join(Pdir, 'media', 'svoboda.jpg')), 'https://www.golosameriki.com/z/5943':xt(os.path.join(Pdir, 'media', 'voa.jpg')), 'https://www.golosameriki.com/z/5944':xt(os.path.join(Pdir, 'media', 'voa.jpg')), } icons = { 'z/21701':xt(os.path.join(Pdir, 'media', 'listen.jpg')), 'z/21950':xt(os.path.join(Pdir, 'media', 'kgb.jpg')), 'svoboda':xt(os.path.join(Pdir, 'media', 'svoboda.png')), 'z/5943':xt(os.path.join(Pdir, 'media', 'president.jpg')), 'z/5944':xt(os.path.join(Pdir, 'media', 'talk.jpg')), 'music/episodes':xt(os.path.join(Pdir, 'media', 'music.jpg')), } xbmcplugin.setContent(handle, 'videos') def get_html(url, params={}, noerror=True): headers = {'User-Agent':'Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:47.0) Gecko/20100101 Firefox/47.0'} if params: url = '%s?%s' % (url, urllib.urlencode(params)) req = urllib2.Request(url, headers=headers) conn = urllib2.urlopen(req) html = conn.read() conn.close() return html
import random import urllib import urlparse import sys import os from lib.moonlight import LibGameStream base_url = sys.argv[0] addon_handle = int(sys.argv[1]) args = urlparse.parse_qs(sys.argv[2][1:]) addon = xbmcaddon.Addon() addon_base_path = xbmc.translatePath( addon.getAddonInfo('profile')).decode('utf-8') xbmcplugin.setContent(addon_handle, "files") def build_url(query): return base_url + "?" + urllib.urlencode(query) def index(): gs = LibGameStream(addon.getAddonInfo("path") + "/lib") address = addon.getSetting("MOON_SERVER_IP") if address == "0.0.0.0": address = gs.discover_server() if not gs.connect_server(address, os.path.join(addon_base_path, "keys")): dialog = xbmcgui.Dialog()
def videos(url, video_type, run_as_widget=False): loading_progress = None if not run_as_widget: loading_progress = xbmcgui.DialogProgress() loading_progress.create('Netflix', utility.get_string(30205) + '...') utility.progress_window(loading_progress, 0, '...') xbmcplugin.setContent(plugin_handle, 'movies') if not xbmcvfs.exists(utility.session_file()): login.login() content = utility.decode(connect.load_site(url)) if not 'id="page-LOGIN"' in content: if utility.get_setting( 'single_profile' ) == 'true' and 'id="page-ProfilesGate"' in content: profiles.force_choose() else: if '<div id="queue"' in content: content = content[content.find('<div id="queue"'):] content = utility.clean_content(content) match = None if not match: match = re.compile('"\$type":"leaf",.*?"id":([0-9]+)', re.DOTALL).findall(content) print '1: ' + str(match) if not match: match = re.compile('<a href="\/watch\/([0-9]+)', re.DOTALL).findall(content) print '2: ' + str(match) if not match: match = re.compile('<span id="dbs(.+?)_.+?alt=".+?"', re.DOTALL).findall(content) print '3: ' + str(match) if not match: match = re.compile('<span class="title.*?"><a id="b(.+?)_', re.DOTALL).findall(content) print '4: ' + str(match) if not match: match = re.compile('"boxart":".+?","titleId":(.+?),', re.DOTALL).findall(content) print '5: ' + str(match) if not match: match = re.compile('WiPlayer\?movieid=([0-9]+?)&', re.DOTALL).findall(content) print '6: ' + str(match) print len(match) i = 1 for video_id in match: if int(video_id) > 10000000: if not run_as_widget: utility.progress_window(loading_progress, i * 100 / len(match), '...') video(video_id, '', '', False, False, video_type, url) i += 1 match1 = re.compile('&pn=(.+?)&', re.DOTALL).findall(url) match2 = re.compile('&from=(.+?)&', re.DOTALL).findall(url) match_api_root = re.compile('"API_ROOT":"(.+?)"', re.DOTALL).findall(content) match_api_base = re.compile('"API_BASE_URL":"(.+?)"', re.DOTALL).findall(content) match_identifier = re.compile('"BUILD_IDENTIFIER":"(.+?)"', re.DOTALL).findall(content) if 'agid=' in url and match_api_root and match_api_base and match_identifier: genre_id = url[url.find('agid=') + 5:] add.directory( utility.get_string(30110), match_api_root[0] + match_api_base[0] + '/' + match_identifier[0] + '/wigenre?genreId=' + genre_id + '&full=false&from=51&to=100&_retry=0', 'list_videos', '', video_type) elif match1: current_page = match1[0] next_page = str(int(current_page) + 1) add.directory( utility.get_string(30110), url.replace('&pn=' + current_page + '&', '&pn=' + next_page + '&'), 'list_videos', '', video_type) elif match2: current_from = match2[0] next_from = str(int(current_from) + 50) current_to = str(int(current_from) + 49) next_to = str(int(current_from) + 99) add.directory( utility.get_string(30110), url.replace('&from=' + current_from + '&', '&from=' + next_from + '&').replace( '&to=' + current_to + '&', '&to=' + next_to + '&'), 'list_videos', '', video_type) if utility.get_setting( 'force_view') == 'true' and not run_as_widget: xbmc.executebuiltin('Container.SetViewMode(' + utility.get_setting('view_id_videos') + ')') xbmcplugin.endOfDirectory(plugin_handle) else: delete.cookies() utility.log('User is not logged in.', loglevel=xbmc.LOGERROR) utility.notification(utility.get_string(30303))
def related(params): xbmcplugin.setContent(int(sys.argv[1]), 'tvshows') oo = shikicore_animes_related(params['id']) return [anime_catalog(o['anime']) for o in oo if o.get('anime')]
def similar(params): xbmcplugin.setContent(int(sys.argv[1]), 'tvshows') oo = shikicore_animes_similar(params['id']) return [anime_catalog(o) for o in oo]
import urllib, urllib2, re, xbmcplugin, xbmcgui, urlresolver, sys, xbmc, xbmcaddon, os, urlparse
import urllib import xbmc,xbmcplugin,xbmcgui,xbmcaddon import sys import api # GLOBAL VARS PLUGIN_ID = 'plugin.video.hieuhien.vn.hdonline' BASE_URL = 'http://api.hdonline.vn' CACHE_PATH = xbmc.translatePath("special://temp") # SETTINGS settings = xbmcaddon.Addon(id=PLUGIN_ID) xbmcplugin.setContent(int(sys.argv[1]), 'movies') action = None class main: def __init__(self): global action self.ua = '|User-Agent=iPad' params = {} splitparams = sys.argv[2][sys.argv[2].find('?') + 1:].split('&') for param in splitparams: if (len(param) > 0): splitparam = param.split('=') key = splitparam[0] try: value = splitparam[1].encode("utf-8")
try: mode = int(params["mode"]) except: pass try: name = urllib.unquote_plus(params["name"]) except: pass try: iconimage = urllib.unquote_plus(params["iconimage"]) except: pass try: description = urllib.unquote_plus(params["description"]) except: pass if mode == None or url == None or len(url) < 1: #print "------------- Categories: -----------------" GetSeriesList() elif mode == 1: #print "------------- Episodes: -----------------" GetEpisodesList(url, iconimage) elif mode == 2: #print "------------- Playing episode -----------------" Play(name, url, iconimage, description) xbmcplugin.setContent(handle, 'episodes') xbmc.executebuiltin("Container.SetViewMode(504)") xbmcplugin.endOfDirectory(handle)
def run(url_suffix=""): if not os.path.exists(os.path.join(ADDON_PATH, ".firstrun")): notify(getLocalizedString(30101)) system_information() return donatePath = os.path.join(ADDON_PATH, ".donate") if not os.path.exists(donatePath): with open(donatePath, "w"): os.utime(donatePath, None) dialog = xbmcgui.Dialog() dialog.ok("Quasar", getLocalizedString(30141)) socket.setdefaulttimeout(int(ADDON.getSetting("buffer_timeout"))) urllib2.install_opener(urllib2.build_opener(NoRedirectHandler())) # Pause currently playing Quasar file to avoid doubling requests if xbmc.Player().isPlaying() and ADDON_ID in xbmc.Player().getPlayingFile( ): xbmc.Player().pause() url = sys.argv[0].replace("plugin://%s" % ADDON_ID, QUASARD_HOST + url_suffix) + sys.argv[2] log.debug("Requesting %s from %s" % (url, repr(sys.argv))) try: data = _json(url) except urllib2.URLError as e: if 'Connection refused' in e.reason: notify(getLocalizedString(30116), time=7000) else: import traceback map(log.error, traceback.format_exc().split("\n")) notify(e.reason, time=7000) return except Exception as e: import traceback map(log.error, traceback.format_exc().split("\n")) try: msg = unicode(e) except: try: msg = str(e) except: msg = repr(e) notify(getLocalizedLabel(msg), time=7000) return if not data: return if data["content_type"]: content_type = data["content_type"] if data["content_type"].startswith("menus"): content_type = data["content_type"].split("_")[1] xbmcplugin.addSortMethod(HANDLE, xbmcplugin.SORT_METHOD_UNSORTED) if content_type != "tvshows": xbmcplugin.addSortMethod(HANDLE, xbmcplugin.SORT_METHOD_LABEL_IGNORE_THE) xbmcplugin.addSortMethod(HANDLE, xbmcplugin.SORT_METHOD_DATE) xbmcplugin.addSortMethod(HANDLE, xbmcplugin.SORT_METHOD_GENRE) xbmcplugin.setContent(HANDLE, content_type) listitems = range(len(data["items"])) for i, item in enumerate(data["items"]): # Translate labels if item["label"][0:8] == "LOCALIZE": item["label"] = unicode(getLocalizedLabel(item["label"]), 'utf-8') if item["label2"][0:8] == "LOCALIZE": item["label2"] = getLocalizedLabel(item["label2"]) listItem = xbmcgui.ListItem(label=item["label"], label2=item["label2"], iconImage=item["icon"], thumbnailImage=item["thumbnail"]) if item.get("info"): listItem.setInfo("video", item["info"]) if item.get("stream_info"): for type_, values in item["stream_info"].items(): listItem.addStreamInfo(type_, values) if item.get("art"): listItem.setArt(item["art"]) elif ADDON.getSetting( 'default_fanart') == 'true' and item["label"] != unicode( getLocalizedString(30218), 'utf-8'): fanart = os.path.join(ADDON_PATH, "fanart.jpg") listItem.setArt({'fanart': fanart}) if item.get("context_menu"): # Translate context menus for m, menu in enumerate(item["context_menu"]): if menu[0][0:8] == "LOCALIZE": menu[0] = getLocalizedLabel(menu[0]) listItem.addContextMenuItems(item["context_menu"]) listItem.setProperty("isPlayable", item["is_playable"] and "true" or "false") if item.get("properties"): for k, v in item["properties"].items(): listItem.setProperty(k, v) listitems[i] = (item["path"], listItem, not item["is_playable"]) xbmcplugin.addDirectoryItems(HANDLE, listitems, totalItems=len(listitems)) # Set ViewMode if data["content_type"]: viewMode = ADDON.getSetting("viewmode_%s" % data["content_type"]) if viewMode: try: xbmc.executebuiltin('Container.SetViewMode(%s)' % viewMode) except Exception as e: log.warning("Unable to SetViewMode(%s): %s" % (viewMode, repr(e))) xbmcplugin.endOfDirectory(HANDLE, succeeded=True, updateListing=False, cacheToDisc=True)
def setView(content, viewType): # set content type so library shows more views and info if content: xbmcplugin.setContent(int(sys.argv[1]), content) if ADDON.getSetting('auto-view')=='true': xbmc.executebuiltin("Container.SetViewMode(%s)" % ADDON.getSetting(viewType) )
def run(): url = urllib.parse.urlparse(sys.argv[0]) path = url.path handle = int(sys.argv[1]) args = urllib.parse.parse_qs(sys.argv[2][1:]) xbmcplugin.setContent(handle, "songs") if path == PATH_ROOT: action = args.get("action", None) if action is None: items = listItems.root() xbmcplugin.addDirectoryItems(handle, items, len(items)) xbmcplugin.endOfDirectory(handle) elif "call" in action: collection = listItems.from_collection( api.call(args.get("call")[0])) xbmcplugin.addDirectoryItems(handle, collection, len(collection)) xbmcplugin.endOfDirectory(handle) elif "settings" in action: addon.openSettings() else: xbmc.log("Invalid root action", xbmc.LOGERROR) elif path == PATH_CHARTS: action = args.get("action", [None])[0] genre = args.get("genre", ["soundcloud:genres:all-music"])[0] if action is None: items = listItems.charts() xbmcplugin.addDirectoryItems(handle, items, len(items)) xbmcplugin.endOfDirectory(handle) else: api_result = api.charts({ "kind": action, "genre": genre, "limit": 50 }) collection = listItems.from_collection(api_result) xbmcplugin.addDirectoryItems(handle, collection, len(collection)) xbmcplugin.endOfDirectory(handle) elif path == PATH_DISCOVER: selection = args.get("selection", [None])[0] collection = listItems.from_collection(api.discover(selection)) xbmcplugin.addDirectoryItems(handle, collection, len(collection)) xbmcplugin.endOfDirectory(handle) elif path == PATH_PLAY: # Public params track_id = args.get("track_id", [None])[0] playlist_id = args.get("playlist_id", [None])[0] url = args.get("url", [None])[0] # Public legacy params (@deprecated) audio_id_legacy = args.get("audio_id", [None])[0] track_id = audio_id_legacy if audio_id_legacy else track_id # Private params media_url = args.get("media_url", [None])[0] if media_url: resolved_url = api.resolve_media_url(media_url) item = xbmcgui.ListItem(path=resolved_url) xbmcplugin.setResolvedUrl(handle, succeeded=True, listitem=item) elif track_id: collection = listItems.from_collection(api.resolve_id(track_id)) playlist = xbmc.PlayList(xbmc.PLAYLIST_MUSIC) resolve_list_item(handle, collection[0][1]) playlist.add(url=collection[0][0], listitem=collection[0][1]) elif playlist_id: call = "/playlists/{id}".format(id=playlist_id) collection = listItems.from_collection(api.call(call)) playlist = xbmc.PlayList(xbmc.PLAYLIST_MUSIC) for item in collection: resolve_list_item(handle, item[1]) playlist.add(url=item[0], listitem=item[1]) elif url: collection = listItems.from_collection(api.resolve_url(url)) playlist = xbmc.PlayList(xbmc.PLAYLIST_MUSIC) for item in collection: resolve_list_item(handle, item[1]) playlist.add(url=item[0], listitem=item[1]) else: xbmc.log("Invalid play param", xbmc.LOGERROR) elif path == PATH_SEARCH: action = args.get("action", None) query = args.get("query", [""])[0] if query: if action is None: search(handle, query) elif "people" in action: xbmcplugin.setContent(handle, "artists") collection = listItems.from_collection( api.search(query, "users"), addon_profile_path) xbmcplugin.addDirectoryItems(handle, collection, len(collection)) xbmcplugin.endOfDirectory(handle) elif "albums" in action: xbmcplugin.setContent(handle, "albums") collection = listItems.from_collection( api.search(query, "albums")) xbmcplugin.addDirectoryItems(handle, collection, len(collection)) xbmcplugin.endOfDirectory(handle) elif "playlists" in action: xbmcplugin.setContent(handle, "albums") collection = listItems.from_collection( api.search(query, "playlists_without_albums")) xbmcplugin.addDirectoryItems(handle, collection, len(collection)) xbmcplugin.endOfDirectory(handle) else: xbmc.log("Invalid search action", xbmc.LOGERROR) else: if action is None: items = listItems.search() xbmcplugin.addDirectoryItems(handle, items, len(items)) xbmcplugin.endOfDirectory(handle) elif "new" in action: query = xbmcgui.Dialog().input(addon.getLocalizedString(30101)) search_history.add(query) search(handle, query) else: xbmc.log("Invalid search action", xbmc.LOGERROR) elif path == PATH_FAVOURITES: action = args.get("action", None) favUsers = myFavourites.get("user") favTracks = myFavourites.get("track") items = [] if (favUsers is None) and (favTracks is None): li = xbmcgui.ListItem(label="empty") url = addon_base + PATH_FAVOURITES xbmcplugin.addDirectoryItem(handle, url, li) xbmcplugin.endOfDirectory(handle) if action is None: if favUsers is not None: li = xbmcgui.ListItem(label="Users") url = addon_base + PATH_FAVOURITES + "?action=users" xbmcplugin.addDirectoryItem(handle, url, li, True) if favTracks is not None: li = xbmcgui.ListItem(label="Tracks") url = addon_base + PATH_FAVOURITES + "?action=tracks" xbmcplugin.addDirectoryItem(handle, url, li, True) xbmcplugin.endOfDirectory(handle) elif "users" in action: for k in favUsers: li = xbmcgui.ListItem(label=k.get("name")) url = addon_base + PATH_USER + "?" + urllib.parse.urlencode( { "id": k.get("id"), "call": "/users/{id}/tracks".format(id=k.get("id")) }) li.addContextMenuItems([ ("Remove from My Favourites", "RunScript({0}/resources/manageFav.py,{1},{2},{3}:{4})". format( xbmc.translatePath( "special://home/addons/plugin.audio.soundcloud"), addon_profile_path, "remove:user", k.get("name"), k.get("id"))) ]) items.append((url, li, True)) xbmcplugin.addDirectoryItems(handle, items, len(items)) xbmcplugin.endOfDirectory(handle) elif "tracks" in action: for k in favTracks: # not so elegant but makes it playable collection = listItems.from_collection( api.resolve_id(k.get("id"))) collection[0][1].addContextMenuItems([ ("Remove from My Favourites", "RunScript({0}/resources/manageFav.py,{1},{2},{3}:{4})". format( xbmc.translatePath( "special://home/addons/plugin.audio.soundcloud"), addon_profile_path, "remove:track", k.get("name"), k.get("id"))) ]) items.append(collection[0]) xbmcplugin.addDirectoryItems(handle, items, len(items)) xbmcplugin.endOfDirectory(handle) # Legacy search query used by Chorus2 (@deprecated) elif path == PATH_SEARCH_LEGACY: query = args.get("q", [""])[0] collection = listItems.from_collection(api.search(query)) xbmcplugin.addDirectoryItems(handle, collection, len(collection)) xbmcplugin.endOfDirectory(handle) elif path == PATH_USER: user_id = args.get("id")[0] default_action = args.get("call")[0] if user_id: items = listItems.user(user_id) collection = listItems.from_collection(api.call(default_action), addon_profile_path) xbmcplugin.addDirectoryItems(handle, items, len(items)) xbmcplugin.addDirectoryItems(handle, collection, len(collection)) xbmcplugin.endOfDirectory(handle) else: xbmc.log("Invalid user action", xbmc.LOGERROR) elif path == PATH_SETTINGS_CACHE_CLEAR: vfs_cache.destroy() dialog = xbmcgui.Dialog() dialog.ok("SoundCloud", addon.getLocalizedString(30501)) else: xbmc.log("Path not found", xbmc.LOGERROR)
def setView(content, viewType): if content: xbmcplugin.setContent(int(sys.argv[1]), content) if selfAddon.getSetting('auto-view')=='true': xbmc.executebuiltin("Container.SetViewMode(%s)" % selfAddon.getSetting(viewType) )
def listSeasonsFromserial(self, serial_url): modulUrl = "" clean_title = "<No Title>" movieMetadata = False movieMetadataURL = -1 movieID = -1 url = apiBase + "/page" + serial_url r = requests.get(url) data = r.json() serial_url = "" if "title" in data: clean_title = data['title'].replace( "im Online Stream ansehen | TVNOW", "") xbmcplugin.setPluginCategory(addon_handle, clean_title) for module in data["modules"]: if module["moduleLayout"] == "default": movieID = module["id"] if module["moduleLayout"] == "format_season_navigation": modulUrl = module["moduleUrl"] elif module["moduleLayout"] == "format_episode": serial_url = module["moduleUrl"] if module["moduleLayout"] == "moviemetadata": movieMetadata = True movieMetadataURL = module["moduleUrl"] if "id" in data: serial_id = data["id"] if modulUrl != "" and serial_url != "": xbmcplugin.setContent(addon_handle, 'seasons') url = apiBase + modulUrl r = requests.get(url) nav_data = r.json() for items in nav_data["items"]: if "months" in items and "year" in items: for month in reversed(items["months"]): url = common.build_url({ 'action': 'listSeasonByYear', 'year': int(items['year']), 'month': month["month"], 'id': serial_url.encode('utf-8') }) label = '%s - %s - %s' % ( clean_title, month["name"], items['year']) li = xbmcgui.ListItem(label=label) li.setProperty('IsPlayable', 'false') li.setArt({ 'poster': formatImageURL.replace("{fid}", str(serial_id)) }) xbmcplugin.addDirectoryItem(handle=addon_handle, url=url, listitem=li, isFolder=True) elif "season" in items: url = common.build_url({ 'action': 'listSeason'.encode('utf-8'), 'season_id': int(items["season"]), 'id': serial_url.encode('utf-8') }) label = '%s - Staffel %s' % (clean_title, items["season"]) li = xbmcgui.ListItem(label=label) li.setProperty('IsPlayable', 'false') li.setArt({ 'poster': formatImageURL.replace("{fid}", str(serial_id)) }) xbmcplugin.addDirectoryItem(handle=addon_handle, url=url, listitem=li, isFolder=True) elif movieMetadata != -1 and movieID != -1: if "title" in data: title_stripped = data['title'].replace( "im Online Stream | TVNOW", "") else: title_stripped = "<No Title>" if movieMetadata: url = apiBase + movieMetadataURL r = requests.get(url) if r.status_code == 200: data = r.json() if not "headline" in data: data["headline"] = title_stripped else: if "configuration" in data and "isPremium" in data[ "configuration"]: data["isPremium"] = data["configuration"]["isPremium"] else: #Fallback data["isPremium"] = False xbmcplugin.setPluginCategory(addon_handle, title_stripped) xbmcplugin.setContent(addon_handle, 'episodes') if self.showPremium or not "isPremium" in data or data[ "isPremium"] == False: url = common.build_url({ 'action': 'playVod', 'vod_url': movieID }) li = xbmcgui.ListItem() li.setProperty('IsPlayable', 'true') li.setLabel('%s' % (title_stripped)) info = self.getInfoLabel(data, True) li.setInfo('video', info) li.setArt({ 'poster': formatImageURL.replace("{fid}", str(serial_id)) }) xbmcplugin.addDirectoryItem(handle=addon_handle, url=url, listitem=li, isFolder=False) xbmcplugin.endOfDirectory(addon_handle, cacheToDisc=True)
del bookDB xbmc.executebuiltin("Container.Refresh") ################################ # Main of the eBooks Plugin ################################ if __name__ == '__main__': # Get all the arguments base_url = sys.argv[0] addon_handle = int(sys.argv[1]) args = urlparse.parse_qs(sys.argv[2][1:]) # Record what the plugin deals with, files in our case xbmcplugin.setContent(addon_handle, 'files') # Get the current mode from the arguments, if none set, then use None mode = args.get('mode', None) log("EBooksPlugin: Called with addon_handle = %d" % addon_handle) # If None, then at the root if mode is None: log("EBooksPlugin: Mode is NONE - showing root menu") json_query = xbmc.executeJSONRPC( '{"jsonrpc": "2.0", "method": "Addons.GetAddonDetails", "params": { "addonid": "repository.urepo", "properties": ["enabled", "broken", "name", "author"] }, "id": 1}' ) json_response = json.loads(json_query)
url_web_base = 'https://www.rightnowmedia.org' url_web_login = url_web_base + '/Account/Login' base = 'https://api.rightnow.org/api/media/' url_auth = base + 'authenticate' url_library_all = base + 'library/all' url_library = base + 'library/' # + ['custom/'] + id # use 'custom' for custom libraries only url_content = base + 'content/' # + id url_channel = base + "channel/" # + id url_sessions = base + 'content/series/' # + id url_play = base + '/session/' # + id + '/hls' _url = sys.argv[0] _kodihandle = int(sys.argv[1]) xbmcplugin.setContent(_kodihandle, 'movies') def get_url(**kwargs): """ Create a URL for calling the plugin recursively from the given set of keyword arguments. :param kwargs: "argument=value" pairs :type kwargs: dict :return: plugin call URL :rtype: str """ return '{0}?{1}'.format(_url, urlencode(kwargs)) def list_libraries(): url = get_url(action='search')
def setView(content, viewType): if content: xbmcplugin.setContent(int(sys.argv[1]), content)
icon = os.path.join(addonPath, 'icon.png') pic = os.path.join(addonPath, 'resources', 'media', '').encode('utf-8').decode('utf-8') preferredStreamType = addon.getSetting("streamSelection") showDATE = addon.getSetting("enableDatetitle") == 'true' showTVchannel = addon.getSetting("enableChannelID") == 'true' showNOW = addon.getSetting("enableTVnow") enableDebug = addon.getSetting("enableDebug") == 'true' useThumbAsFanart = addon.getSetting("useThumbAsFanart") == 'true' forceViewMode = addon.getSetting("forceView") == 'true' viewMode = str(addon.getSetting("viewID")) baseURL = "https://www.tvspielfilm.de" dateURL = "/mediathek/nach-datum/" ZDFapiUrl = "https://api.zdf.de" xbmcplugin.setContent(int(sys.argv[1]), 'tvshows') if xbmcvfs.exists(temp) and os.path.isdir(temp): shutil.rmtree(temp, ignore_errors=True) xbmcvfs.mkdirs(temp) cookie = os.path.join(temp, 'cookie.lwp') cj = LWPCookieJar() if xbmcvfs.exists(cookie): cj.load(cookie, ignore_discard=True, ignore_expires=True) def py2_enc(s, encoding='utf-8'): if PY2 and isinstance(s, unicode): s = s.encode(encoding) return s
def do_global_search(text): xbmcplugin.setPluginCategory(HANDLE, 'Search Result') xbmcplugin.setContent(HANDLE, 'movies') if not text: keyboard = xbmc.Keyboard('', 'Search iPlayer') keyboard.doModal() if keyboard.isConfirmed(): text = keyboard.getText() if not text: return helper.search_history_save(text) print("*********************** searching {}".format(text)) progress = { 'percent': 0, 'step': 5, 'counter': 0, 'length': 0, 'dialog': xbmcgui.DialogProgress(), 'results': [] } def _search(site, text, progress): try: plugin, module, classname = get_plugin({'className': [site['className']], "module": [site['plugin']]}) progress['dialog'].update(progress['percent'], 'Searching %d/%d sites' % (progress['counter'], progress['length']), "", "Looking on: %s" % classname) progress['results'].append((module, classname, plugin().search(text))) progress['percent'] += progress['step'] progress['counter'] += 1 progress['dialog'].update(progress['percent'], 'Searching %d/%d sites' % (progress['counter'], progress['length']), "", "Looking on: %s" % classname) except: pass threads = [] for group in SITES: if group['version'] > KODI_VERSION or ('searchable' in group and not group['searchable']): continue for site in group['sites']: progress['length'] += 1 progress['dialog'].create('Processing', "Searching %d/%d sites" % (progress['counter'], progress['length'])) progress['step'] = 100 / progress['length'] for group in SITES: if group['version'] > KODI_VERSION or ('searchable' in group and not group['searchable']): continue for site in group['sites']: if site['version'] > KODI_VERSION or ('searchable' in site and not site['searchable']): continue process = Thread(target=_search, args=[site, text, progress]) process.setDaemon(True) process.start() threads.append(process) for process in threads: process.join() for module, classname, movies in progress['results']: # if movies is not None and len(movies.get('movies')) > 0: label = "[COLOR red][B][---- %s : [COLOR yellow]%d found[/COLOR] View All ----][/B][/COLOR]" % ( classname, len(movies['movies'])) sli = xbmcgui.ListItem(label=label) url = build_url({'mode': 'dosearch', 'module': module, 'className': classname, 'url': text}) xbmcplugin.addDirectoryItem(HANDLE, url, sli, isFolder=True) for item in movies['movies'][:5]: try: list_item = xbmcgui.ListItem(label=item['label']) list_item.setLabel2(item['realtitle']) list_item.setIconImage('DefaultVideo.png') list_item.setArt({ 'thumb': item['thumb'], }) url = build_url( {'mode': 'movie', 'movie_item': json.dumps(item), 'module': module, 'className': classname}) is_folder = True xbmcplugin.addDirectoryItem(HANDLE, url, list_item, is_folder) except: print(item) xbmcplugin.endOfDirectory(HANDLE)
plugin.clearProperty('openmeta_players_setup') return True @plugin.route('/setup/sources') def sources_setup(): movielibraryfolder = plugin.get_setting('movies_library_folder', unicode) tvlibraryfolder = plugin.get_setting('tv_library_folder', unicode) try: lib_movies.auto_movie_setup(movielibraryfolder) lib_tvshows.auto_tvshows_setup(tvlibraryfolder) plugin.notify('OpenMeta sources setup', 'Done', plugin.get_addon_icon(), 3000) except: plugin.notify('OpenMeta sources setup', 'Failed', plugin.get_addon_icon(), 3000) return True if __name__ == '__main__': arg = sys.argv[0] handle = int(sys.argv[1]) if '/movies/' in arg: xbmcplugin.setContent(handle, 'movies') elif '/tv/' in arg: xbmcplugin.setContent(handle, 'tvshows') elif '/lists/show' in arg: xbmcplugin.setContent(handle, 'videos') elif '/tv_episodes_' in arg: xbmcplugin.setContent(handle, 'episodes') elif '/movies_genres' in arg or '/tv_genres' in arg: xbmcplugin.setContent(handle, 'genres') else: xbmcplugin.setContent(handle, 'addons') plugin.run()
def show_listing(title_items, category=None, sort=None, content=None, cache=True): """Show a virtual directory in Kodi""" from resources.lib.addon import routing if content: # content is one of: files, songs, artists, albums, movies, tvshows, episodes, musicvideos, videos, images, games xbmcplugin.setContent(routing.handle, content=content) # Jump through hoops to get a stable breadcrumbs implementation category_label = '' if category: if not content: category_label = addon_name() + ' / ' if isinstance(category, int): category_label += localize(category) else: category_label += category elif not content: category_label = addon_name() xbmcplugin.setPluginCategory(handle=routing.handle, category=category_label) # Add all sort methods to GUI (start with preferred) if sort is None: sort = DEFAULT_SORT_METHODS elif not isinstance(sort, list): sort = [sort] + DEFAULT_SORT_METHODS for key in sort: xbmcplugin.addSortMethod(handle=routing.handle, sortMethod=SORT_METHODS[key]) # Add the listings listing = [] for title_item in title_items: # Three options: # - item is a virtual directory/folder (not playable, path) # - item is a playable file (playable, path) # - item is non-actionable item (not playable, no path) is_folder = bool(not title_item.is_playable and title_item.path) is_playable = bool(title_item.is_playable and title_item.path) list_item = xbmcgui.ListItem(label=title_item.title, path=title_item.path) if title_item.prop_dict: list_item.setProperties(title_item.prop_dict) list_item.setProperty(key='IsPlayable', value='true' if is_playable else 'false') list_item.setIsFolder(is_folder) if title_item.art_dict: list_item.setArt(title_item.art_dict) if title_item.info_dict: # type is one of: video, music, pictures, game list_item.setInfo(type='video', infoLabels=title_item.info_dict) if title_item.stream_dict: # type is one of: video, audio, subtitle list_item.addStreamInfo('video', title_item.stream_dict) if title_item.context_menu: list_item.addContextMenuItems(title_item.context_menu) is_folder = bool(not title_item.is_playable and title_item.path) url = title_item.path if title_item.path else None listing.append((url, list_item, is_folder)) succeeded = xbmcplugin.addDirectoryItems(routing.handle, listing, len(listing)) xbmcplugin.endOfDirectory(routing.handle, succeeded, cacheToDisc=cache)
log('addDir, name = ' + name) liz=xbmcgui.ListItem(name) liz.setProperty('IsPlayable', 'false') if infoList == False: liz.setInfo(type="Video", infoLabels={"mediatype":"video","label":name,"title":name}) else: liz.setInfo(type="Video", infoLabels=infoList) if infoArt == False: liz.setArt({'thumb':ICON,'fanart':FANART}) else: liz.setArt(infoArt) u=sys.argv[0]+"?url="+urllib.quote_plus(u)+"&mode="+str(mode)+"&name="+urllib.quote_plus(name) xbmcplugin.addDirectoryItem(handle=int(sys.argv[1]),url=u,listitem=liz,isFolder=True) params=getParams() try: url=urllib.unquote_plus(params["url"]) except: url=None try: name=urllib.unquote_plus(params["name"]) except: name=None try: mode=int(params["mode"]) except: mode=None log("Mode: "+str(mode)) log("URL : "+str(url)) log("Name: "+str(name)) if mode==None: Disclose().buildMenu() elif mode == 1: Disclose().browse(url) elif mode == 9: Disclose().playVideo(name, url) xbmcplugin.setContent(int(sys.argv[1]) , CONTENT_TYPE) xbmcplugin.addSortMethod(int(sys.argv[1]) , xbmcplugin.SORT_METHOD_UNSORTED) xbmcplugin.addSortMethod(int(sys.argv[1]) , xbmcplugin.SORT_METHOD_NONE) xbmcplugin.addSortMethod(int(sys.argv[1]) , xbmcplugin.SORT_METHOD_LABEL) xbmcplugin.addSortMethod(int(sys.argv[1]) , xbmcplugin.SORT_METHOD_TITLE) xbmcplugin.endOfDirectory(int(sys.argv[1]), cacheToDisc=True)
def list_estreias(url): estreias = open_url(url) section = re.compile('<h2 class="boxtitle first"><span>(.+?)</span></h2>', re.DOTALL).findall(estreias) for s in section: addDir(s,url,6,'',True,1) xbmcplugin.setContent(int(sys.argv[1]), 'movies')
def listarTemporada(params, url, category): logger.info("[series21.py] listvideos") url1 = "http://www.series21.com" if url == "": url = "http://www.series21.com" # Descarga la página data = scrapertools.cachePage(url) #logger.info(data) titulo_serie = urllib.unquote_plus(params.get("title")) if titulo_serie == "Cambiar a otras temporadas": titulo_serie = urllib.unquote_plus(params.get("extradata")) #thumbnail = urllib.unquote_plus(params.get("thumbnail")) #plot = urllib.unquote_plus(params.get("plot")) actor = "" # Busca el area donde estan los videos y la descripcion patronvideos = '<h3>(.*?)</h3>' # Temporada de la Serie patronvideos += '.*?<img.+?src="([^"]+)" width=.*?/>' # Thumbnail de la Serie patronvideos += '.*?<ul(.*?)</ul>' # Capitulos de la Serie matches = re.compile(patronvideos, re.DOTALL).findall(data) patroncapit = '<li><a href="([^"]+)".+?>(.+?)</a>(.+?)</li>' patronplot = '<div style="margin:0px; padding:0px; text-align:justify;">(.*?)</div>' sinopsis = re.compile(patronplot, re.DOTALL).findall(data) plot = "Serie : " + titulo_serie + "\n" # Busca los actores patronactor = '<div id="actores">(.*?)cursor:pointer' matchesactor = re.compile(patronactor, re.DOTALL).findall(data) matchesactores = "" if len(matchesactor) > 0: matchesactores = buscactores(matchesactor[0]) print ' actores: %s' % str(len(matchesactores)) if len(matchesactores) > 0: actor = "Actores: " c = 0 actores = "ACTORES DE ESTA SERIE :\n\n" for match in matchesactores: c = c + 1 actores = actores + "-" + match[1] + "\n" if c == 3 or c == 6: actor = actor + match[1] + "\n" elif c == 4 or c == 7: actor = actor + "* " + match[1] + " , " else: actor = actor + match[1] + " , " # Abre ventana de eleccion de temporadas if len(matches) > 1: opciones = [] opciones.append(" Todas las Temporadas") for match in matches: temporada = re.sub("<[^>]+>", " ", match[0]).replace("-", "").replace(">", "") opciones.append(temporada) dia = xbmcgui.Dialog() seleccion = dia.select("Elige un tipo de Listado", opciones) logger.info("seleccion=%d" % seleccion) else: seleccion = 0 if seleccion == -1: return if seleccion == 0: for match in matches: print 'esta es la %s' % match[0] print 'este es el thumbnail %s ' % match[1] thumbnail = urlparse.urljoin(url1, match[1]) temporada = re.sub("<[^>]+>", " ", match[0]).replace("-", "").replace(">", "") temporada += "\n" + actor + "\n" + "Sinopsis : " + str( sinopsis[0].replace("\n\t\t\t\t\t", "")) matchescapit = re.compile(patroncapit, re.DOTALL).findall(match[2]) for match1 in matchescapit: esp = "" subt = "" url = match1[0] if "esp.gif" in match1[2]: esp = " (Español)" if "Subtitulado" in match1[2]: subt = " (VOS)" titulo = titulo_serie + " - " + match1[1] + esp + subt xbmctools.addnewfolder(__channel__, "ListarVideos", category, titulo, url, thumbnail, plot + temporada, fanart=thumbnail) else: thumbnail = urlparse.urljoin(url1, matches[seleccion - 1][1]) temporada = re.sub("<[^>]+>", " ", matches[seleccion - 1][0]).replace( "-", "").replace(">", "") #logger.info("matches "+matches[seleccion-1][2]) matchescapit = re.compile(patroncapit, re.DOTALL).findall(matches[seleccion - 1][2]) plot += temporada + "\n" plot += actor + "\n" + "Sinopsis : " + str(sinopsis[0].replace( "\n\t\t\t\t\t", "")) if len(matchescapit) > 0: for match1 in matchescapit: url = match1[0] titulo = titulo_serie + " - " + match1[1] xbmctools.addnewfolder(__channel__, "ListarVideos", category, titulo, url, thumbnail, plot) # Busca Series relacionadas con los actores if len(matchesactores) > 0: titulo = "Lista Series relacionadas con los actores" xbmctools.addnewfolderextra(__channel__, "listaractores", category, titulo, url, thumbnail, actores, matchesactor[0], fanart=thumbnail) # Label (top-right)... xbmcplugin.setContent(int(sys.argv[1]), "movies") xbmcplugin.setPluginCategory(handle=pluginhandle, category=category) xbmcplugin.addSortMethod(handle=pluginhandle, sortMethod=xbmcplugin.SORT_METHOD_NONE) xbmcplugin.endOfDirectory(handle=pluginhandle, succeeded=True)
def videoList(self, videoList): if videoList == None or len(videoList) == 0: return total = len(videoList) for i in videoList: try: name, url, image, date, genre, plot, title, show = i[ 'name'], i['url'], i['image'], i['date'], i['genre'], i[ 'plot'], i['title'], i['show'] try: fanart = i['fanart'] except: fanart = '0' meta = { 'name': name, 'title': title, 'studio': show, 'premiered': date, 'genre': genre, 'plot': plot, 'image': image, 'fanart': fanart } sysmeta = urllib.quote_plus(json.dumps(meta)) sysurl = urllib.quote_plus(url) if fanart == '0': fanart = addonFanart if image == '0': image = addonFanart if show == '0': meta.update({'studio': addonName}) if plot == '0': meta.update({'plot': addonDesc}) meta = dict( (k, v) for k, v in meta.iteritems() if not v == '0') u = '%s?action=videos_parts&url=%s&meta=%s' % (sys.argv[0], sysurl, sysmeta) cm = [] cm.append((language(30401).encode("utf-8"), 'RunPlugin(%s?action=item_play)' % (sys.argv[0]))) cm.append((language(30403).encode("utf-8"), 'RunPlugin(%s?action=item_queue)' % (sys.argv[0]))) cm.append( (language(30404).encode("utf-8"), 'RunPlugin(%s?action=playlist_open)' % (sys.argv[0]))) cm.append((language(30406).encode("utf-8"), 'RunPlugin(%s?action=view_videos)' % (sys.argv[0]))) cm.append( (language(30405).encode("utf-8"), 'RunPlugin(%s?action=settings_open)' % (sys.argv[0]))) item = xbmcgui.ListItem(name, iconImage="DefaultVideo.png", thumbnailImage=image) item.setProperty("Fanart_Image", fanart) item.setInfo(type="Video", infoLabels=meta) item.setProperty("Video", "true") item.setProperty("IsPlayable", "true") item.addContextMenuItems(cm, replaceItems=True) xbmcplugin.addDirectoryItem(handle=int(sys.argv[1]), url=u, listitem=item, totalItems=total, isFolder=True) except: pass try: next = videoList[0]['next'] if next == '': raise Exception() name, url, image = language(30361).encode("utf-8"), next, addonNext u = '%s?action=videos&url=%s' % (sys.argv[0], urllib.quote_plus(url)) item = xbmcgui.ListItem(name, iconImage="DefaultFolder.png", thumbnailImage=image) item.setInfo(type="Video", infoLabels={ "title": name, "plot": addonDesc }) item.setProperty("Fanart_Image", addonFanart) item.addContextMenuItems([], replaceItems=False) xbmcplugin.addDirectoryItem(handle=int(sys.argv[1]), url=u, listitem=item, isFolder=True) except: pass xbmcplugin.setContent(int(sys.argv[1]), 'episodes') xbmcplugin.endOfDirectory(int(sys.argv[1]), cacheToDisc=True) for i in range(0, 200): if xbmc.getCondVisibility('Container.Content(episodes)'): return index().container_view('videos', {'skin.confluence': 504}) xbmc.sleep(100)
def list_feed_listings(feed, listing, category=None, series=None, channels=None): xbmcplugin.addSortMethod(handle=__plugin_handle__, sortMethod=xbmcplugin.SORT_METHOD_NONE) d = {} d['list'] = feed.list d['popular'] = feed.popular d['highlights'] = feed.highlights programmes = d[listing]() ## filter by series if series: temp_prog = [] # if a series filter has been specified then only parse programmes # in that series i = len(series) for p in programmes: matchagainst = p.title match = series_match(p.title) if match: matchagainst = match.group(1) #print "matching %s,%s" % (p.title, matchagainst) if series == matchagainst: temp_prog.append(p) programmes = temp_prog programmes = sort_by_attr(programmes, 'episode') # add each programme total = len(programmes) if channels: total = total + len(channels) count = 0 thumbnail_size = get_setting_thumbnail_size() for p in programmes: try: if not add_programme(feed, p, total, count, thumbnail_size, feed.tvradio): total = total - 1 except: traceback.print_exc() total = total - 1 count = count + 1 # normally from an empty search if not programmes: label = "(no programmes available - try again later)" listitem = xbmcgui.ListItem(label=label) ok = xbmcplugin.addDirectoryItem(handle=__plugin_handle__, url="", listitem=listitem) count = count + 1 # add list of channels names - for top level Highlights and Popular if channels: for j, f in enumerate(channels): listitem = xbmcgui.ListItem(label=f.name) listitem.setIconImage('defaultFolder.png') listitem.setThumbnailImage(get_feed_thumbnail(f)) listitem.setProperty('tracknumber', str(count)) count = count + 1 url = make_url(feed=f, listing=listing, tvradio=feed.tvradio, category=category) ok = xbmcplugin.addDirectoryItem( handle=__plugin_handle__, url=url, listitem=listitem, isFolder=True, ) xbmcplugin.setContent(handle=__plugin_handle__, content='episodes') xbmcplugin.endOfDirectory(handle=__plugin_handle__, succeeded=True)
def ListarVideos(params, url, category): url1 = "http://www.series21.com" url1 = urlparse.urljoin(url1, url) title = urllib.unquote_plus(params.get("title")) thumbnail = urllib.unquote_plus(params.get("thumbnail")) plot = urllib.unquote_plus(params.get("plot")) data = scrapertools.cachePage(url1) # Busca el area donde estan los videos y la descripcion patronvideos = '<div id="content">(.*?)<!-- FIN #content-->' matches = re.compile(patronvideos, re.DOTALL).findall(data) matchesBK = matches[0] # Extrae las entradas (videos) para megavideo patronvideos = '<span style="font-size:12px;"><strong>(.*?)</strong></span><br/>.*?' patronvideos += '<span.*?>.*?<a href="http\:\/\/www.megavideo.com\/([\?v=|v/|\?d=]+)([A-Z0-9]{8}).*?" target' matches = re.compile(patronvideos, re.DOTALL).findall(matches[0]) scrapertools.printMatches(matches) encontrados = set() for match in matches: if match[2] not in encontrados: encontrados.add(match[2]) if 'v' in match[1]: server = "Megavideo" else: server = "Megaupload" doblaje = scrapertools.entityunescape(match[0]) # Titulo scrapedtitle = title + " - [" + doblaje + "]" + " (" + server + ")" # URL scrapedurl = match[2] # Thumbnail scrapedthumbnail = thumbnail # Argumento #print 'este es el plot %s ' %plot #print ' doblaje %s ' %doblaje scrapedplot = plot if ("Español" in plot) and not (doblaje in plot): scrapedplot = scrapedplot.replace("Español", doblaje) elif "subtitulado" in plot and not (doblaje in plot): scrapedplot = scrapedplot.replace( "Versión original (subtitulado)", doblaje) elif not doblaje in plot: scrapedplot += "\n" + "Doblaje : " + doblaje # Depuracion if (DEBUG): logger.info("scrapedtitle=" + scrapedtitle) logger.info("scrapedurl=" + scrapedurl) logger.info("scrapedthumbnail=" + scrapedthumbnail) # Añade al listado de XBMC xbmctools.addnewvideo(__channel__, "play", category, server, scrapedtitle, scrapedurl, scrapedthumbnail, scrapedplot) if len(matches) == 0: listavideos = servertools.findvideos(data) encontrados = set() for titulo, scrapedurl, servidor in listavideos: if scrapedurl.strip() not in encontrados: encontrados.add(scrapedurl.strip()) xbmctools.addnewvideo(__channel__, "play", category, servidor, title + " - %s" % titulo, scrapedurl, thumbnail, plot) patronvideos = '<span class="bloque-doblaje">(.+?)</span>[^<]+' patronvideos += '<span class="bloque-link">[^<]+<a href="javascript\:goTo\(\'([^\']+)\'\, \'([^\']+)\'\)"(.+?)</span>' #patronvideos +='(?:\| <a href="javascript\:goTo\(\'([^\']+)\'\, \'([^\']+)\'\)".*?)</span>' matches = re.compile(patronvideos, re.DOTALL).findall(data) scrapertools.printMatches(matches) for match in matches: # URL if "megavideo" in match[2]: server = "Megavideo" elif "megaupload" in match[2]: server = "Megaupload" if "esp.gif" in match[0]: doblaje = "Español" else: doblaje = match[0].strip() base64 = decrypt21.Base64() try: url2 = re.compile( "javascript\:goTo\(\'([^\']+)\'\, \'([^\']+)\'\)").findall( match[3])[0] scrapedurl2 = base64._extract_code(base64.decode(url2[0])) scrapedurl = base64._extract_code(base64.decode(match[1])) part1 = " Parte 1 " part2 = " Parte 2 " scrapedtitle2 = title + part2 + " - [" + doblaje + "]" + " (" + server + ")" #print match[3] except: scrapedurl = base64._extract_code(base64.decode(match[1])) part1 = "" part2 = "" scrapedtitle = title + part1 + " - [" + doblaje + "]" + " (" + server + ")" # Thumbnail scrapedthumbnail = thumbnail # Argumento scrapedplot = plot # Depuracion if (DEBUG): logger.info("scrapedtitle=" + scrapedtitle) logger.info("scrapedurl=" + scrapedurl) logger.info("scrapedthumbnail=" + scrapedthumbnail) # Añade al listado de XBMC xbmctools.addnewvideo(__channel__, "play", category, server, scrapedtitle, scrapedurl, scrapedthumbnail, scrapedplot) if part2: xbmctools.addnewvideo(__channel__, "play", category, server, scrapedtitle2, scrapedurl2, scrapedthumbnail, scrapedplot) # Extrae las entradas (videos) directos patronvideos = 'flashvars="file=([^\&]+)\&controlbar=over' matches = re.compile(patronvideos, re.DOTALL).findall(data) scrapertools.printMatches(matches) if len(matches) > 0: data1 = scrapertools.cachePage(matches[0]) #logger.info(data) patron = 'author">(.*?)</media:credit>.*?<media\:content url="([^"]+)"' matches = re.compile(patron, re.DOTALL).findall(data1) scrapertools.printMatches(matches) for match in matches: # Añade al listado de XBMC xbmctools.addnewvideo( __channel__, "play", category, "Directo", title + " - [" + match[0] + "]" + " (Directo)", match[1], thumbnail, plot) # Busca el Spoiler patronvideos = '(http://www.youtube.com[^"]+)"' matchSpoiler = re.compile(patronvideos, re.DOTALL).findall(data) if len(matchSpoiler) > 0: encontrados = set() for match in matchSpoiler: if match not in encontrados: encontrados.add(match) # Añade al listado de XBMC xbmctools.addnewvideo(__channel__, "youtubeplay", category, "Directo", "Ver El Spoiler de : " + title, match, thumbnail, "Ver Video Spoiler") # Lista series relacionadas titulo = "Ver otros capitulos de esta temporada" matches = buscarelacionados(matchesBK) plot2 = "CAPITULOS DE ESTA TEMPORADA :\n\n" for match in matches: plot2 = plot2 + "-" + match[2] + "\n" xbmctools.addnewfolderextra(__channel__, "listarelacionados", category, titulo, url, thumbnail, plot2, matchesBK) #<div class="film"><a href="/house/#t_57"><img src="/thumbs/temporadas/95/120/57.jpg" # Cambiar de Temporada patron = 'div class="film"><a href="([^"]+)"><img src="([^"]+)" style' matchSerie = re.compile(patron, re.DOTALL).findall(matchesBK) if len(matchSerie) > 1: for temp in matchSerie: url2 = urlparse.urljoin(url1, temp[0]) thumbnail = urlparse.urljoin(url1, temp[1]) titulo = "Cambiar a otras temporadas" titulo_serie = temp[0].split("/") titulo2 = titulo_serie[1].replace("-", " ") #print ' titulo%s ' %titulo2 xbmctools.addnewfolderextra(__channel__, "listarTemporada", category, titulo, url2, thumbnail, plot, titulo2) break # Label (top-right)... xbmcplugin.setContent(int(sys.argv[1]), "movies") xbmcplugin.setPluginCategory(handle=pluginhandle, category=category) xbmcplugin.addSortMethod(handle=pluginhandle, sortMethod=xbmcplugin.SORT_METHOD_NONE) xbmcplugin.endOfDirectory(handle=pluginhandle, succeeded=True)
elif action == 'seasons': url = self.query.get('url', None) self.log('Showing seasons for URL "{}"'.format(url)) self.showSeasons(url) elif action == 'episodes': url = self.query.get('url', None) self.log('Showing episodes for URL "{}"'.format(url)) self.showEpisodes(url) elif action == 'hosters': url = self.query.get('url', None) self.log('Showing hosters for URL "{}"'.format(url)) self.showHosters(url) elif action == 'play': url = self.query.get('url', None) self.log('Play video from "{}"'.format(url)) self.playVideo(url) else: self.log('Invalid action') raise Exception('Invalid action "{}"'.format(str(action))) if __name__ == '__main__': menu = Menu(sys.argv) xbmcplugin.setContent(menu.handle, 'movies') menu.show()
def listsimple(params, url, category): logger.info("[series21.py] listsimple") url1 = "http://www.series21.com" extra = urllib.unquote_plus(params.get("extradata")) title = urllib.unquote_plus(params.get("title")) # Descarga la página data = scrapertools.cachePage(url) logger.info("esta es la url: " + url) # Extrae las entradas (carpetas) scrapedplot = "" patronvideos = "" if (title == "Series - Estrenos") or url1 + "/nuevo" in url: patronvideos = '<div class="film2"[^>]+>.*?' patronvideos += '<img src="([^"]+)".*?' # Imagen patronvideos += '<a href="([^"]+)".*?' # Url patronvideos += '<b>([^<]+)</b>.*?' # Nombre de la serie patronvideos += '<div style[^>]+>([^<]+)</div>' # Titulo del capitulo #patronvideos += '.*?<b>(Temporada:</b>.*?)<.*?</a>--><br/>' #patronvideos += '.*?<div style=[^>]+>' # Genero #patronvideos += '.*?<b>(Doblaje:</b>.*?)<.*?-->' # Idioma elif title in "0-9ABCDEFGHIJKLMNOPQRSTUVWXYZ" or extra == "actor": patronvideos = '<a href="([^"]+)"' # url patronvideos += '.*?<img src="([^"]+)".*?' # Imagen patronvideos += 'class="titulo">([^<]+)</a>.*?' # Titulo patronvideos += '<b>(Sinopsis: </b>.*?)</div>' # Sinopsis #<li style="margin:0px; padding:0px; height:18px; margin-left:5px;"> # <b>Dexter</b>: <a href="/dexter/5x10-in-the-beginning/">5x10 - In the Beginning</a> | Subtitulado elif title == "Series - Novedades": patronvideos = '<li style=.*?margin-left[^>]+>[^<]+' patronvideos += '<b>([^<]+)</b>\: <a href="([^"]+)"' patronvideos += '>([^<]+)</a>(.+?)</li>' #patronvideos += '<br /><b>(.*?)</b><br />(.*?)</a></div>' logger.info("[ listsimple patronvideos: " + patronvideos) #<li style="margin:0px; padding:0px; height:18px; margin-left:5px;"><a style="text-decoration:none;" href="/bella-calamidades/1x124-capitulo-124/">Bella calamidades 1x124 - Capitulo - 124</a></li> matches = re.compile(patronvideos, re.DOTALL).findall(data) scrapertools.printMatches(matches) solo_capitulo = False #logger.info("[ listsimple matches") for match in matches: # Atributos #scrapedtitle = match[2] #scrapedtitle = scrapedtitle.replace("<span class='style4'>","") #scrapedtitle = scrapedtitle.replace("</span>","") scrapedurl = urlparse.urljoin(url1, match[1]) scrapedthumbnail = urlparse.urljoin(url1, match[0]) scrapedthumbnail = scrapedthumbnail.replace(" ", "") if title in "0-9ABCDEFGHIJKLMNOPQRSTUVWXYZ" or extra == "actor": scrapedtitle = match[2].replace("\n\t", "") scrapedplot = match[3].replace("\n", " ") + "\n" scrapedurl = urlparse.urljoin(url1, match[0]) scrapedthumbnail = urlparse.urljoin(url1, match[1]) scrapedthumbnail = scrapedthumbnail.replace(" ", "") if title == "Series - Novedades": scrapedurl = urlparse.urljoin(url1, match[1]) scrapedthumbnail = "" #scrapedthumbnail = scrapedthumbnail.replace(" ","") solo_capitulo = True #scrapedplot = "Serie: "+match[2]+"\n" #scrapedplot += "Capitulo: "+match[3] if "esp.gif" in match[3]: idioma = "Español" else: idioma = match[3].replace(" | ", "").replace("\t\t\t\t\t\t", "") scrapedtitle = "%s - %s (%s)" % (match[0], match[2], idioma) if (title == "Series - Estrenos") or url1 + "/nuevo" in url: scrapedtitle = match[2] scrapedurl = urlparse.urljoin(url1, match[1]) scrapedthumbnail = urlparse.urljoin(url1, match[0]) scrapedthumbnail = scrapedthumbnail.replace(" ", "") solo_capitulo = True scrapedtitle = scrapedtitle + " - " + match[3].replace("\t\t", "") #scrapedplot = match[3].replace("\n","")+"\n" #scrapedplot = scrapedplot.replace(":",": ") #scrapedplot += match[5].replace("\n"," ")+"\n" #scrapedplot += match[6].replace(":",": ") #scrapedtitle = scrapedtitle.replace("\n\t"," ") scrapedplot = re.sub("<[^>]+>", " ", scrapedplot) scrapedplot = scrapedplot.replace("é", "é") scrapedplot = scrapedplot.replace("ó", "ó") scrapedplot = scrapedplot.replace("ñ", "ñ") if (DEBUG): logger.info("title=[" + scrapedtitle + "], url=[" + scrapedurl + "], thumbnail=[" + scrapedthumbnail + "]") # Añade al listado de XBMC if solo_capitulo: xbmctools.addnewfolder(__channel__, "ListarVideos", category, scrapedtitle, scrapedurl, scrapedthumbnail, scrapedplot, fanart=scrapedthumbnail) else: xbmctools.addnewfolder(__channel__, "listarTemporada", category, scrapedtitle, scrapedurl, scrapedthumbnail, scrapedplot, fanart=scrapedthumbnail) #<div class="pagination" align="center" ><p><span class='current'>1</span><a href='/estrenos/2/'>2</a><a href='/estrenos/2/'>Siguiente »</a><a href='/estrenos/2/'></a> # Extrae la marca de siguiente página if title == "Series - Novedades" or "http://www.series21.com/nuevo" in url: patronvideos = '<div class="pagination" align="center" ><div.*?<a href="([^"]+)">Más series' matches = re.compile(patronvideos, re.DOTALL).findall(data) scrapertools.printMatches(matches) if len(matches) > 0: extra = "siguiente" scrapedtitle = "Página siguiente" scrapedurl = urlparse.urljoin(url1, matches[0]) scrapedthumbnail = "" scrapedplot = "" xbmctools.addnewfolderextra(__channel__, "listsimple", category, scrapedtitle, scrapedurl, scrapedthumbnail, scrapedplot, extra) # Label (top-right)... xbmcplugin.setContent(int(sys.argv[1]), "movies") xbmcplugin.setPluginCategory(handle=pluginhandle, category=category) xbmcplugin.addSortMethod(handle=pluginhandle, sortMethod=xbmcplugin.SORT_METHOD_NONE) xbmcplugin.endOfDirectory(handle=pluginhandle, succeeded=True)