def ttv_cats(): dict_torrent = {} url="http://super-pomoyka.us.to/trash/ttv-list/ttv.m3u" html_source=read_url(url) match = re.compile('#EXTINF:-1,(.+?)\n(.*)').findall(html_source) for title, acehash in match: channel_name = re.compile('(.+?) \(').findall(title) match_cat = re.compile('\((.+?)\)').findall(title) for i in xrange(0,len(match_cat)): if match_cat[i] == "Для взрослых" : pass elif match_cat[i] == "Ночной канал" : pass else: categorie = russiandictionary(match_cat[i]) if categorie not in dict_torrent.keys(): try: dict_torrent[categorie] = [(channel_name[0],acehash)] except: pass else: try: dict_torrent[categorie].append((channel_name[0],acehash)) except: pass for cat in dict_torrent.keys(): url = build_url({'mode': 'open_ttv_cat','channels':json.dumps(dict_torrent),'cat':cat}) li = xbmcgui.ListItem(cat,iconImage='http://addons.tvaddons.ag/cache/images/bc591d6d5ec442d4ddb43a347a8be6_icon.png') xbmcplugin.addDirectoryItem(handle=addon_handle, url=url, listitem=li, isFolder=True) xbmcplugin.endOfDirectory(addon_handle)
def listsItems(self, url): query_data = { 'url': url, 'use_host': True, 'host': HOST, 'use_cookie': True, 'save_cookie': True, 'load_cookie': False, 'cookiefile': self.COOKIEFILE, 'use_post': False, 'return_data': True } link = self.cm.getURLRequestData(query_data) HEADER = {'Accept-Language': 'pl,en-US;q=0.7,en;q=0.3', 'Referer': url, 'User-Agent': HOST, 'X-Requested-With':'XMLHttpRequest', 'Content-Type:': 'application/json'} #http://www.cda.pl/tick.php?ts=1443133845 #query_data2 = { 'url': url, 'use_host': True, 'host': HOST, 'use_header': True, 'header': HEADER, # 'use_cookie': True, 'save_cookie': False, 'load_cookie': True, # 'cookiefile': self.COOKIEFILE, 'use_post': True, 'return_data': True } #link = self.cm.getURLRequestData(query_data2) #print("Link", link) match = re.compile('<label(.*?)>(.*?)</label>', re.DOTALL).findall(link) if len(match) > 0: for i in range(len(match)): match1 = re.compile('<img height="90" width="120" src="(.*?)" (.*?)>(.*?)<span class="timeElem">(.*?)</span>(.*?)</a>(.*?)<a class="titleElem" href="(.*?)">(.*?)</a>', re.DOTALL).findall(match[i][1]) if len(match1) > 0: self.add('cdapl', 'playSelectedMovie', 'None', self.cm.html_special_chars(match1[0][7]) + ' - '+ match1[0][3].strip(), match1[0][0], mainUrlb+match1[0][6], 'aaaa', 'None', False, False) else: match2 = re.compile('<div class="block upload" id="dodane_video">(.*?)<div class="paginationControl">', re.DOTALL).findall(link) match3 = re.compile('<div class="videoElem">\n <a href="(.*?)" style="position:relative;width:120px;height:90px" title="(.*?)">\n <img width="120" height="90" src="(.*?)" title="(.*?)" alt="(.*?)" />\n ', re.DOTALL).findall(match2[0]) if len(match3) > 0: for i in range(len(match3)): self.add('cdapl', 'playSelectedMovie', 'None', self.cm.html_special_chars(match3[i][1]) , match3[i][2], mainUrlb+match3[i][0], 'aaaa', 'None', True, False) # <span class="next-wrapper"><a onclick="javascript:changePage(2);return false;" class="sbmBigNext btn-my btn-large fiximg" href=" "> Następna strona ></a></span> match10 = re.compile('<span class="next-wrapper"><a onclick="javascript:changePage\((.*?)\);return false;" class="sbmBigNext btn-my btn-large fiximg" href="(.*?)">(.*?)></a></span>', re.DOTALL).findall(link) print("M10000",match10) if len(match10) > 0: self.add('cdapl', 'categories-menu', 'Następna strona', 'None', 'None', mainUrlb+match10[0][1], 'None', 'None', True, False,match10[0][0]) xbmcplugin.endOfDirectory(int(sys.argv[1]))
def comunicado(): texto = "Boa tarde,\nVenho vos anunciar que o addon Tuga.io vai ser descontinuado. A razão que me levou a fazer isto tem a haver com vários factos que vou enumerar de seguida.\n\n1º - Falta de tempo e paciência. Poderia ser só uma condicionante ou o tempo ou a paciência mas os dois juntos é difícil. A condicionante paciência vem do facto de sempre que atualizo, os mesmos criadores do site Tuga.io tentavam dificultar a vida a quem tenta dar visibilidade ao seu projeto. Lançaram o projeto para os utilizadores da internet terem acesso livre aos diversos conteúdos de filmes e séries, colocando regras que seria grátis para todos e de forma fácil. Implementaram o registo de utilizadores a indicarem que o mesmo não seria necessário para visualizar o conteúdo. No dia 01 de Outubro de 2015 os diversos utilizadores do projeto receberam uma notícia que os registos estavam fechados que era necessário conta para ver os conteúdos. Mudaram as regras, está no direito deles mas para também combater um addon que lhe dava visibilidade.\n2º - Bloqueios constantes. Nos últimos meses vocês verificavam que o addon deixava de funcionar de um momento para o outro. Tive a difícil tarefa de tentar perceber o bloqueio e contornar-lo para que vocês, utilizadores do addon, pudessem utilizar.\nO addon poderá continuar, quem quiser pode pegar no código já desenvolvido por mim e lançar novas atualizações, terei todo o gosto em ajudar quem quiser continuar o mesmo. Posso ajudar desde a interpretação de código já feito, como a implementação de novas funcionalidades. Tinha algumas ideias para o addon, que quem pegar nele direi e ajudarei na implementação, ideias que já tinham sido começado a ser implementadas mas não estavam a 100%.\nEu como desenvolvedor, não irei parar e tenho ideias para lançar no meu repositório, poderá ser um lançamento demorado mas que até ao final do ano, eu espero lançar. A ideia principal não será para a visualização de filmes nem séries, mas será um ideia que muitos de vocês que gostam de futebol poderão usar. E adianto também que não é um addon para ver o futebol mas é para ser acompanhado o futebol pelo Kodi.\nAgradeço a todos que usaram este addon durante meses, dos elogios e das sugestões que foram, ou não implementadas, mas não estavam esquecidas.\nAgradeço ao Carlos Correia e ao Enen pela ajuda e dicas no desenvolvimento do mesmo. E ao João Ferreira pelas imagens feitas e disponibilizadas para o addon.\nAos interessados na continuação do addon, poderão contactar via MP ou podem enviar um email para [email protected].\nObrigado a todos." print texto xbmcgui.Dialog().ok("Tuga.io", texto) addDir('Entrar novamente', 'url', None, os.path.join(artfolder, skin, 'retroceder.png'), True) vista_menu() xbmcplugin.endOfDirectory(int(sys.argv[1]))
def get_ttv(): url='http://www.acesportstream.com' url=read_url(url) soup=bs(url) channels1=soup.find('div',{'id':'hd'}).findAll('a') channels2=soup.find('div',{'id':'blue'}).findAll('a') for channel in channels1: link=channel['href'] img=channel.find('img')['src'] name=clean(cleanex(channel['title'])) url = build_url({'mode': 'open_ttv_stream','url':link, 'name':name.encode('ascii','ignore')}) li = xbmcgui.ListItem('%s'%name, iconImage=img) li.setProperty('IsPlayable', 'true') xbmcplugin.addDirectoryItem(handle=addon_handle, url=url, listitem=li) for channel in channels2: link=channel['href'] img=channel.find('img')['src'] name=clean(cleanex(channel['title'])) url = build_url({'mode': 'open_ttv_stream','url':link, 'name':name.encode('ascii','ignore')}) li = xbmcgui.ListItem('%s'%name, iconImage=img) li.setProperty('IsPlayable', 'true') xbmcplugin.addDirectoryItem(handle=addon_handle, url=url, listitem=li) xbmcplugin.endOfDirectory(addon_handle)
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 getCategoryItems(self, url, page): print "*** Get category items %s" % url page_url = "%s/page/%s/" % (url, str(int(page))) response = common.fetchPage({"link": page_url}) items = 0 if response["status"] == 200: content = common.parseDOM(response["content"], "div", attrs={"id": "page_content"}) movie = common.parseDOM(content, "div", attrs={"class": "movie_teaser clearfix"}) header = common.parseDOM(movie, "h2") links = common.parseDOM(header, "a", ret="href") titles = common.parseDOM(header, "a") poster = common.parseDOM(movie, "li", attrs={"class": "movie_teaser_poster"}) images = common.parseDOM(poster, "img", ret="src") teaser = common.parseDOM(movie, "div", attrs={"class": "teaser_info"}) descs = common.parseDOM(teaser, "div", attrs={"class": "teaser_desc"}) infos = common.parseDOM(teaser, "ul", attrs={"class": "teaser_ads"}) ratings = common.parseDOM(movie, "li", attrs={"class": "current-rating"}) pagenav = common.parseDOM(response["content"], "div", attrs={"id": "pagenav"}) for i, title in enumerate(titles): items += 1 info = common.parseDOM(infos[i], "li") image = images[i] genre = self.encode(', '.join(common.parseDOM(info[2], "a"))) year = info[1].split('</span>')[-1] desc = common.stripTags(self.encode(descs[i])) rating = int(ratings[i])/10 if ratings[i] > 0 else None try: tmp = year.split(' ') year = tmp[0] season = tmp[1]+tmp[2] title = "%s %s %s" % (self.encode(title), self.encode(season), year) except IndexError: title = "%s (%s)" % (self.encode(title), year) uri = sys.argv[0] + '?mode=show&url=%s' % (links[i]) item = xbmcgui.ListItem(title, iconImage=self.icon, thumbnailImage=self.url+image) item.setInfo(type='Video', infoLabels={'title': title, 'genre': genre, 'plot': desc, 'rating': rating}) xbmcplugin.addDirectoryItem(self.handle, uri, item, True) else: self.showErrorMessage("getCategoryItems(): Bad response status%s" % response["status"]) if pagenav and not items < 10: uri = sys.argv[0] + '?mode=%s&url=%s&page=%s' % ("category", url, str(int(page) + 1)) item = xbmcgui.ListItem("Next page >>", thumbnailImage=self.inext) xbmcplugin.addDirectoryItem(self.handle, uri, item, True) xbmc.executebuiltin('Container.SetViewMode(52)') xbmcplugin.endOfDirectory(self.handle, True)
def SEARCHSR(): search = '' refresh = xbmcgui.Window(10000).getProperty('MASH_SR_REFRESH') == 'True' if refresh: search = xbmcgui.Window(10000).getProperty('MASH_SR_TERM') xbmcgui.Window(10000).clearProperty('MASH_SR_REFRESH') xbmcgui.Window(10000).clearProperty('MASH_SR_TERM') if len(search) < 1: keyb = xbmc.Keyboard('', 'Search Shows') keyb.doModal() if (keyb.isConfirmed()): search = keyb.getText() if not search: xbmcplugin.endOfDirectory(int(sys.argv[1]),False,False) return xbmcgui.Window(10000).setProperty('MASH_SR_TERM', search) encode=urllib.quote(search) surl='http://www.sidereel.com/_television/search?utf8=%E2%9C%93&q='+encode sys.argv.append(surl) SEARCHED(surl)
def listEpisodes(self, url): api = self.hbogoAPI(url) items = api['Episodes'] for i in range(len(items)): allowfreepreview = items[i]['AllowFreePreview'] #true allowplay = items[i]['AllowPlay'] #true episode = items[i]['EpisodeNumber'] ispublic = items[i]['IsPublic'] duration = items[i]['MovieDuration'] desc = self.dec(items[i]['Abstract']) img = self.dec(items[i]['ThumbnailUrl']) title = self.dec(items[i]['Name']) id = self.dec(items[i]['Id']) materialId = self.dec(items[i]['MaterialId']) materialItemId = self.dec(items[i]['MaterialItemId']) origTitle = self.dec(items[i]['OriginalName']) content = items[i]['ContentType'] n_url = plapiUrl + mediaPlayer + id + '/' + materialId + '/' + materialItemId + '/TABL' if dbg == 'true': log.info("HBOGO - listEpisodes() -> title: " + str(title)) log.info("HBOGO - listEpisodes() -> img link: " + img) log.info("HBOGO - listEpisodes() -> url: " + n_url) log.info("HBOGO - listEpisodes() -> content: " + str(content)) if content == 3: self.addDir(SERVICE, 'info-movie', title, img, desc, n_url) #self.addDir(SERVICE, 'series', '', '', '', '') xbmcplugin.endOfDirectory(int(sys.argv[1]))
def listContent(self, url): api = self.hbogoAPI(url) items = api['Collections'][0]['MediaItems'] for i in range(len(items)): desc = self.dec(items[i]['Abstract']) img = self.dec(items[i]['ThumbnailUrl']) title = self.dec(items[i]['Name']) id = self.dec(items[i]['Id']) materialId = self.dec(items[i]['MaterialId']) materialItemId = self.dec(items[i]['MaterialItemId']) origTitle = self.dec(items[i]['OriginalName']) content = items[i]['ContentType'] n_url = plapiUrl + mediaPlayer + id + '/' + materialId + '/' + materialItemId + '/TABL' if dbg == 'true': log.info("HBOGO - listSeasons() -> title: " + str(title)) log.info("HBOGO - listSeasons() -> img link: " + img) log.info("HBOGO - listSeasons() -> url: " + n_url) log.info("HBOGO - listSeasons() -> content: " + str(content)) if content == 1: self.addDir(SERVICE, 'movie', title, img, desc, n_url) elif content == 2: self.addDir(SERVICE, 'episode', title, img, desc, n_url) elif content == 5: self.addDir(SERVICE, 'season', title, img, desc, n_url) #self.addDir(SERVICE, 'series', '', '', '', '') xbmcplugin.endOfDirectory(int(sys.argv[1]))
def get_shows(): params = extra.copy() params['genreID'] = id params['sorting'] = 'desc' params['offset'] = page url = build_url('/getList', params = params) data = get_json_response(url) if data: mode_lookup = { 'movies': mode_play, 'live': mode_play } is_folder_lookup = { 'movies': False, 'live': False } liz_prop_lk = { 'movies': {'isPlayable': 'true'}, 'live': {'isPlayable': 'true'} } for d in data: content_type = d['contentType'] dir_mode = mode_lookup[content_type] if content_type in mode_lookup else mode_episode is_folder = is_folder_lookup[content_type] if content_type in is_folder_lookup else True list_properties = liz_prop_lk[content_type] if content_type in liz_prop_lk else {} fanart = d['thumbnail'].encode('utf8') add_dir(d['textHead'], d['ID'], dir_mode, is_folder = is_folder, art = {'thumb': fanart, 'fanart': fanart}, extra = {'contentType': d['contentType']}, list_properties = list_properties) add_dir('Next >>', id, mode_show, page = page + 1, extra = extra) xbmcplugin.endOfDirectory(this_plugin)
def show_playlists_by_channel(Channelid, type=''): search_response = ytube.yt_get_channel_info(Channelid) #Grab the playlists from the response playlists = search_response['items'][0]['contentDetails']['relatedPlaylists'] # Go through each playlist and display the playlist for key, value in playlists.iteritems(): #Grab the number of videos to pl = ytube.yt_get_playlist_info(value) number_vids = str(pl['items'][0]['contentDetails']['itemCount']) #videos.append(search_result) url = dev.build_url({'mode': 'addPlaylist', 'id': value, 'type': type}) dev.adddir(key.capitalize()+' ('+number_vids+')', url, search_response['items'][0]['snippet']['thumbnails']['high']['url'], fanart=search_response['items'][0]['snippet']['thumbnails']['high']['url'], description=dev.lang(31010)+' '+dev.typeName(type)+' \n--------\nPlaylist Description:\n'+search_response['items'][0]['snippet']['description']) # Grab other playlists this user has created to response = ytube.yt_get_playlists_by_channel(Channelid) if isinstance(response, list): # Go through each playlist and display the playlist for playlist in response: #videos.append(search_result) title = playlist['snippet']['title']+' ('+str(playlist['contentDetails']['itemCount'])+')' url = dev.build_url({'mode': 'addPlaylist', 'id': playlist['id'], 'type': type}) dev.adddir(title, url, playlist['snippet']['thumbnails']['high']['url'], fanart=playlist['snippet']['thumbnails']['high']['url'], description=dev.lang(31010)+' '+dev.typeName(type)+' \n--------\nPlaylist Description:\n'+playlist['snippet']['description']) xbmcplugin.endOfDirectory(vars.addon_handle)#Adds a playlist & loads the view to edit it
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 get_genres(): headers = get_headers() # get the chunk from the headers list that matches this pageCode/id, # e.g. if we are in the 'Tv' page, get the relevant subMenu, etc. for this page header = list(filter(lambda x: x['id'] == id, headers)) sub_menu_id = header[0]['subMenu'][0]['submenuId'] # sub_menu_id = header[0]['subMenu'][0]['submenuId'] sub_menu_name = header[0]['name'].lower() genres = None # combine genres for tv and originals because some genres don't show up and it seems that both may share the same genres if sub_menu_name in ['tv', 'originals']: genres = [ {'genreID': g['genreId'], 'genreName': g['genreName']} for h in headers for s in h['subMenu'] for g in s['subGenre'] ] genres.extend(get_genres_by_type(id, 'tv')) genres.extend(get_genres_by_type(id, 'movies')) else: genres = header[0]['subMenu'][0]['subGenre'] moreGenres = get_genres_by_type(id, sub_menu_name) if moreGenres and moreGenres != 'null': genres.extend(moreGenres) # make the list unique by genreId genres = {g['genreId'] if 'genreId' in g else g['genreID']: g for g in genres}.values() genres = sorted(genres, key = lambda g: g['genreName']) for g in genres: # set the page that we're at (tv, originals, movies, etc.) so we can tell if we're in movies because movies don't have episodes extra = {'pageCode': id, 'submenuID': sub_menu_id} genreId = g['genreId'] if 'genreId' in g else g['genreID'] add_dir(g['genreName'], genreId, mode_show, extra = extra) xbmcplugin.endOfDirectory(this_plugin)
def run(self, oGuiElement, sTitle, sUrl): sPluginHandle = cPluginHandler().getPluginHandle(); #meta = oGuiElement.getInfoLabel() meta = {'label': sTitle, 'title': sTitle} item = xbmcgui.ListItem(path=sUrl, iconImage="DefaultVideo.png", thumbnailImage=self.sThumbnail) item.setInfo( type="Video", infoLabels= meta ) if (cConfig().getSetting("playerPlay") == '0'): sPlayerType = self.__getPlayerType() xbmcPlayer = xbmc.Player(sPlayerType) xbmcPlayer.play( sUrl, item ) xbmcplugin.endOfDirectory(sPluginHandle, True, False, False) else: xbmcplugin.setResolvedUrl(sPluginHandle, True, item) timer = int(cConfig().getSetting('param_timeout')) xbmc.sleep(timer) while not xbmc.abortRequested: try: self.currentTime = self.getTime() self.totalTime = self.getTotalTime() except: break xbmc.sleep(1000)
def getcontent_search(url): debug("getcontent_search :" + url) inhalt=geturl(url) inhalt=ersetze(inhalt) kurz_inhalt = inhalt[inhalt.find('<span class="resultsCount">')+1:] kurz_inhalt = kurz_inhalt[:kurz_inhalt.find('<script type="text/javascript">')] spl=kurz_inhalt.split('<div class="teaserInner clearFix">') for i in range(1,len(spl),1): entry=spl[i] match=re.compile('<a href="([^"]+)"', re.DOTALL).findall(entry) url=baseurl+match[0] match=re.compile('<img src="([^"]+)"', re.DOTALL).findall(entry) img=match[0] match=re.compile('<span class="name">([^<]+)</span>', re.DOTALL).findall(entry) name=match[0] match=re.compile('<span class="episode">([^<]+)</span>', re.DOTALL).findall(entry) beschreibung=match[0] match=re.compile('<time class="duration" datetime="[^"]+">[0-9]+ Min.</time>', re.DOTALL).findall(entry) dauer=match[0] addLink(name=name +" ( "+ beschreibung + " )", url=url, mode="folge", iconimage=img,duration=dauer,desc=beschreibung) #debug(inhalt) match=re.compile('<a class="sprite ir" href="([^"]+)"', re.DOTALL).findall(inhalt) if match: addDir(name="Next", url=baseurl+match[0], mode="getcontent_search", iconimage="" ) xbmcplugin.endOfDirectory(addon_handle,succeeded=True,updateListing=False,cacheToDisc=True)
def Categories(url, index=0): cathtml = utils.getHtml(url, '') match = re.compile("<ul class='children'>(.*?)</ul>", re.DOTALL | re.IGNORECASE).findall(cathtml) match1 = re.compile('href="([^"]+)[^>]+>([^<]+)<', re.DOTALL | re.IGNORECASE).findall(match[index]) for catpage, name in match1: utils.addDir(name, catpage, 232, '') xbmcplugin.endOfDirectory(utils.addon_handle)
def Test(params): # -- get filter parameters par = Get_Parameters(params) # -- add header info Get_Header(par, 1) xbmcplugin.endOfDirectory(h)
def Categories(url): cathtml = utils.getHtml(url, '') match = re.compile('<li id="categories-2"(.*?)</ul>', re.DOTALL | re.IGNORECASE).findall(cathtml) match1 = re.compile('href="([^"]+)[^>]+>([^<]+)<', re.DOTALL | re.IGNORECASE).findall(match[0]) for catpage, name in match1: utils.addDir(name, catpage, 141, '') xbmcplugin.endOfDirectory(utils.addon_handle)
def view(items, update_listing=False, urls=None): if urls is None: urls = [plugin.url_for_path(item.url) for item in items] total = len(items) for item, url in zip(items, urls): if not getattr(item, 'available', True): continue title = item.title if getattr(item, 'episode', None): title += " " + item.episode li = ListItem(title, thumbnailImage=getattr(item, 'thumb', '')) playable = plugin.route_for(url) == play li.setProperty('isplayable', str(playable)) if hasattr(item, 'fanart'): li.setProperty('fanart_image', item.fanart) if playable: info = { 'title': title, 'plot': item.description, 'mpaa': item.legal_age, } if item.category: info['genre'] = item.category.title if item.aired: info['aired'] = item.aired.strftime('%Y-%m-%d') li.setInfo('video', info) li.addStreamInfo('video', {'codec': 'h264', 'width': 1280, 'height': 720, 'duration': item.duration}) li.addStreamInfo('audio', {'codec': 'aac', 'channels': 2}) addDirectoryItem(plugin.handle, url, li, not playable, total) endOfDirectory(plugin.handle, updateListing=update_listing)
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 Tags(url): html = utils.getHtml(url, '') match = re.compile('<div class="tagcloud">(.*?)</div>', re.DOTALL | re.IGNORECASE).findall(html) match1 = re.compile("href='([^']+)[^>]+>([^<]+)<", re.DOTALL | re.IGNORECASE).findall(match[0]) for catpage, name in match1: utils.addDir(name, catpage, 181, '') xbmcplugin.endOfDirectory(utils.addon_handle)
def build_search_directory(name, url): if url != 'library': keyboard = xbmc.Keyboard( '', settings.getLocalizedString(30007) ) keyboard.doModal() if ( keyboard.isConfirmed() == False ): return search_string = keyboard.getText().replace( ' ', '+' ) if len( search_string ) == 0: return else: search_string = name data = getUrl( 'http://www.traileraddict.com/search.php?q=' + search_string ) image = re.compile( '<center>\r\n<div style="background:url\((.*?)\);" class="searchthumb">', re.DOTALL ).findall( data ) link_title = re.compile( '</div><a href="/tags/(.*?)">(.*?)</a><br />' ).findall( data ) if len( link_title ) == 0: if url == 'library': return None dialog = xbmcgui.Dialog() ok = dialog.ok( plugin , settings.getLocalizedString(30009) + search_string + '.\n' + settings.getLocalizedString(30010) ) build_main_directory() return item_count=0 totalItems = len(link_title) if url == 'library': return link_title[0][0] for url, title in link_title: url = 'http://www.traileraddict.com/tags/' + url thumb = 'http://www.traileraddict.com' + image[item_count].replace( '/pthumb.php?dir=', '' ).replace( '\r\n', '' ) u = { 'mode': '4', 'name': clean( title ), 'url': url } addListItem(label = clean( title ), image = thumb, url = u, isFolder = True, totalItems = totalItems, infoLabels = False) item_count = item_count + 1 xbmcplugin.addSortMethod( handle = int( sys.argv[1] ), sortMethod = xbmcplugin.SORT_METHOD_NONE ) xbmcplugin.endOfDirectory( int( sys.argv[1] ) )
def panDir(): while not panAuth(): if xbmcgui.Dialog().yesno(_name, ' Login Failed', 'Bad User / Pass / Proxy', ' Check Settings?'): _settings.openSettings() else: exit() sort = _settings.getSetting('sort') stations = _pandora.stations quickmix = stations.pop(0) # Quickmix if sort == '0': stations = stations # Normal elif sort == '2': stations = stations[::-1] # Reverse else: stations = sorted(stations, key=lambda s: s.name) # A-Z stations.insert(0, quickmix) # Quickmix back on top for station in stations: li = xbmcgui.ListItem(station.name, station.id) li.setProperty('IsPlayable', 'true') img = _settings.getSetting("img-%s" % station.id) li.setIconImage(img) li.setThumbnailImage(img) li.addContextMenuItems([('Select Thumb', "RunPlugin(plugin://%s/?thumb=%s)" % (_plugin, station.id))]) xbmcplugin.addDirectoryItem(_handle, "%s?station=%s" % (_base, station.id), li) xbmcplugin.endOfDirectory(_handle, cacheToDisc = False) xbmc.log("%s.Dir OK" % _plugin, xbmc.LOGDEBUG)
def listVideos(id): content = getUrl("http://redux.com/hg.channelinfo/"+id) spl=content.split('"pid":') for i in range(1,len(spl),1): entry=spl[i] match=re.compile('"title":"(.+?)"', re.DOTALL).findall(entry) title=match[0] title=cleanTitle(title) match=re.compile('"type":"(.+?)"', re.DOTALL).findall(entry) type=match[0] match=re.compile('"id":"(.+?)"', re.DOTALL).findall(entry) id=match[0] match=re.compile('</span>(.+?)<span class=', re.DOTALL).findall(entry) desc="" if len(match)>0: desc=match[0] match=re.compile('"duration":(.+?),', re.DOTALL).findall(entry) try: min=int(int(match[0])/60) sec=int(int(match[0])%60) duration=str(min)+":"+str(sec) except: duration="" match=re.compile('"imagebase":"(.+?)"', re.DOTALL).findall(entry) thumb=match[0]+"strip203x150" if type=="youtube": addLink(title,id,'playYoutube',thumb,desc,duration) elif type=="vimeo": addLink(title,id,'playVimeo',thumb,desc,duration) xbmcplugin.endOfDirectory(pluginhandle) if forceViewMode==True: xbmc.executebuiltin('Container.SetViewMode('+viewMode+')')
def mainlist(params,url,category): logger.info("[favoritos.py] mainlist") import xbmctools # Crea un listado con las entradas de favoritos if usingsamba: ficheros = samba.get_files(BOOKMARK_PATH) else: ficheros = os.listdir(BOOKMARK_PATH) ficheros.sort() for fichero in ficheros: try: # Lee el bookmark titulo,thumbnail,plot,server,url = readbookmark(fichero) # Crea la entrada # En la categoría va el nombre del fichero para poder borrarlo xbmctools.addnewvideo( CHANNELNAME , "play" , os.path.join( BOOKMARK_PATH, fichero ) , server , titulo , url , thumbnail, plot ) except: pass # Label (top-right)... xbmcplugin.setPluginCategory( handle=int( sys.argv[ 1 ] ), category=category ) xbmcplugin.addSortMethod( handle=int( sys.argv[ 1 ] ), sortMethod=xbmcplugin.SORT_METHOD_NONE ) xbmcplugin.endOfDirectory( handle=int( sys.argv[ 1 ] ), succeeded=True )
def ttv_sport(): base_url = 'http://super-pomoyka.us.to/trash/ttv-list/ttv.m3u' source = read_url(base_url) if source: match= re.compile("#EXTINF:-1,Sky Sports News \(.+?\)\n(.*)").findall(source) if match: name='Sky Sports News' ace=match[0] url='plugin://program.plexus/?mode=1&url=%s&name=%s'%(ace,name.replace(' ','+')) li = xbmcgui.ListItem('%s'%name, iconImage='http://addons.tvaddons.ag/cache/images/bc591d6d5ec442d4ddb43a347a8be6_icon.png') li.setProperty('IsPlayable', 'true') xbmcplugin.addDirectoryItem(handle=addon_handle, url=url, listitem=li) match= re.compile("#EXTINF:-1,(.+?)\(Спорт\)\n(.*)").findall(source) for titulo,acestream in match: name=titulo ace=acestream clean = re.compile("\((.+?)\)").findall(name) for categorie in clean: name = name.replace("(" + categorie +")","") ace=acestream url='plugin://program.plexus/?mode=1&url=%s&name=%s'%(ace,name.replace(' ','+')) li = xbmcgui.ListItem('%s'%name, iconImage='http://addons.tvaddons.ag/cache/images/bc591d6d5ec442d4ddb43a347a8be6_icon.png') li.setProperty('IsPlayable', 'true') xbmcplugin.addDirectoryItem(handle=addon_handle, url=url, listitem=li) xbmcplugin.endOfDirectory(addon_handle)
def listChannels(type): xbmcplugin.addSortMethod(pluginhandle, xbmcplugin.SORT_METHOD_LABEL) content = getUrl("http://redux.com/hg.shellinit") content = content[content.find('"'+type+'":'):] content = content[:content.find('</div>\\n</div>\\n\\n",')] spl=content.split("<div class='chan'") for i in range(1,len(spl),1): entry=spl[i] match=re.compile("<div class='title'>(.+?)</div>", re.DOTALL).findall(entry) match2=re.compile("<div class='title'>(.+?)</div>", re.DOTALL).findall(entry) if len(match)>0: title=match[0] elif len(match2)>0: title=match2[0] title=cleanTitle(title) id = entry[entry.find('chid=\\"')+7:] id = id[:id.find('\\"')] match=re.compile("preload='(.+?)'", re.DOTALL).findall(entry) thumb=match[0] if tvMode==True: addLink(title,id,'playAll',thumb) else: addDir(title,id,'listVideos',thumb) xbmcplugin.endOfDirectory(pluginhandle) if forceViewMode==True: xbmc.executebuiltin('Container.SetViewMode('+viewMode+')')
def build_main_directory(): main=[ ( settings.getLocalizedString(30000), search_thumb, '0' ), ( settings.getLocalizedString(30001), film_reel_thumb, '1' ), ( settings.getLocalizedString(30002), clapperboard_thumb, '2' ), ( settings.getLocalizedString(30003), oscar_thumb, '3' ), ( settings.getLocalizedString(30004), popcorn_thumb, '6' ), ( settings.getLocalizedString(30015), library_thumb, '7' ) ] for name, thumbnailImage, mode in main: listitem = xbmcgui.ListItem( label = name, iconImage = "DefaultVideo.png", thumbnailImage = thumbnailImage ) u = { 'mode': mode, 'name': name } addListItem(label = name, image = thumbnailImage, url = u, isFolder = True, totalItems = 0, infoLabels = False) data = getUrl( 'http://www.traileraddict.com' ) url_thumb_x_title = re.compile( '<a href="/trailer/(.+?)"><img src="(.+?)" border="0" alt="(.+?)" title="(.+?)" style="margin:2px 10px 8px 10px;">' ).findall( data ) totalItems = len(url_thumb_x_title) for url, thumb, x, title in url_thumb_x_title: title = title.rsplit( ' - ' ) name1 = clean( title[0] ) if len( title ) > 1: name2 = clean( title[0] ) + ' (' + clean( title[1] ) + ')' else: name2 = clean( title[0] ) url = 'http://www.traileraddict.com/trailer/' + url thumb = 'http://www.traileraddict.com' + thumb cm = [] run = sys.argv[0] + '?' + urllib.urlencode({ 'mode': '5', 'name': name2, 'url': url, 'download': 'True' }) cm.append( (settings.getLocalizedString(30059), "XBMC.RunPlugin(%s)" % run) ) cm.append( (settings.getLocalizedString(30014), "XBMC.RunPlugin(plugin://plugin.video.couchpotato_manager/movies/add?title=%s)" % name1) ) u = { 'mode': '5', 'name': name2, 'url': url } addListItem(label = name1, image = thumb, url = u, isFolder = False, totalItems = totalItems, infoLabels = False, cm = cm) xbmcplugin.addSortMethod( handle = int(sys.argv[1]), sortMethod = xbmcplugin.SORT_METHOD_NONE ) setViewMode("500", "movies") xbmcplugin.endOfDirectory( int( sys.argv[1] ) )
def schedule247(): import datetime import time i = datetime.datetime.now() day,month,year=i.day, i.month, i.year s="%s/%s/%s"%(day,month,year) time=time.mktime(datetime.datetime.strptime(s, "%d/%m/%Y").timetuple()) time=str(time).replace('.0','')+'000' url='https://tockify.com/api/readEventView?calname=pilkalive&max=30&start-inclusive=true&startms='+time txt=json.loads(read_url(url)) events=txt['events'] for i in range (len(events)): time=events[i]['when']['start']['millis'] time=str(time)[:-3] event=events[i]['content']['summary']['text'] link=events[i]['content']['description']['text'] ts = datetime.datetime.fromtimestamp(float(time)) year,month,day,hour,minute=ts.strftime('%Y'),ts.strftime('%m'),ts.strftime('%d'),ts.strftime('%H'),ts.strftime('%M') from utils import pytzimp d = pytzimp.timezone(str(pytzimp.timezone('Europe/Madrid'))).localize(datetime.datetime(2000 + int(year), int(month), int(day), hour=int(hour), minute=int(minute))) timezona= addon.get_setting('timezone_new') my_location=pytzimp.timezone(pytzimp.all_timezones[int(timezona)]) convertido=d.astimezone(my_location) fmt = "%d-%m-%y [COLOR green]%H:%M[/COLOR]" time=convertido.strftime(fmt) event=event[5:] title='([COLOR blue][B]%s[/B][/COLOR]) [B][COLOR orange]%s[/COLOR][/B]'%(time,event) url = build_url({'mode': 'open_247_event','url':link}) li = xbmcgui.ListItem(title,iconImage='') xbmcplugin.addDirectoryItem(handle=addon_handle, url=url, listitem=li, isFolder=True) xbmcplugin.endOfDirectory(addon_handle)
def build_featured_directory( page ): save_page = page data = getUrl( 'http://www.traileraddict.com/attraction/' + str( int( page ) + 1) ) url_thumb_x_title = re.compile( '<a href="/trailer/(.+?)"><img src="(.+?)" border="0" alt="(.+?)" title="(.+?)" style="margin:8px 5px 2px 5px;"></a>' ).findall( data ) totalItems = len(url_thumb_x_title) for url, thumb, x, title in url_thumb_x_title: title = title.rsplit( ' - ' ) name1 = clean( title[0] ) if len( title ) > 1: name2 = clean( title[0] ) + ' (' + clean( title[1] ) + ')' else: name2 = clean( title[0] ) url = 'http://www.traileraddict.com/trailer/' + url thumb = 'http://www.traileraddict.com' + thumb cm = [] run = sys.argv[0] + '?' + urllib.urlencode({ 'mode': '5', 'name': name2, 'url': url, 'download': 'True' }) cm.append( (settings.getLocalizedString(30059), "XBMC.RunPlugin(%s)" % run) ) cm.append( (settings.getLocalizedString(30014), "XBMC.RunPlugin(plugin://plugin.video.couchpotato_manager/movies/add?title=%s)" % name1) ) u = { 'mode': '5', 'name': name2, 'url': url } addListItem(label = name1, image = thumb, url = u, isFolder = False, totalItems = totalItems, infoLabels = False, cm = cm) u = { 'mode': '6', 'page': str( int( save_page ) + 1 ) } addListItem(label = '[ Next Page (' + str( int( save_page ) + 2 ) + ') ]', image = next_thumb, url = u, isFolder = True, totalItems = 0, infoLabels = False) xbmcplugin.addSortMethod( handle = int(sys.argv[1]), sortMethod = xbmcplugin.SORT_METHOD_NONE ) setViewMode("500", "movies") xbmcplugin.endOfDirectory( int( sys.argv[1] ) )
def listsHistory(self, table): for i in range(len(table)): if table[i] <> '': self.addDir(SERVICE, table[i], 'history', table[i], 'None', logoUrl, 'None', True, False) xbmcplugin.endOfDirectory(int(sys.argv[1]))
except: pass try: description = urllib.unquote_plus(params["description"]) except: pass print str(PATH) + ': ' + str(VERSION) print "Mode: " + str(mode) print "URL: " + str(url) print "Name: " + str(name) print "IconImage: " + str(iconimage) 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)) if mode == None or url == None or len(url) < 1: CATEGORIES() elif mode == 1: wizard(name, url, description) xbmcplugin.endOfDirectory(int(sys.argv[1]))
def main(): add_video_item( 'http://wpc.C1A9.edgecastcdn.net/hls-live/20C1A9/kurdsat/ls_satlink/b_528.m3u8', {'title': 'KurdSat TV'}, icons + 'kurdsat-tv.png') add_video_item('rtmp://68.168.105.117/live//livestream', {'title': 'KurdSat News'}, icons + 'kurdsat-news-tv.png') add_video_item('rtmp://84.244.187.12/live/livestream', {'title': 'Kurdistan TV'}, icons + 'kurdistan-tv.png') add_video_item( 'http://198.100.158.231:1935/kanal10/_definst_/livestream/playlist.m3u8', {'title': 'Zagros TV'}, icons + 'zagros-tv.png') add_video_item( 'http://prxy-wza-02.iptv-playoutcenter.de/nrt1/nrt1.stream_1/jwplayer.m3u8', {'title': 'NRT TV HD'}, icons + 'nalia-tv.png') add_video_item( 'rtmp://prxy-wza-02.iptv-playoutcenter.de/nrt2/_definst_/mp4:nrt2.stream_1', {'title': 'Nalia 2 TV HD'}, icons + 'nalia-2-tv.png') add_video_item('rtsp://livestreaming.itworkscdn.net/rudawlive/rudawtv', {'title': 'Rudaw TV'}, icons + 'rudaw.png') add_video_item('rtmp://46.163.68.239/live/livestream', {'title': 'KNN TV'}, icons + 'knn-tv.png') add_video_item('rtmp://64.150.177.45/live//mp4:myStream', {'title': 'Geli Kurdistan'}, icons + 'geli-kurdistan-tv.png') add_video_item('http://38.99.146.181:7777/KorekTV.m3u8', {'title': 'Korek TV'}, icons + 'korek-tv.png') add_video_item( 'http://live.kurdstream.net:1935/liveTrans//myStream_360p/playlist.m3u8', {'title': 'Kurd MAX TV'}, icons + 'kurdmax-tv.png') add_video_item('http://38.99.146.181:7777/Kanal4.m3u8', {'title': 'Kanal 4'}, icons + 'kanal4.png') add_video_item('rtsp://amozhgary-tv.karwan.tv:1935/live/livestream', {'title': 'Amozhgary TV'}, icons + 'amozhgary-tv.png') add_video_item('http://63.237.48.23/ios/GEM_KURD/GEM_KURD.m3u8', {'title': 'GEM Kurd TV'}, icons + 'gem-kurd-tv.png') add_video_item('http://162.244.81.103:1935/RegaTV/myStream/playlist.m3u8', {'title': 'REGA TV'}, icons + 'rega-tv.png') add_video_item('http://38.99.146.181:7777/VINTV.m3u8', {'title': 'Vin TV'}, icons + 'vin-tv.png') add_video_item( 'http://198.100.158.231:1935/kanal3/_definst_/livestream/playlist.m3u8', {'title': 'Newroz TV'}, icons + 'newroz-tv.png') add_video_item( 'http://198.100.158.231:1935/kanal2/_definst_/livestream/playlist.m3u8', {'title': 'WAAR TV'}, icons + 'waar-tv.png') add_video_item('', {'title': 'WAAR Sport TV'}, icons + 'waar-sport-tv.png') add_video_item( 'http://198.100.158.231:1935/kanal16/_definst_/livestream/playlist.m3u8', {'title': 'Ronahi TV'}, icons + 'ronahi-tv.png') add_video_item('rtmp://sepidehlive.nanocdn.com:1935/live/sepideh256', {'title': 'Speda TV'}, icons + 'speda-tv.png') add_video_item('http://cofafrw181.glwiz.com:7777/Cira.m3u8', {'title': 'Cira TV'}, icons + 'cira-tv.png') add_video_item('rtmp://payamlive.nanocdn.com/live/payam256', {'title': 'Payam TV'}, icons + 'payam-tv.png') add_video_item('http://cofafrw181.glwiz.com:7777/KurdChannel.m3u8', {'title': 'KM TV'}, icons + 'kmtv.png') add_video_item('http://cofafrw181.glwiz.com:7777/Pelistank.m3u8', {'title': 'PELISTANK TV'}, icons + 'pelistank-tv.png') add_video_item( 'http://live.kurdstream.net:1935/liveTrans/Pepule_360p/playlist.m3u8', {'title': 'KurdMax Pepule TV'}, icons + 'kurdmax-tv.png') add_video_item( 'http://balgurup.garantisistem.com:1935/Super_Tv/Super_Tv/playlist.m3u8', {'title': 'Super TV'}, icons + 'super-tv.png') add_video_item('rtmp://37.77.2.236/liveedge/live', {'title': 'Halk TV'}, icons + 'halk-tv.png') add_video_item( 'rtmp://gemtv.fms.visionip.tv/live/gemtv-gemtv-kurd-live-25f-4x3-SD', {'title': 'ABN Sat TV'}, icons + 'abn-sat-tv.PNG') add_video_item( 'http://origin.live.web.tv.streamprovider.net/streams/e3490d55c5dfc38e758ade69815cd9ef_live_0_0/index.m3u8', {'title': 'JIYAN TV'}, icons + 'Jiyan-T.png') add_video_item('', {'title': 'Tishk TV'}, icons + 'tishk-tv.png') add_video_item( 'http://198.100.158.231:1935/kanal16/_definst_/livestream/playlist.m3u8', {'title': 'Rojhelat TV'}, icons + 'rojhelat.png') add_video_item( 'http://198.100.158.231:1935/kanal8/_definst_/livestream/playlist.m3u8', {'title': 'Komala TV'}, icons + 'komala-tv.png') add_video_item('rtmp://50.7.129.202:1935/batmantv<playpath>batmantv', {'title': 'Batman TV Express offlien now'}, icons + 'batman-tv-express.png') add_video_item( 'http://198.100.158.231:1935/kanal17/_definst_/livestream/playlist.m3u8', {'title': 'IMC TV'}, icons + 'imc-tv.png') add_video_item( 'http://198.100.158.231:1935/kanal11/_definst_/livestream/playlist.m3u8', {'title': 'MED Nuce TV'}, icons + 'med-nuce-tv.png') add_video_item( 'http://198.100.158.231:1935/kanal6/_definst_/livestream/playlist.m3u8', {'title': 'Sterk TV'}, icons + 'sterk-tv.png') add_video_item( 'http://198.100.158.231:1935/kanal14/_definst_/livestream/playlist.m3u8', {'title': 'MED Muzik TV'}, icons + 'med-muzik-tv.png') add_video_item('rtmp://balgurup.garantisistem.com/Damla_Tv/Damla_Tv', {'title': 'Damla TV'}, icons + 'damla-tv.png') add_video_item( 'http://198.100.158.231:1935/kanal1/_definst_/livestream/playlist.m3u8', {'title': 'TV 10'}, icons + 'tv-10.png') add_video_item('rtmp://178.254.20.205:2100/yol//yolstream', {'title': 'Yol TV'}, icons + 'yol-tv.png') add_video_item('rtmp://yayin3.canlitv.com/live/dengetv', {'title': 'Denge TV'}, icons + 'denge-tv.png') add_video_item('http://guntv.mediatriple.net/guntv/guntv2/Playlist.m3u8', {'title': 'Özgür Gün Tv'}, icons + 'ozgur-gun-tv-canli.png') add_video_item( 'rtmp://live1.karwan.tv/falcon-eye-tv1//falcon-eye-tv1.stream', {'title': 'Falcon Eye TV offlien now'}, icons + 'falcon-eye-tv.png') add_video_item('rtmp://kurd-live.com/live/cihan', {'title': 'Cihan TV'}, icons + 'cihan-tv') add_video_item('http://38.99.146.181:7777/AzadiTV.m3u8', {'title': 'Azadi TV TV'}, icons + 'azadi-tv') add_video_item('http://cofafrw181.glwiz.com:7777/Badinan.m3u8', {'title': 'Badinan Sat TV'}, icons + 'badinan-sat-tv') add_video_item('http://cofafrw181.glwiz.com:7777/Jamawar.m3u8', {'title': 'Jamawar TV '}, icons + 'jamawar-tv') add_video_item( 'http://origin2.live.web.tv.streamprovider.net/streams/894b55a9a7fa8f9b20da735e2112b034/index.m3u8', {'title': 'Havin TV '}, icons + 'havin-tv') add_video_item( 'http://origin.live.web.tv.streamprovider.net//streams//d9d7ee96913217bbc757f40d4de65c29_live_0_0//index.m3u8', {'title': 'Van TV'}, icons + 'van-tv') add_video_item( 'http://origin.live.web.tv.streamprovider.net//streams//8afa5b0b23429365abd7dbbb4ba22326_live_0_0//index.m3u8', {'title': 'HAYAT TV '}, icons + 'hayat-tv') add_video_item( 'http://origin2.live.web.tv.streamprovider.net//streams//894b55a9a7fa8f9b20da735e2112b034//index.m3u8', {'title': 'Havin TV'}, icons + 'havin-tv') add_video_item( 'http://origin.live.web.tv.streamprovider.net//streams//04c042818579efb61acf6a75e6a02774//index.m3u8', {'title': 'Govend TV '}, icons + 'govend-tv') add_video_item( 'http://live.kurdstream.net:1935/liveTrans/Pepule_360p/playlist.m3u8', {'title': 'KurdMax Pepûle TV '}, icons + 'kurdmax-pepule-tv') add_video_item('http://38.99.146.181:7777/KirkukTV.m3u8', {'title': 'KIRKÛK TV ZINDÎ'}, icons + 'kirkuk-tv') add_video_item('rtmp://si.trtcdn.com/tv/trt6/mp4:trt6_3', {'title': 'TRT 6'}, icons + 'trt6-tv') # add_video_item('' ,{ 'title': ''}, icons + '') # add_video_item('' ,{ 'title': ''}, icons + '') # add_video_item('' ,{ 'title': ''}, icons + '') # add_video_item('' ,{ 'title': ''}, icons + '') xbmcplugin.endOfDirectory(plugin_handle)
'User-Agent', 'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-GB; rv:1.9.0.3) Gecko/2008092417 Firefox/3.0.3' ) response = urllib2.urlopen(req, timeout=100) link = response.read() response.close() return link print "checkMode: " + str(mode) print "URL: " + str(url) print "Name: " + str(name) if mode == None or url == None or len(url) < 1: #print "" CATEGORIES() elif mode == 4: INDEXSratim(url) elif mode == 5: LinksPage(url) elif mode == 8: Series(url) elif mode == 18: searchInSeretil() elif mode == 211: SpecialPage(url) elif mode == 212: ResolverLink(url) xbmcplugin.endOfDirectory(int(sys.argv[1]), cacheToDisc=True)
def MainMenu(): #homescreen addon.add_directory( { 'mode': 'GetTitles', 'section': 'ALL', 'url': BASE_URL + '/tv/', 'startPage': '1', 'numOfPages': '1' }, {'title': '[COLOR blue]Latest Tv shows >>[/COLOR]'}, img=IconPath + 'tv.png') addon.add_directory( { 'mode': 'GetTitles', 'section': 'ALL', 'url': BASE_URL + '/tv/dvd/', 'startPage': '1', 'numOfPages': '1' }, {'title': 'Full Tv series >>'}, img=IconPath + 'tv.png') addon.add_directory( { 'mode': 'GetTitles', 'section': 'ALL', 'url': BASE_URL + '/tv/sports-tv/', 'startPage': '1', 'numOfPages': '1' }, {'title': 'Tv sports >>'}, img=IconPath + 'tv.png') addon.add_directory( { 'mode': 'GetTitles', 'section': 'ALL', 'url': BASE_URL + '/tv/ppv/', 'startPage': '1', 'numOfPages': '1' }, {'title': 'Tv ppv >>'}, img=IconPath + 'tv.png') addon.add_directory( { 'mode': 'GetTitles', 'section': 'ALL', 'url': BASE_URL + '/films/', 'startPage': '1', 'numOfPages': '1' }, {'title': '[COLOR blue]Latest Movies >>[/COLOR]'}, img=IconPath + 'movie.png') addon.add_directory( { 'mode': 'GetTitles', 'section': 'ALL', 'url': BASE_URL + '/films/dvdrip/', 'startPage': '1', 'numOfPages': '1' }, {'title': 'DVDRip Movies >>'}, img=IconPath + 'movie.png') addon.add_directory( { 'mode': 'GetTitles', 'section': 'ALL', 'url': BASE_URL + '/films/dvdscr/', 'startPage': '1', 'numOfPages': '1' }, {'title': 'DVDScr Movies >>'}, img=IconPath + 'movie.png') addon.add_directory( { 'mode': 'GetTitles', 'section': 'ALL', 'url': BASE_URL + '/films/bdrip/', 'startPage': '1', 'numOfPages': '1' }, {'title': 'BDRip Movies >>'}, img=IconPath + 'movie.png') addon.add_directory( { 'mode': 'GetTitles', 'section': 'ALL', 'url': BASE_URL + '/films/bluray/', 'startPage': '1', 'numOfPages': '1' }, {'title': 'Bluray Movies >>'}, img=IconPath + 'movie.png') addon.add_directory( { 'mode': 'GetTitles', 'section': 'ALL', 'url': BASE_URL + '/films/bdscr/', 'startPage': '1', 'numOfPages': '1' }, {'title': 'BDScr Movies >>'}, img=IconPath + 'movie.png') addon.add_directory( { 'mode': 'GetTitles', 'section': 'ALL', 'url': BASE_URL + '/films/scr/', 'startPage': '1', 'numOfPages': '1' }, {'title': 'Scr Movies >>'}, img=IconPath + 'movie.png') addon.add_directory( { 'mode': 'GetTitles', 'section': 'ALL', 'url': BASE_URL + '/films/r5/', 'startPage': '1', 'numOfPages': '1' }, {'title': 'R5 Movies >>'}, img=IconPath + 'movie.png') addon.add_directory( { 'mode': 'GetTitles', 'section': 'ALL', 'url': BASE_URL + '/films/hd/', 'startPage': '1', 'numOfPages': '1' }, {'title': 'HD Movies >>'}, img=IconPath + 'movie.png') addon.add_directory({'mode': 'GetSearchQuery'}, {'title': '[COLOR green]Search[/COLOR]'}, img=IconPath + 'search.png') addon.add_directory({'mode': 'ResolverSettings'}, {'title': '[COLOR red]Resolver Settings[/COLOR]'}, img=IconPath + 'settings.png') addon.add_directory({'mode': 'Help'}, { 'title': '[COLOR pink]FOR HELP ON THIS ADDON PLEASE GOTO...[/COLOR] [COLOR gold][B][I]www.xbmchub.com[/B][/I][/COLOR]' }, img=IconPath + 'help.png') xbmcplugin.endOfDirectory(int(sys.argv[1]))
def end_of_directory(cache_to_disc=True): xbmcplugin.endOfDirectory(int(sys.argv[1]), cacheToDisc=cache_to_disc)
def listsMainMenu(self, table): for num, val in table.items(): self.addDir(SERVICE, 'main-menu', val, '', '', '', logoUrl, True, False) xbmcplugin.endOfDirectory(int(sys.argv[1]))
def close_item_list(): _log("close_item_list") xbmcplugin.endOfDirectory(handle=int(sys.argv[1]), succeeded=True)
groulist.append(gruppe) xbmcplugin.endOfDirectory(addon_handle,succeeded=True,updateListing=False,cacheToDisc=True) params = parameters_string_to_dict(sys.argv[2]) mode = urllib.unquote_plus(params.get('mode', '')) url = urllib.unquote_plus(params.get('url', '')) # Haupt Menu Anzeigen if mode is '': addDir(translation(30001), translation(30001), "TV","") addDir(translation(30002), translation(30002), "Radio","") addDir(translation(30004), translation(30004), "sprache","") addDir(translation(30003), translation(30003), "ALL","") xbmcplugin.endOfDirectory(addon_handle,succeeded=True,updateListing=False,cacheToDisc=True) else: # Wenn Settings ausgewählt wurde if mode == 'Settings': addon.openSettings() # Wenn Kategory ausgewählt wurde if mode == 'TV': llist('radio=""') if mode == 'Gruppe': llist('group-title="'+ url+'"') if mode == 'Radio': llist('radio="true"') if mode == 'ALL': llist('') if mode == "playstream": playstream(url)
def listVideos(url): debug("URL :" + url) content = getUrl(url) #http://tele5.flowcenter.de/gg/play/l/17:pid=vplayer_1560&tt=1&se=1&rpl=1&ssd=1&ssp=1&sst=1&lbt=1& y = 0 try: lid, pid, tt, se, rpl, ssd, ssp, sst, lbt = re.compile( '<div class="fwlist" lid="(.+?)" pid="(.+?)" tt="(.+?)" se="(.+?)" rpl="(.+?)" ssd="(.+?)" ssp="(.+?)" sst="(.+?)" lbt="(.+?)" >', re.DOTALL).findall(content)[0] url = "http://tele5.flowcenter.de/gg/play/l/" + lid + ":pid=" + pid + "&tt=" + tt + "&se=" + se + "&rpl=" + rpl + "&ssd=" + ssd + "&ssp=" + ssp + "&sst=" + sst + "&lbt=" + lbt + "&" except: try: lid, pid, se, rpl, ssd, ssp, sst, lbt, oh = re.compile( '<div class="fwlist" lid="(.+?)" pid="(.+?)" se="(.+?)" rpl="(.+?)" ssd="(.+?)" ssp="(.+?)" sst="(.+?)" lbt="(.+?) oh="(.+?)" >', re.DOTALL).findall(content)[0] url = "http://tele5.flowcenter.de/gg/play/l/" + lid + ":pid=" + pid + "&oh=" + oh + "&se=" + se + "&rpl=" + rpl + "&ssd=" + ssd + "&ssp=" + ssp + "&sst=" + sst + "&lbt=" + lbt + "&" except: cid = re.compile('<div class="fwplayer" cid="(.+?)" >', re.DOTALL).findall(content)[0] img = re.compile('<img style="width:100%;" src="(.+?)"', re.DOTALL).findall(content)[0] addLink(translation(30002), str(cid), 'playVideo', img) #playVideo(cid) y = 1 if y == 0: debug("NEWURL: " + url) content = getUrl(url) content = re.compile('\{(.+)\}', re.DOTALL).findall(content)[0] content = re.compile('\{(.+)\}', re.DOTALL).findall(content)[0] content = "{" + content + "}" debug("CONTENT:") debug(content) struktur = json.loads(content) Entries = struktur["entries"] for element in Entries: staffel = element["staffel"] folge = element["folge"] utitle = element["utitel"].strip() title = element["title"].strip() id = element["id"] data = element["vodate"] genre = element["welt"] image = element["image"].replace("\/", "/") if folge == "0": name = title else: name = "Folge " + folge if not utitle == "": name = name + " - " + utitle addLink(name, str(id), 'playVideo', image, dadd=data, genre=genre, episode=folge, season=staffel) #addLink("Folge :"+ folge , str(id), 'playVideo', image) # addLink(h.unescape(title[i]), url, 'playVideo', thumb[i]) xbmcplugin.endOfDirectory(pluginhandle)
def getVideos(self): # # Init # # Create a list for our items. listing = [] # # Get HTML page... # response = requests.get(self.video_list_page_url) html_source = response.text html_source = html_source.encode('utf-8', 'ignore') # for roosterteeth # <li> # <a href="http://www.roosterteeth.com/show/red-vs-blue"> # <div class="block-container"> # <div class="image-container"> # <img src="//s3.amazonaws.com/cdn.roosterteeth.com/uploads/images/9a888611-5b17-49ab-ad49-ca0ad6a86ee1/sm/rvb600.jpg" alt="Red vs. Blue"> # </div> # </div> # <p class="name">Red vs. Blue</p> # <p class="post-stamp">13 seasons | 377 episodes</p> # </a> # </li> # for achievementhunter # <li> # <a href="http://achievementhunter.roosterteeth.com/show/off-topic-the-achievement-hunter-podcast"> # <div class="block-container"> # <div class="image-container"> # <img src="//s3.amazonaws.com/cdn.roosterteeth.com/uploads/images/65924ffb-2ca9-407d-bbd9-b717ed944f75/sm/2013912-1446152735286-Off_Topic_1400x_Logo.jpg" alt="Off Topic"> # </div> # </div> # <p class="name">Off Topic</p> # <p class="post-stamp">2 seasons | 30 episodes</p> # </a> # </li> # Parse response... soup = BeautifulSoup(html_source) shows = soup.findAll('li') xbmc.log( "[ADDON] %s v%s (%s) debug mode, %s = %s" % (ADDON, VERSION, DATE, "len(shows)", str(len(shows))), xbmc.LOGDEBUG) for show in shows: # Skip the show if it contains /episode/ # <li class="upcoming-featured"> # <a href="http://roosterteeth.com/episode/ahwu-2016-memorial-day-ahwu-for-may-30-th-2016-319"> # <div class="block-container"> # <p class="air-date">Today, 5/30</p> # <p class="air-time">2:00 pm CDT</p> # <p class="air-countdown">Starting 2 hours from now</p> # <div class="image-container"> # <img src="//s3.amazonaws.com/cdn.roosterteeth.com/uploads/images/3dad2181-68ed-46dc-87dd-3c80bc4bef9e/sm/2013912-1464386396337-ahwu_thumb.jpg"> # </div> # <p class="name"> # <strong>AHWU:</strong> Memorial Day! – AHWU for May 30th , 2016 (#319) # </p> # </div> # </a> # </li> if str(show).find("/episode/") < 0: pass else: xbmc.log( "[ADDON] %s v%s (%s) debug mode, %s = %s" % (ADDON, VERSION, DATE, "skipped /episode/ show ", str(show)), xbmc.LOGDEBUG) continue # Skip a show if it does not contain class="name" pos_classname = str(show).find('class="name"') if pos_classname < 0: xbmc.log( "[ADDON] %s v%s (%s) debug mode, %s = %s" % (ADDON, VERSION, DATE, 'skipped show without class="name"', str(show)), xbmc.LOGDEBUG) continue url = show.a['href'] try: thumbnail_url = "https:" + show.img['src'] except: thumbnail_url = '' title = show.a.text if title == '': try: title = show.img['alt'] except: title = 'Unknown Show Name' # Add to list... list_item = xbmcgui.ListItem(label=title, thumbnailImage=thumbnail_url) list_item.setArt({ 'thumb': thumbnail_url, 'icon': thumbnail_url, 'fanart': os.path.join(IMAGES_PATH, 'fanart-blur.jpg') }) list_item.setProperty('IsPlayable', 'false') parameters = { "action": "list-episodes", "show_name": title, "url": url, "next_page_possible": "False", "title": title } url = self.plugin_url + '?' + urllib.urlencode(parameters) is_folder = True # Add refresh option to context menu list_item.addContextMenuItems([('Refresh', 'Container.Refresh')]) # Add our item to the listing as a 3-element tuple. listing.append((url, list_item, is_folder)) # Add our listing to Kodi. # Large lists and/or slower systems benefit from adding all items at once via addDirectoryItems # instead of adding one by ove via addDirectoryItem. xbmcplugin.addDirectoryItems(self.plugin_handle, listing, len(listing)) # Disable sorting xbmcplugin.addSortMethod(handle=self.plugin_handle, sortMethod=xbmcplugin.SORT_METHOD_NONE) # Finish creating a virtual folder. xbmcplugin.endOfDirectory(self.plugin_handle)
if mode == 'index': Index(url) elif mode == 'seriesbycountry': SeriesByCountry() elif mode == 'moviesbycategory': MoviesByCategory() elif mode == 'bycountry': ByCountry() elif mode == 'byyear': ByYear() elif mode == 'search': Search() elif mode=='mirrors': Mirrors(url, iconimage, vname) elif mode=='episodes': Episodes(url, name, iconimage, vname) elif mode=='loadvideo': dialogWait = xbmcgui.DialogProgress() dialogWait.create('XemPhimMienPhi', 'Đang tải. Xin chờ...') try: LoadVideos(url, vname) except: xbmcgui.Dialog().ok('Xin lỗi', 'Nguồn phim hiện không xem được', 'Xin vui lòng thử nguồn khác') dialogWait.close() del dialogWait else: Home() xbmcplugin.endOfDirectory(int(sysarg))
def Main(): utils.addDir('[COLOR hotpink]Category[/COLOR]', siteurl, 755, '', '') utils.addDir('[COLOR hotpink]Search[/COLOR]', siteurl + '/?s=', 754, '', '') List(siteurl) xbmcplugin.endOfDirectory(utils.addon_handle)
def list_content(session_url, session_name): _api_manager.login(_ADDON.getSetting("username"), _ADDON.getSetting("password")) # Set plugin category. It is displayed in some skins as the name # of the current section. xbmcplugin.setPluginCategory(_handle, session_name) # Set plugin content. It allows Kodi to select appropriate views # for this type of content. xbmcplugin.setContent(_handle, 'videos') # Get video categories session = _api_manager.getSession(session_url) print(session) for channel in session['channel_urls']: thumb = '' try: if len(channel['driver_urls']) > 0: for image in channel['driver_urls'][0]['image_urls']: if image['type'] == 'Headshot': thumb = image['url'] break except: pass for image in session['image_urls']: if image['type'] == 'Thumbnail': thumb = image['url'] break # Create a list item with a text label and a thumbnail image. channel = _api_manager.getAnyOldURL(channel) name = channel['name'] if 'WIF' not in channel['name'] else session[ 'session_name'] list_item = xbmcgui.ListItem(label=name) list_item.setArt({'thumb': thumb, 'icon': thumb, 'fanart': thumb}) list_item.setInfo('video', { 'title': name, 'genre': "Motorsport", 'mediatype': 'video' }) url = get_url(action='playContent', content_url=channel['self']) list_item.setProperty('IsPlayable', 'true') is_folder = False # Add our item to the Kodi virtual folder listing. xbmcplugin.addDirectoryItem(_handle, url, list_item, is_folder) for content in session['content_urls']: content = _api_manager.getAnyOldURL(content) thumb = '' for image in content['image_urls']: thumb = image break # Create a list item with a text label and a thumbnail image. list_item = xbmcgui.ListItem(label=content['title']) list_item.setArt({'thumb': thumb, 'icon': thumb, 'fanart': thumb}) list_item.setInfo('video', { 'title': content['title'], 'genre': "Motorsport", 'mediatype': 'video' }) list_item.setProperty('IsPlayable', 'true') if len(content['items']) > 0: url = get_url(action='playContent', content_url=content['items'][0]) is_folder = False # Add our item to the Kodi virtual folder listing. xbmcplugin.addDirectoryItem(_handle, url, list_item, is_folder) # Add a sort method for the virtual folder items (alphabetically, ignore articles) xbmcplugin.addSortMethod(_handle, xbmcplugin.SORT_METHOD_UNSORTED) # Finish creating a virtual folder. xbmcplugin.endOfDirectory(_handle)
def listVideos(url): xbmcplugin.setContent(pluginhandle, "movies") content = getUrl(url) if '<div class="core_info_snb' in content: splitStr = '<div class="core_info_snb' elif 'class="compact_info_snb' in content: splitStr = 'class="compact_info_snb' spl = content.split(splitStr) for i in range(1, len(spl), 1): entry = spl[i] match = re.compile('href="(.+?)"', re.DOTALL).findall(entry) url = match[0] match = re.compile('data-product_name="(.+?)"', re.DOTALL).findall(entry) match2 = re.compile('title="(.+?)"', re.DOTALL).findall(entry) if match: title = match[0] elif match2: title = match2[0] title = cleanTitle(title) match = re.compile('<div class="synopsis "><p>(.+?)<', re.DOTALL).findall(entry) desc = "" if match: desc = match[0] match = re.compile('<span class="release_decade">(.+?)</span>', re.DOTALL).findall(entry) year = "" if match: year = match[0].strip() match = re.compile('data-current_rating="(.+?)"', re.DOTALL).findall(entry) rating = "" if match: rating = match[0] + " / 5" match = re.compile('src="(.+?)"', re.DOTALL).findall(entry) thumb = match[0].replace("_UX140_CR0,0,140", "_UX500").replace( "_UR140,105", "_UX500").replace("_UR77,109", "_UX500") if rating: desc = "Year: " + year + "\nRating: " + rating + "\n" + desc else: desc = "Year: " + year + "\n" + desc if baseUrl + "/tv/" in url: addDir(title, url, 'listEpisodes', thumb, desc) else: if os.path.exists(lfPlayerPath): addDir(title, url, 'playVideoPlayer', thumb, desc) else: addDir(title, url, 'playVideoBrowser', thumb, desc) content = content[content.find('<span class="page_selected">'):] content = content[:content.find('</ul>')] match = re.compile('<a href="(.+?)" >(.+?)</a>', re.DOTALL).findall(content) urlNext = "" for url, title in match: if "chste" in title: urlNext = url if urlNext: addDir(translation(30001), urlNext + "?v=l&r=50", "listVideos", "") xbmcplugin.endOfDirectory(pluginhandle) if forceViewMode: xbmc.executebuiltin('Container.SetViewMode(' + viewMode + ')')
def list_videos(current_url, current_category, current_page): url = None navParam = None listing = [] if current_category == 'browse': navParam = '#p_date=' + current_page + '&isAJAXrequest=1&tabToShow=TAB_0&' elif current_category == 'search': navParam = '#p_uni=' + current_page url = '{0}?action=open&categoryName={1}'.format(_url, 'search') is_folder = True listing.append((url, get_list_item('Search', 'none', is_folder), is_folder)) if int(current_page) != 1: url = current_url + navParam else: url = current_url xbmc.log(msg='url=' + url, level=xbmc.LOGNOTICE) response = urllib2.urlopen(url) html = response.read() parsed = BeautifulSoup(html, 'html.parser') current_last_page = get_last_page(parsed) menu_item_list = [] for link in parsed.find_all('div'): if (link.get('class') != None): if ("item_inner" in link.get('class')): obj = MenuItem(get_title(link), get_thumb(link), get_duration(link), get_uploader(link)) menu_item_list.append(obj) url = '{0}'.format(_url) is_folder = True listing.append((url, get_list_item('Back to main menu', 'none', is_folder), is_folder)) if current_last_page != None: if current_last_page > 1 and int(current_page) != current_last_page: label = 'Next page ' + \ str(int(current_page) + 1) + '/' + str(current_last_page) url = '{0}?action=nav&url={1}&category={2}&page={3}'.format( _url, current_url, current_category, str(int(current_page) + 1)) is_folder = True listing.append((url, get_list_item(label, 'none', is_folder), is_folder)) if current_last_page > 1 and int(current_page) > 1: label = 'Prev page ' + \ str(int(current_page) - 1) + '/' + str(current_last_page) url = '{0}?action=nav&url={1}&category={2}&page={3}'.format( _url, current_url, current_category, str(int(current_page) - 1)) is_folder = True listing.append((url, get_list_item(label, 'none', is_folder), is_folder)) for menu_item in menu_item_list: url = '{0}?action=play&videoName={1}'.format(_url, menu_item.title) is_folder = False listing.append( (url, get_list_item(menu_item.title, 'http:' + menu_item.thumb, is_folder), is_folder)) xbmcplugin.addDirectoryItems(_handle, listing, len(listing)) xbmcplugin.addSortMethod(_handle, xbmcplugin.SORT_METHOD_NONE) xbmcplugin.endOfDirectory(_handle)
def list_categories(): """Display the list of video categories from Giant Bomb.""" if my_addon.getSetting('first_run') == 'true': if not my_addon.getSetting('api_key'): link_account(first_run=True) my_addon.setSetting('first_run', 'false') data = gb.query('video_types') # Count up the total number of categories; add one for "Latest" and one # more for "Search". total = data['number_of_total_results'] + 2 live_data = gb.query('video/current-live') if live_data.get('video') is not None: total += 1 name = "LIVE: " + live_data['video']['title'] url = live_data['video']['stream'] thumb = "https://" + live_data['video']['image'] li = xbmcgui.ListItem(name, iconImage='DefaultVideo.png', thumbnailImage=thumb) li.setProperty('IsPlayable', 'true') li.setProperty('fanart_image', my_addon.getAddonInfo('fanart')) xbmcplugin.addDirectoryItem(handle=addon_id, url=url, listitem=li, totalItems=total) # Add Giant Bomb Infinite total += 1 name = "Giant Bomb Infinite" url = "plugin://plugin.video.twitch/?mode=play&channel_name=giantbomb8" thumbnail = xbmc.translatePath( 'special://home/addons/{0!s}/infinite.png'.format( xbmcaddon.Addon().getAddonInfo('id'))).decode('utf-8') li = xbmcgui.ListItem(name, iconImage='DefaultVideo.png', thumbnailImage=thumbnail) li.setProperty('IsPlayable', 'true') li.setProperty('fanart_image', my_addon.getAddonInfo('fanart')) xbmcplugin.addDirectoryItem(handle=addon_id, url=url, listitem=li, totalItems=total) # Add the "Latest" pseudo-category url = handler.build_url({'mode': 'videos'}) li = xbmcgui.ListItem('Latest', iconImage='DefaultFolder.png') li.setProperty('fanart_image', my_addon.getAddonInfo('fanart')) xbmcplugin.addDirectoryItem(handle=addon_id, url=url, listitem=li, isFolder=True, totalItems=total) # Add the "Shows" pseudo-category url = handler.build_url({'mode': 'video_shows'}) li = xbmcgui.ListItem('Shows', iconImage='DefaultFolder.png') li.setProperty('fanart_image', my_addon.getAddonInfo('fanart')) xbmcplugin.addDirectoryItem(handle=addon_id, url=url, listitem=li, isFolder=True, totalItems=total) # Add all the real categories for category in data['results']: name = category['name'] mode = 'endurance' if category['id'] == 5 else 'videos' url = handler.build_url({ 'mode': mode, 'gb_filter': 'video_type:{0}'.format(category['id']) }) li = xbmcgui.ListItem(category['name'], iconImage='DefaultFolder.png') li.setProperty('fanart_image', my_addon.getAddonInfo('fanart')) xbmcplugin.addDirectoryItem(handle=addon_id, url=url, listitem=li, isFolder=True, totalItems=total) # Add the "Search" pseudo-category url = handler.build_url({'mode': 'search'}) li = xbmcgui.ListItem('Search', iconImage='DefaultFolder.png') li.setProperty('fanart_image', my_addon.getAddonInfo('fanart')) xbmcplugin.addDirectoryItem(handle=addon_id, url=url, listitem=li, isFolder=True, totalItems=total) xbmcplugin.endOfDirectory(addon_id)
def index(): addDir(translation(30002), "", "listMovies", "") addDir(translation(30003), "", "listTvShows", "") xbmcplugin.endOfDirectory(pluginhandle)
xbmc.sleep(600) livestreamer_url = "http://127.0.0.1:19001/livestreamer/" + urlsafe_b64encode("hlsvariant://" + media_url) li = ListItem(title, path=livestreamer_url) li.setArt({"thumb": image, "icon": image}) li.setMimeType("video/x-mpegts") else: li = ListItem(title, path=media_url) li.setArt({"thumb": image, "icon": image}) li.setMimeType("application/vnd.apple.mpegurl") else: li = ListItem(title, path=media_url) li.setArt({"thumb": image, "icon": image}) try: li.setContentLookup(False) except AttributeError: pass xbmcplugin.setResolvedUrl(plugin.handle, True, li) if __name__ == "__main__": try: plugin.run(sys.argv) s.close() except requests.exceptions.RequestException as e: dialog = xbmcgui.Dialog() dialog.notification(plugin.name, str(e), xbmcgui.NOTIFICATION_ERROR) traceback.print_exc() xbmcplugin.endOfDirectory(plugin.handle, False)
def discover(directory=None, option=None, filterby=None, page=1, pages=1): if not directory: for i in INDEX_MENU['discover'].get('menu'): li_item = ListItem(i.get('name')) li_item.setArt(DEFAULT_ART) addDirectoryItem(plugin.handle, plugin.url_for(discover, i.get('call')), li_item, True) _category(category=INDEX_MENU['discover']['name']) else: category = _dict_match('name', INDEX_MENU['discover']['menu'], 'call', directory) if _previouspage(page): li_item = ListItem(ADDON.getLocalizedString(32056)) li_item.setArt(DEFAULT_ART) addDirectoryItem( plugin.handle, plugin.url_for(discover, directory, option, filterby, int(page) - 1), li_item, True) if directory == 'person': result, pages = _query('person', 'popular', params={'page': page}) if result: _add(result, 'person') _category(directory, category) elif not option: for i in DISCOVER_INDEX[directory]: li_item = ListItem(i.get('name')) li_item.setArt(DEFAULT_ART) addDirectoryItem( plugin.handle, plugin.url_for(discover, directory, i.get('option')), li_item, True) _category(category=category) elif option == 'all': result, pages = _query('discover', directory, params={'page': page}) if result: _add(result, directory) _category(directory, category) elif option in ['genre', 'year'] and not filterby: option_results, filter_value, icon = _discover_option( directory, option) for i in option_results: li_item = ListItem(i.get('name')) li_item.setArt({'icon': icon}) addDirectoryItem( plugin.handle, plugin.url_for(discover, directory, option, i.get(filter_value)), li_item, True) _category(directory, category) else: filter_param = _dict_match('param', DISCOVER_INDEX[directory], 'option', option) result, pages = _query('discover', directory, params={ filter_param: filterby, 'page': page }) if result: _add(result, directory) _category(directory, category + ' (' + filterby + ')') if _nextpage(page, pages): li_item = ListItem(xbmc.getLocalizedString(33078)) li_item.setArt(DEFAULT_ART) addDirectoryItem( plugin.handle, plugin.url_for(discover, directory, option, filterby, int(page) + 1), li_item, True) endOfDirectory(plugin.handle)
def listAssets(asset_list, isWatchlist=False): for item in asset_list: isPlayable = False li = xbmcgui.ListItem(label=item['label'], iconImage=icon_file) if item['type'] in ['Film', 'Episode', 'Sport', 'Clip', 'Series', 'live', 'searchresult']: isPlayable = True #Check Altersfreigabe / Jugendschutzeinstellungen parental_rating = 0 if 'parental_rating' in item['data']: parental_rating = item['data']['parental_rating']['value'] if js_showall == 'false': if not skygo.parentalCheck(parental_rating, play=False): continue info, item['data'] = getInfoLabel(item['type'], item['data']) li.setInfo('video', info) item['url'] = item['url'] + ('&' if item['url'].find('?') > -1 else '?') + urllib.urlencode({'infolabels': info, 'parental_rating': parental_rating}) li.setLabel(info['title']) li.setArt({'poster': getPoster(item['data']), 'fanart': getHeroImage(item['data'])}) if item['type'] in ['Film']: xbmcplugin.setContent(addon_handle, 'movies') if xbmcaddon.Addon().getSetting('lookup_tmdb_data') == 'true' and 'TMDb_poster_path' in item['data']: poster_path = item['data']['TMDb_poster_path'] else: poster_path = getPoster(item['data']) li.setArt({'poster': poster_path}) elif item['type'] in ['Series']: xbmcplugin.setContent(addon_handle, 'tvshows') isPlayable = False elif item['type'] in ['Episode']: xbmcplugin.setContent(addon_handle, 'episodes') elif item['type'] in ['Sport', 'Clip']: xbmcplugin.setContent(addon_handle, 'files') li.setArt({'thumb': getHeroImage(item['data'])}) elif item['type'] == 'searchresult': xbmcplugin.setContent(addon_handle, 'movies') if xbmcaddon.Addon().getSetting('lookup_tmdb_data') == 'true' and 'TMDb_poster_path' in item['data']: poster_path = item['data']['TMDb_poster_path'] else: poster_path = getPoster(item['data']) li.setArt({'poster': poster_path}) elif item['type'] == ('live'): xbmcplugin.setContent(addon_handle, 'files') if 'TMDb_poster_path' in item['data']: poster = item['data']['TMDb_poster_path'] elif 'mediainfo' in item['data']: poster = getPoster(item['data']['mediainfo']) else: poster = getPoster(item['data']['channel']) fanart = skygo.baseUrl + item['data']['event']['image'] if item['data']['channel']['name'].find('News') == -1 else skygo.baseUrl + '/bin/Picture/817/C_1_Picture_7179_content_4.jpg' thumb = skygo.baseUrl + item['data']['event']['image'] if item['data']['channel']['name'].find('News') == -1 else getChannelLogo(item['data']['channel']) li.setArt({'poster': poster, 'fanart': fanart, 'thumb': thumb}) #add contextmenu item for watchlist to playable content - not for live and clip content if isPlayable and not item['type'] in ['live', 'Clip']: li.addContextMenuItems(getWatchlistContextItem(item, isWatchlist), replaceItems=False) li.setProperty('IsPlayable', str(isPlayable).lower()) xbmcplugin.addDirectoryItem(handle=addon_handle, url=item['url'], listitem=li, isFolder=(not isPlayable)) xbmcplugin.addSortMethod(handle=addon_handle, sortMethod=xbmcplugin.SORT_METHOD_NONE) xbmcplugin.addSortMethod(handle=addon_handle, sortMethod=xbmcplugin.SORT_METHOD_LABEL) xbmcplugin.addSortMethod(handle=addon_handle, sortMethod=xbmcplugin.SORT_METHOD_TITLE) xbmcplugin.addSortMethod(handle=addon_handle, sortMethod=xbmcplugin.SORT_METHOD_VIDEO_YEAR) xbmcplugin.addSortMethod(handle=addon_handle, sortMethod=xbmcplugin.SORT_METHOD_DURATION) xbmcplugin.endOfDirectory(addon_handle, cacheToDisc=True)
def endDirectory(self, type='addons'): xbmcplugin.setContent(syshandle, type) #xbmcplugin.addSortMethod(syshandle, xbmcplugin.SORT_METHOD_TITLE) xbmcplugin.endOfDirectory(syshandle, cacheToDisc=True)
def endOfDirectory(succeeded=True): if self.handle > -1: xbmcplugin.endOfDirectory(handle=self.handle, succeeded=succeeded, cacheToDisc=True) else: common.log('Handle -1')
def readmedia(params): print params['href'] http = GET(params['href']) if http == None: return False #print http out = re.findall('<iframe class="myvideo" src="(.+?)">', http) #print out[0] try: http = GET(out[0]) #print http #beautifulSoup = BeautifulSoup(str(http)) #print beautifulSoup.prettify txt = http img = params['img'] title = re.findall("<title>(.+?)</title>", txt) ou1 = re.findall('"file":"(.+?)","', txt) ou2 = re.findall('"pl":"(.+?)"}', txt) #print ou2 if ou1: #print 'ou1' li = xbmcgui.ListItem(title[0], img, img) uri = construct_request({ 'href': ou1[0].replace('\/', '/'), 'func': 'play' }) li.setProperty('IsPlayable', 'true') xbmcplugin.addDirectoryItem(hos, uri, li) if ou2: ll = ou2[0].replace('\/', '/') http = GET(ll)[3::] flist = json.loads(http) for file in flist['playlist']: try: li = xbmcgui.ListItem(file['comment'], img, img) uri = construct_request({ 'href': file['file'], 'func': 'play' }) li.setProperty('IsPlayable', 'true') xbmcplugin.addDirectoryItem(hos, uri, li) except: try: li = xbmcgui.ListItem(file['comment'], img, img) uri = construct_request({}) xbmcplugin.addDirectoryItem(hos, uri, li) for file2 in file['playlist']: li = xbmcgui.ListItem(file2['comment'], img, img) uri = construct_request({ 'href': file2['file'], 'func': 'play' }) li.setProperty('IsPlayable', 'true') xbmcplugin.addDirectoryItem(hos, uri, li) except: pass except: pass xbmcplugin.endOfDirectory(hos)
def ARDSearch(title, sender): PLog('ARDSearch:'); PLog(sender) query = get_keyboard_input() if query == None: # None bei Abbruch return query = query.strip() path = "%s/%s/search/%s" % (BETA_BASE_URL, sender, urllib2.quote(query)) page, msg = get_page(path) if page == '': msg1 = "Fehler in ARDSearch, Suche: %s" % query msg2=msg xbmcgui.Dialog().ok(ADDON_NAME, msg1, msg2, '') return li PLog(len(page)) li = xbmcgui.ListItem() li = home(li, ID='ARD Neu') # Home-Button gridlist = blockextract( 'type":"ondemand"', page) if len(gridlist) == 0: msg1 = 'keine Beiträge gefunden zu: %s' % query PLog(msg1) xbmcgui.Dialog().ok(ADDON_NAME, msg1, '', '') PLog('gridlist: ' + str(len(gridlist))) mediatype=''; ID='ARDSearch' for s in gridlist: summ = '' # href = stringextract('href":"', '"', s) # page.ardmediathek.de/page-gateway führt zu Übersichtsseite targetID = stringextract('Teaser:', '"', s) # targetID targetID = targetID.replace('.show', '') if targetID == '': # keine Videos, skip continue # href-Bsp. https://www.ardmediathek.de/alpha/player/Y3JpZDovL2JyLmRlL3ZpZGVvL2FkYjA0YjFhLWU1MjMtNDBhYy04YmZkLTJiM2I4MzViZDEwOQ href = "%s/%s/player/%s" % (BETA_BASE_URL, sender, targetID) title = stringextract('Title":"', '"', s) # mediumTitle, shortTitle img = stringextract('src":"', '"', s) img = img.replace('{width}', '640') duration= stringextract('"duration":', ',', s) # Sekunden PLog('duration: ' + duration) duration = seconds_translate(duration) if duration : # für Staffeln nicht geeignet duration = 'Dauer %s' % duration pubServ = stringextract('publicationService":{"name":"', '"', s) # Sender duration = "%s | Sender: %s" % (duration, pubServ) if SETTINGS.getSetting('pref_load_summary') == 'true': # summary (Inhaltstext) im Voraus holen if summ == '': # falls leer summ = get_summary_pre(path=href, ID='ARDnew') if summ: if duration: summ = "%s\n\n%s" % (duration, summ) else: summ = duration PLog('Satz:'); PLog(title); PLog(href); PLog(img); PLog(summ); PLog(duration); title=UtfToStr(title); href=UtfToStr(href); duration=UtfToStr(duration); title = repl_json_chars(title); summ = repl_json_chars(summ); fparams="&fparams={'path': '%s', 'title': '%s', 'duration': '%s', 'ID': '%s'}" %\ (urllib2.quote(href), urllib2.quote(title), duration, ID) addDir(li=li, label=title, action="dirList", dirID="resources.lib.ARDnew.ARDStartSingle", fanart=img, thumb=img, fparams=fparams, summary=summ, mediatype=mediatype) xbmcplugin.endOfDirectory(HANDLE)
def listsMainMenu(self, table): for num, val in table.items(): self.add('alltubeseriale', 'main-menu', val, 'None', 'None', 'None', 'None', 'None', True, False) xbmcplugin.endOfDirectory(int(sys.argv[1]))
def ARDStartVideoMP4(title, path, summ, tagline, img, geoblock, sub_path='', Merk='false'): PLog('ARDStartVideoMP4:'); title_org=title; summary_org=summ; thumb=img; tagline_org=tagline # Backup geoblock = UtfToStr(geoblock) li = xbmcgui.ListItem() li = home(li, ID='ARD Neu') # Home-Button page, msg = get_page(path) if page == '': msg1 = "Fehler in ARDStartVideoMP4: %s" % title msg2 = msg xbmcgui.Dialog().ok(ADDON_NAME, msg1, msg2, '') return li PLog(len(page)) Plugins = blockextract('_plugin', page) # wir verwenden nur Plugin1 (s.o.) Plugin1 = Plugins[0] VideoUrls = blockextract('_quality', Plugin1) PLog(len(VideoUrls)) # Format Downloadliste "Qualität: niedrige | Titel#https://pdvideosdaserste.." download_list = ARDStartVideoMP4get(title,VideoUrls) # holt Downloadliste mit mp4-videos PLog(len(download_list)) PLog(download_list[:1]) # 1. Element title = UtfToStr(title); title_org = UtfToStr(title_org); summary_org= UtfToStr(summary_org) tagline= UtfToStr(tagline); img = UtfToStr(img) title=repl_json_chars(title); title_org=repl_json_chars(title_org); summary_org=repl_json_chars(summary_org); tagline=repl_json_chars(tagline); # Sofortstart mit letzter=höchster Qualität Plot = "%s||||%s" % (tagline, summary_org) # || Code für LF (\n scheitert in router) if SETTINGS.getSetting('pref_video_direct') == 'true': # Sofortstart if SETTINGS.getSetting('pref_show_resolution') == 'false': PLog('Sofortstart: ARDStartVideoMP4') video = download_list[-1] # letztes Element = höchste Qualität meta, href = video.split('#') PLog(meta); PLog(href); quality = meta.split('|')[0] # "Qualität: sehr hohe | Titel.." PLog(quality); PlayVideo(url=href, title=title, thumb=img, Plot=Plot, sub_path=sub_path, Merk=Merk) return for video in download_list: PLog(video); meta, href = video.split('#') quality = meta.split('|')[0] lable = quality + geoblock; lable = UtfToStr(lable) PLog(href); PLog(quality); PLog(tagline); PLog(summary_org); Plot = "%s||||%s" % (tagline, summary_org) # || Code für LF (\n scheitert in router) sub_path=''# fehlt noch bei ARD fparams="&fparams={'url': '%s', 'title': '%s', 'thumb': '%s', 'Plot': '%s', 'sub_path': '%s'}" %\ (urllib.quote_plus(href), urllib.quote_plus(title_org), urllib.quote_plus(img), urllib.quote_plus(Plot), urllib.quote_plus(sub_path)) addDir(li=li, label=lable, action="dirList", dirID="PlayVideo", fanart=img, thumb=img, fparams=fparams, mediatype='video', tagline=tagline, summary=summary_org) if download_list: title = " | %s" PLog(title);PLog(summary_org);PLog(tagline);PLog(thumb); li = ardundzdf.test_downloads(li,download_list,title_org,summary_org,tagline,thumb,high=-1) # Downloadbutton(s) xbmcplugin.endOfDirectory(HANDLE)
def _eod(cache_to_disc=True): xbmcplugin.endOfDirectory(HANDLE_ID, cacheToDisc=cache_to_disc)
def ARDStartVideoStreams(title, path, summ, tagline, img, geoblock, sub_path='', Merk='false'): PLog('ARDStartVideoStreams:'); title_org = title geoblock = UtfToStr(geoblock) li = xbmcgui.ListItem() li = home(li, ID='ARD Neu') # Home-Button page, msg = get_page(path) if page == '': msg1 = "Fehler in ARDStartVideoStreams: %s" % title msg2 = msg xbmcgui.Dialog().ok(ADDON_NAME, msg1, msg2, '') return li PLog(len(page)) Plugins = blockextract('_plugin', page) # wir verwenden nur Plugin1 (s.o.) Plugin1 = Plugins[0] VideoUrls = blockextract('_quality', Plugin1) PLog(len(VideoUrls)) href = '' for video in VideoUrls: # PLog(video) q = stringextract('_quality":"', '"', video) # Qualität (Bez. wie Original) if q == 'auto': href = stringextract('json":["', '"', video) # Video-Url quality = 'Qualität: automatische' PLog(quality); PLog(href) break if 'master.m3u8' in href == False: # möglich: ../master.m3u8?__b__=200 msg = 'keine Streamingquelle gefunden - Abbruch' PLog(msg) msg1 = "keine Streamingquelle gefunden: %s" % title xbmcgui.Dialog().ok(ADDON_NAME, msg1, '', '') return li if href.startswith('http') == False: href = 'http:' + href href = href.replace('https', 'http') # Plex: https: crossdomain access denied lable = 'Bandbreite und Auflösung automatisch ' # master.m3u8 lable = lable + geoblock title = UtfToStr(title) title_org = UtfToStr(title_org) href = UtfToStr(href) img = UtfToStr(img) lable = UtfToStr(lable) summ = UtfToStr(summ) tagline = UtfToStr(tagline) Plot = "%s||||%s" % (tagline, summ) # || Code für LF (\n scheitert in router) if SETTINGS.getSetting('pref_video_direct') == 'true' or Merk == 'true': # Sofortstart if SETTINGS.getSetting('pref_show_resolution') == 'false' or Merk == 'true': PLog('Sofortstart: ARDStartVideoStreams') PlayVideo(url=href, title=title, thumb=img, Plot=Plot, sub_path=sub_path, Merk=Merk) return title=repl_json_chars(title); title_org=repl_json_chars(title_org); lable=repl_json_chars(lable); summ=repl_json_chars(summ); tagline=repl_json_chars(tagline); fparams="&fparams={'url': '%s', 'title': '%s', 'thumb': '%s', 'Plot': '%s', 'sub_path': '%s', 'Merk': '%s'}" %\ (urllib.quote_plus(href), urllib.quote_plus(title_org), urllib.quote_plus(img), urllib.quote_plus(Plot), urllib.quote_plus(sub_path), Merk) addDir(li=li, label=lable, action="dirList", dirID="PlayVideo", fanart=img, thumb=img, fparams=fparams, mediatype='video', tagline=tagline, summary=summ) li = ardundzdf.Parseplaylist(li, href, img, geoblock, tagline=tagline, descr=summ, sub_path=sub_path) # einzelne Auflösungen xbmcplugin.endOfDirectory(HANDLE)
def SendungenAZ_ARDnew(title, button, api_call): PLog('SendungenAZ_ARDnew:') PLog('button: ' + button); title = title.decode(encoding="utf-8") title_org = title url_api_org = api_call # speichern für Fehlschlag sha256Hashes_AZ = [ # dauerhafte Gültigkeit prüfen - Check 14.04.2019 "09 56604d4f195e7eb318227fa01cdc424d5378d11b583d85c696d971ae19be2cf9", "A 3bfe84dc9887d0991263fb19dc4c5ba501bb5f27db0a06074b9b0e9ecf2c3c27", "B 557b3d0694f7d8d589e43c504a980f4090a025b8c2eefa6559b245f2f1a69e16", "C 4a35671fa57762f7e94a2aa79dc48f7fa9dde7c25387ecf9b722d37b26cc2d95", "D f942fa0fe653a179d07349a907687544b090751deabe848919fc10949b3e05c6", "E b7c5db273782bed01ae8ed000d7b5c7b6fdacad30b2d88690b1819c131439a61", "F 3fc33abce9a66d020a172a15268354acc4139652c4211be02f95ed470fc34962", "G 0ea25f94b3f8f4978bd55189392ed6a1874fe66c846a92734a50d3de37e4dad9", "H fa55e3e6db3952d3cfb5a59fbfe413291fa11fdc07fac77b6f97d50478c9e201", "I b5f9682e177cd52d7e1b02800271f0f2128ba738b58e3f8896b0bbfe925d4d72", "J 6da769a89ec95b2a50f4c751eb8935e42d826fa26946a2fa0e842e332883473f", "K ac31e2cf0e381196de7e32ceeedfd1a53d67f5b926d86e37763bd00a6d825be3", "L 81668bf385abcf876495cdf4280a83431787c647fa42defb82d3096517578ab3", "M 7277a409abd703c9c2858834d93a18fdfce0ea0aee3a416a6bdea62a7ac73598", "N dc8b7e99c2aa1397e658fb380fe96d7fb940d18b895c2336f3284751898d48c7", "O 5ad27bbec3d8fbc6ea7dc74f3cae088f2160120b4a7659ba5ed62e950301a0b6", "P 3a3c88b51baddc0e9a2d1bb7888e4d44ec8901d0f5f448ca477b36e77aac8efd", "Q 5ad27bbec3d8fbc6ea7dc74f3cae088f2160120b4a7659ba5ed62e950301a0b6", "R 7e8cd2c0c128019fe0885cc61b5320867ec211dcd2f0986238da07598d826587", "S a56ae9754a77be068bc3d87c8bf0d8229a13bd570d4230776bfbb91c0496a022", "S 048cd18997a847069d006adf86879944e1b5069ff2258e5cb3c1a37d2265b91e", "T 048cd18997a847069d006adf86879944e1b5069ff2258e5cb3c1a37d2265b91e", "U cc8ae75b395d3faa3b338e19815af7d6af4ad8c5f462e1163b2fa8bae5404a54", "V a348091704377530f2b4db50cdf4287859424855aad21d99c64f8454c602698a", "W 1c8d95d7f0f74fe53f6021ef9146183f19ababd049b31e0b9eb909ffcf86d6c0", "X unbelegt", "Y 8bc949cd1652c68b4ff28ac9d38c5450fe6e42783428135fe65af3f230414668", "Z cc7a222db4cc330c2a5a74f8cd64157f255dcfec9272b7fe8f742d2e489aae8f" ] li = xbmcgui.ListItem() li = home(li, ID='ARD Neu') # Home-Button CurSender = Dict("load", 'CurSender') CurSender = UtfToStr(CurSender) sendername, sender, kanal, img, az_sender = CurSender.split(':') PLog(sender) myhash = '' for Hash in sha256Hashes_AZ: b, myhash = Hash.split() PLog(b); PLog(myhash) if b == button: break url_api = get_api_call('SendungenAZ_ARDnew', 'ard', myhash) # ard: A-Z für alle laden, später filtern page, msg = get_page(url_api, cTimeout=0) if page == '': return Objget_api_callectContainer(header='Error', message=msg) page = page.replace('\\"', '*') # quotiere Marks entf. # RSave('/tmp/x.html', page) # Debug if page.startswith('{"errors":'): # Seite Alle kann Fehler liefern, obwohl die msg = stringextract('message":"', '"', page) # A-Z-Seite des Senders Daten enthält msg = "ARD Server-Error: %s" % msg PLog(msg) gridlist = blockextract( '"mediumTitle":', page) # Beiträge? PLog('gridlist: ' + str(len(gridlist))) if len(gridlist) == 0: msg = 'keine Beiträge zu %s gefunden, starte Fallback'.decode(encoding="utf-8") % title PLog(msg) page, msg = get_page(url_api_org, cTimeout=0) # Fallback: grouping-Links aus SendungenAZ links = stringextract('"shows%s"' % button, 'hows', page) # 'hows' schließt auch Z bei "ShowsPage"ab glinks = blockextract('"id":', links) if len(glinks) == 0: msg = 'Keine Beiträge gefunden zu %s' % button # auch Fallback gescheitert xbmcgui.Dialog().ok(ADDON_NAME, msg, '', '') i=0 for glink in glinks: # Fallback-Listing i=i+1 targetID = stringextract('id":"', '"', glink) href = href = 'http://page.ardmediathek.de/page-gateway/pages/%s/grouping/%s' % (sender, targetID) PLog(glink); PLog(href); label = '%s. Gruppe Beiträge zu %s' % ( str(i), button) label = label.decode(encoding="utf-8") summ = 'Gezeigt wird der Inhalt für %s' % sendername summ = summ.decode(encoding="utf-8") tag = 'lokale Beiträge (keine auf Alle-Seite gefunden)'.decode(encoding="utf-8") img = R(ICON_ARD_AZ) # Kennzeichnung ID='A-Z' für ARDStartRubrik, fparams="&fparams={'path': '%s', 'title': '%s', 'ID': '%s'}" %\ (urllib2.quote(href), urllib2.quote(label), 'A-Z') addDir(li=li, label=label, action="dirList", dirID="resources.lib.ARDnew.ARDStartRubrik", fanart=img, thumb=img, fparams=fparams) xbmcplugin.endOfDirectory(HANDLE) # Ende Fallback # ab hier normale Auswertung for s in gridlist: targetID= stringextract('target":{"id":"', '"', s) # targetID PLog(targetID) if targetID == '': # keine Video continue groupingID= stringextract('/ard/grouping/', '"', s) # leer bei Beiträgen von A-Z-Seiten if groupingID != '': targetID = groupingID href = 'http://page.ardmediathek.de/page-gateway/pages/%s/grouping/%s' % (sender, targetID) title = stringextract('"longTitle":"', '"', s) if title == '': title = stringextract('"title":"', '"', s) title = title.replace('- Standbild', '') title = unescape(title) img = stringextract('src":"', '"', s) img = img.replace('{width}', '640') summ = stringextract('synopsis":"', '"', s) pubServ = stringextract('"name":"', '"', s) # publicationService (Sender) tagline = "Sender: %s" % pubServ PLog(az_sender); PLog(pubServ) if sender != 'ard': # Alle (ard) oder filtern if az_sender != pubServ: continue PLog('Satz:'); PLog(title); PLog(href); PLog(img); PLog(summ); PLog(tagline); summ = "%s\n\n%s" % (tagline, summ) fparams="&fparams={'path': '%s', 'title': '%s'}" %\ (urllib2.quote(href), urllib2.quote(title)) addDir(li=li, label=title, action="dirList", dirID="resources.lib.ARDnew.ARDStartRubrik", fanart=img, thumb=img, fparams=fparams, summary=summ) xbmcplugin.endOfDirectory(HANDLE)