def salvar_busquedas(params,url,category): channel = params.get("channel") limite_busquedas = ( 10, 20, 30, 40, )[ int( config.getSetting( "limite_busquedas" ) ) ] matches = [] try: presets = config.getSetting("presets_buscados") if "|" in presets: presets = matches = presets.split("|") for count, preset in enumerate( presets ): if url in preset: del presets[ count ] break if len( presets ) >= limite_busquedas: presets = presets[ : limite_busquedas - 1 ] except: presets = "" presets2 = "" if len(matches)>0: for preset in presets: presets2 = presets2 + "|" + preset presets = url + presets2 elif presets != "": presets = url + "|" + presets else: presets = url config.setSetting("presets_buscados",presets)
def process_genomic_manifest_result_file_from_bucket(): bucket_name = config.getSetting(config.BIOBANK_SAMPLES_BUCKET_NAME) result_folder_name = config.getSetting(GENOMIC_BIOBANK_MANIFEST_RESULT_FOLDER_NAME) bucket_stat_list = cloudstorage_api.listbucket('/' + bucket_name) if not bucket_stat_list: logging.info('No files in cloud bucket %r.' % bucket_name) return None bucket_stat_list = [s for s in bucket_stat_list if s.filename.lower().endswith('.csv') and '%s' % result_folder_name in s.filename] if not bucket_stat_list: logging.info( 'No CSVs in cloud bucket %r folder %r (all files: %s).' % (bucket_name, result_folder_name, bucket_stat_list)) return None bucket_stat_list.sort(key=lambda s: s.st_ctime) path = bucket_stat_list[-1].filename csv_file = cloudstorage_api.open(path) filename = path.replace('/' + bucket_name + '/' + result_folder_name + '/', '') logging.info('Opening latest genomic manifest result CSV in %r: %r.', bucket_name + '/' + result_folder_name, path) timestamp = timestamp_from_filename(filename) now = clock.CLOCK.now() if now - timestamp > _MAX_INPUT_AGE: logging.info('Input %r (timestamp %s UTC) is > 24h old (relative to %s UTC), not processing.' % (filename, timestamp, now)) print('Input %r (timestamp %s UTC) is > 24h old (relative to %s UTC), not processing.' % (filename, timestamp, now)) return None genomic_set_id = _get_genomic_set_id_from_filename(filename) update_package_id_from_manifest_result_file(genomic_set_id, csv_file)
def mainlist(params,url,category): logger.info("[seriesyonkis.py] mainlist") if config.getSetting("forceview")=="true": xbmc.executebuiltin("Container.SetViewMode(50)") #full list xbmctools.addnewfolder( CHANNELNAME , "lastepisodeslist" , category , "Últimos capítulos","http://www.seriesyonkis.com/ultimos-capitulos.php","","") xbmctools.addnewfolder( CHANNELNAME , "listalfabetico" , category , "Listado alfabético","","","") xbmctools.addnewfolder( CHANNELNAME , "alltvserieslist" , category , "Listado completo de series","http://www.seriesyonkis.com/","","") xbmctools.addnewfolder( CHANNELNAME , "allcartoonslist" , category , "Listado completo de dibujos animados","http://www.seriesyonkis.com/","","") xbmctools.addnewfolder( CHANNELNAME , "allanimelist" , category , "Listado completo de anime","http://www.seriesyonkis.com/","","") xbmctools.addnewfolder( CHANNELNAME , "allminilist" , category , "Listado completo de miniseries","http://www.seriesyonkis.com/","","") xbmctools.addnewfolder( CHANNELNAME , "search" , category , "Buscar","","","") if config.getSetting("singlechannel")=="true": xbmctools.addSingleChannelOptions(params,url,category) # Label (top-right)... xbmcplugin.setPluginCategory( handle=int( sys.argv[ 1 ] ), category=category ) # Disable sorting... xbmcplugin.addSortMethod( handle=int( sys.argv[ 1 ] ), sortMethod=xbmcplugin.SORT_METHOD_NONE ) # End of directory... xbmcplugin.endOfDirectory( handle=int( sys.argv[ 1 ] ), succeeded=True )
def addfolder(nombre,channelname,accion,category=""): if category == "": try: category = unicode( nombre, "utf-8" ).encode("iso-8859-1") except: pass import xbmc if config.getSetting("thumbnail_type")=="0": IMAGES_PATH = xbmc.translatePath( os.path.join( os.getcwd(), 'resources' , 'images' , 'posters' ) ) else: IMAGES_PATH = xbmc.translatePath( os.path.join( os.getcwd(), 'resources' , 'images' , 'banners' ) ) if config.getSetting("thumbnail_type")=="0": WEB_PATH = "http://www.mimediacenter.info/xbmc/pelisalacarta/posters/" else: WEB_PATH = "http://www.mimediacenter.info/xbmc/pelisalacarta/banners/" # Preferencia: primero JPG thumbnail = thumbnailImage=os.path.join(IMAGES_PATH, channelname+".jpg") # Preferencia: segundo PNG if not os.path.exists(thumbnail): thumbnail = thumbnailImage=os.path.join(IMAGES_PATH, channelname+".png") # Preferencia: tercero WEB if not os.path.exists(thumbnail): thumbnail = thumbnailImage=WEB_PATH+channelname+".png" #Si no existe se usa el logo del plugin #if not os.path.exists(thumbnail): # thumbnail = thumbnailImage=WEB_PATH+"ayuda.png" #Check: ruta del logo import xbmcgui import xbmcplugin listitem = xbmcgui.ListItem( nombre , iconImage="DefaultFolder.png", thumbnailImage=thumbnail) itemurl = '%s?channel=%s&action=%s&category=%s' % ( sys.argv[ 0 ] , channelname , accion , category ) xbmcplugin.addDirectoryItem( handle = int(sys.argv[ 1 ]), url = itemurl , listitem=listitem, isFolder=True)
def getlowurl(code): xbmc.output("[megavideo.py] Baja calidad") code=getcode(code) modoPremium = config.getSetting("megavideopremium") xbmc.output("[megavideo.py] modoPremium="+modoPremium) if modoPremium == "false": xbmc.output("[megavideo.py] usando modo normal para baja calidad") req = urllib2.Request("http://www.megavideo.com/xml/videolink.php?v="+code) req.add_header('User-Agent', 'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-GB; rv:1.8.1.14) Gecko/20080404 Firefox/2.0.0.14') req.add_header('Referer', 'http://www.megavideo.com/') page = urllib2.urlopen(req);response=page.read();page.close() errort = re.compile(' errortext="(.+?)"').findall(response) movielink = "" if len(errort) <= 0: s = re.compile(' s="(.+?)"').findall(response) k1 = re.compile(' k1="(.+?)"').findall(response) k2 = re.compile(' k2="(.+?)"').findall(response) un = re.compile(' un="(.+?)"').findall(response) movielink = "http://www" + s[0] + ".megavideo.com/files/" + decrypt(un[0], k1[0], k2[0]) + "/?.flv" #addLink(name, movielink+'?.flv','') else: xbmc.output("[megavideo.py] usando modo premium para baja calidad") megavideocookie = config.getSetting("megavideocookie") if DEBUG: xbmc.output("[megavideo.py] megavideocookie=#"+megavideocookie+"#") xbmc.output("[megavideo.py] Averiguando cookie...") megavideologin = config.getSetting("megavideouser") if DEBUG: xbmc.output("[megavideo.py] megavideouser=#"+megavideologin+"#") megavideopassword = config.getSetting("megavideopassword") if DEBUG: xbmc.output("[megavideo.py] megavideopassword=#"+megavideopassword+"#") megavideocookie = GetMegavideoUser(megavideologin, megavideopassword) if DEBUG: xbmc.output("[megavideo.py] megavideocookie=#"+megavideocookie+"#") if len(megavideocookie) == 0: advertencia = xbmcgui.Dialog() resultado = advertencia.ok('Cuenta de Megavideo errónea' , 'La cuenta de Megavideo que usas no es válida' , 'Comprueba el login y password en la configuración') return "" req = urllib2.Request("http://www.megavideo.com/xml/videolink.php?v="+code+"&u="+megavideocookie) req.add_header('User-Agent', 'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-GB; rv:1.8.1.14) Gecko/20080404 Firefox/2.0.0.14') req.add_header('Referer', 'http://www.megavideo.com/') page = urllib2.urlopen(req);response=page.read();page.close() errort = re.compile(' errortext="(.+?)"').findall(response) movielink = "" if len(errort) <= 0: s = re.compile(' s="(.+?)"').findall(response) k1 = re.compile(' k1="(.+?)"').findall(response) k2 = re.compile(' k2="(.+?)"').findall(response) un = re.compile(' un="(.+?)"').findall(response) movielink = "http://www" + s[0] + ".megavideo.com/files/" + decrypt(un[0], k1[0], k2[0]) + "/?.flv" #addLink(name, movielink+'?.flv','') return movielink
def gethighurl(code): xbmc.output("[megaporn.py] Usa modo premium") code = getcode(code) try: megaporncookie = config.getSetting("megaporncookie") if DEBUG: xbmc.output("[megaporn.py] megaporncookie=#" + megaporncookie + "#") #if megaporncookie=="": xbmc.output("[megaporn.py] Averiguando cookie...") megapornlogin = config.getSetting("megapornuser") if DEBUG: xbmc.output("[megaporn.py] megapornuser=#" + megapornlogin + "#") megapornpassword = config.getSetting("megapornpassword") if DEBUG: xbmc.output("[megaporn.py] megapornpassword=#" + megapornpassword + "#") megaporncookie = GetMegapornUser(megapornlogin, megapornpassword) if DEBUG: xbmc.output("[megaporn.py] megaporncookie=#" + megaporncookie + "#") except: megaporcookie = "" if len(megaporncookie) == 0: advertencia = xbmcgui.Dialog() resultado = advertencia.ok( 'Cuenta de Megaporn errónea', 'La cuenta de Megaporn que usas no es válida', 'Comprueba el login y password en la configuración') return "" req = urllib2.Request( "http://www.megaporn.com/video/xml/player_login.php?u=" + megaporncookie + "&v=" + code) req.add_header( '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) data = response.read() response.close() # saca los enlaces patronvideos = 'downloadurl="([^"]+)"' matches = re.compile(patronvideos, re.DOTALL).findall(data) movielink = "" if len(matches) > 0: movielink = matches[0] movielink = movielink.replace("%3A", ":") movielink = movielink.replace("%2F", "/") movielink = movielink.replace("%20", " ") return movielink
def __init__(self): self.namespace = 'http://orders.mayomedicallaboratories.com' self.config_bucket = config.CONFIG_BUCKET self.config = config.getSetting(config.MAYOLINK_CREDS) self.path = '/' + self.config_bucket + '/' + self.config self.endpoint = config.getSetting(config.MAYOLINK_ENDPOINT) # For now I can not figure out how to use cloudstorage on dev_appserver, comment out the # below and manually add self.username, etc. with cloudstorage.open(self.path, 'r') as file_path: self.creds = json.load(file_path) self.username = self.creds.get('username') self.pw = self.creds.get('password') self.account = self.creds.get('account')
def listar_busquedas(params,url,category): print "listar_busquedas()" channel2 = "" # Despliega las busquedas anteriormente guardadas try: presets = config.getSetting("presets_buscados") channel_preset = params.get("channel") if channel_preset != CHANNELNAME: channel2 = channel_preset print "channel_preset :%s" %channel_preset accion = params.get("action") matches = "" if "|" in presets: matches = presets.split("|") addfolder( "buscador" , config.getLocalizedString(30103)+"..." , matches[0] , "por_teclado", channel2 ) # Buscar else: addfolder( "buscador" , config.getLocalizedString(30103)+"..." , "" , "por_teclado", channel2 ) if len(matches)>0: for match in matches: title=scrapedurl = match addfolder( channel_preset , title , scrapedurl , "searchresults" ) elif presets != "": title = scrapedurl = presets addfolder( channel_preset , title , scrapedurl , "searchresults" ) except: addfolder( "buscador" , config.getLocalizedString(30103)+"..." , "" , "por_teclado" , channel2 ) # Cierra el directorio 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 mainlist(params,url,category): logger.info("[cinegratis.py] mainlist") # Añade al listado de XBMC xbmctools.addnewfolder( CHANNELNAME , "listvideos" , category , "Películas - Novedades" ,"http://www.cinegratis.net/index.php?module=peliculas","","") xbmctools.addnewfolder( CHANNELNAME , "listvideos" , category , "Películas - Estrenos" ,"http://www.cinegratis.net/index.php?module=estrenos","","") xbmctools.addnewfolder( CHANNELNAME , "peliscat" , category , "Películas - Lista por categorías" ,"http://www.cinegratis.net/index.php?module=generos","","") xbmctools.addnewfolder( CHANNELNAME , "pelisalfa" , category , "Películas - Lista alfabética" ,"","","") xbmctools.addnewfolder( CHANNELNAME , "listvideos" , category , "Películas - Alojadas en Veoh" ,"http://www.cinegratis.net/index.php?module=servers&varserver=veoh","","") xbmctools.addnewfolder( CHANNELNAME , "listvideos" , category , "Películas - Alojadas en Megavideo","http://www.cinegratis.net/index.php?module=servers&varserver=megavideo","","") xbmctools.addnewfolder( CHANNELNAME , "listseries" , category , "Series - Novedades" ,"http://www.cinegratis.net/index.php?module=series","","") xbmctools.addnewfolder( CHANNELNAME , "listsimple" , category , "Series - Todas" ,"http://www.cinegratis.net/index.php?module=serieslist","","") xbmctools.addnewfolder( CHANNELNAME , "listseries" , category , "Dibujos - Novedades" ,"http://www.cinegratis.net/index.php?module=anime","","") xbmctools.addnewfolder( CHANNELNAME , "listsimple" , category , "Dibujos - Todos" ,"http://www.cinegratis.net/index.php?module=animelist","","") xbmctools.addnewfolder( CHANNELNAME , "listvideos" , category , "Documentales - Novedades" ,"http://www.cinegratis.net/index.php?module=documentales","","") xbmctools.addnewfolder( CHANNELNAME , "listsimple" , category , "Documentales - Todos" ,"http://www.cinegratis.net/index.php?module=documentaleslist","","") #xbmctools.addnewfolder( CHANNELNAME , "deportes" , category , "Deportes" ,"","","") xbmctools.addnewfolder( CHANNELNAME , "search" , category , "Buscar" ,"","","") if config.getSetting("singlechannel")=="true": xbmctools.addSingleChannelOptions(params,url,category) # Cierra el directorio 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 mainlist(params, url, category): logger.info("[tumejortv.py] mainlist") xbmctools.addnewfolder(CHANNELNAME, "newlist", CHANNELNAME, "Novedades", "http://www.tumejortv.com/", "", "") xbmctools.addnewfolder(CHANNELNAME, "moviecategorylist", CHANNELNAME, "Películas - Por categorías", "http://www.tumejortv.com/", "", "") xbmctools.addnewfolder(CHANNELNAME, "moviealphalist", CHANNELNAME, "Películas - Por orden alfabético", "http://www.tumejortv.com/", "", "") xbmctools.addnewfolder(CHANNELNAME, "serienewlist", CHANNELNAME, "Series - Novedades", "http://www.tumejortv.com/", "", "") xbmctools.addnewfolder(CHANNELNAME, "seriealllist", CHANNELNAME, "Series - Todas", "http://www.tumejortv.com/", "", "") xbmctools.addnewfolder(CHANNELNAME, "seriealphalist", CHANNELNAME, "Series - Por orden alfabético", "http://www.tumejortv.com/", "", "") xbmctools.addnewfolder(CHANNELNAME, "search", CHANNELNAME, "Buscar", "", "", "") if config.getSetting("singlechannel") == "true": xbmctools.addSingleChannelOptions(params, url, category) # Label (top-right)... xbmcplugin.setPluginCategory(handle=pluginhandle, category=category) xbmcplugin.addSortMethod( handle=pluginhandle, sortMethod=xbmcplugin.SORT_METHOD_NONE) xbmcplugin.endOfDirectory(handle=pluginhandle, succeeded=True)
def searchresults(params,url,category): logger.info("[peliculasyonkis.py] searchresults") if config.getSetting("forceview")=="true": xbmc.executebuiltin("Container.SetViewMode(53)") #53=icons # Descarga la página data = scrapertools.cachePage(url) #logger.info(data) # Extrae las entradas (carpetas) #<li> <a href="http://www.peliculasyonkis.com/pelicula/las-edades-de-lulu-1990/" title="Las edades de Lulú (1990)"><img width="77" height="110" src="http://images.peliculasyonkis.com/thumbs/las-edades-de-lulu-1990.jpg" alt="Las edades de Lulú (1990)" align="right" /> patronvideos = '<li> <a href="([^"]+)" title="([^"]+)"><img.*?src="([^"]+)"' matches = re.compile(patronvideos,re.DOTALL).findall(data) scrapertools.printMatches(matches) for match in matches: scrapedtitle = match[1] scrapedurl = match[0] scrapedthumbnail = match[2] scrapedplot = "" if (DEBUG): logger.info("title=["+scrapedtitle+"], url=["+scrapedurl+"], thumbnail=["+scrapedthumbnail+"]") xbmctools.addnewvideo( CHANNELNAME , "detail" , category , "Megavideo" , scrapedtitle , scrapedurl , scrapedthumbnail , scrapedplot ) # Label (top-right)... xbmcplugin.setPluginCategory( handle=int( sys.argv[ 1 ] ), category=category ) # Disable sorting... xbmcplugin.addSortMethod( handle=int( sys.argv[ 1 ] ), sortMethod=xbmcplugin.SORT_METHOD_NONE ) # End of directory... xbmcplugin.endOfDirectory( handle=int( sys.argv[ 1 ] ), succeeded=True )
def mainlist(params, url, category): logger.info("[filmesonlinebr.py] mainlist") # A�ade al listado de XBMC xbmctools.addnewfolder(CHANNELNAME, "listvideos", category, "Ultimos Filmes Subidos", "http://www.filmesonlinebr.com/", "", "") #xbmctools.addnewfolder( CHANNELNAME , "listalfa" , category , "Lista Alfab�tica","http://www.filmesonlinebr.com/","","") #xbmctools.addnewfolder( CHANNELNAME , "listvideos" , category , "Series","http://www.filmesonlinebr.com/","","") xbmctools.addnewfolder(CHANNELNAME, "listcategorias", category, "Categorias", "http://www.filmesonlinebr.com/", "", "") if config.getSetting("enableadultmode") == "true": xbmctools.addnewfolder( CHANNELNAME, "listvideos", category, "Filmes Adulto (+18)", "http://www.filmesonlinebr.com/category/filmes-porno-xxx/", "", "") # Label (top-right)... xbmcplugin.setPluginCategory(handle=int(sys.argv[1]), category=category) # Disable sorting... xbmcplugin.addSortMethod(handle=int(sys.argv[1]), sortMethod=xbmcplugin.SORT_METHOD_NONE) # End of directory... xbmcplugin.endOfDirectory(handle=int(sys.argv[1]), succeeded=True)
def listchannels(params,url,category): logger.info("[channelselector.py] listchannels") try: idioma = config.getSetting("languagefilter") logger.info("[channelselector.py] idioma=%s" % idioma) langlistv = ["","ES","EN","IT","PT"] idiomav = langlistv[int(idioma)] logger.info("[channelselector.py] idiomav=%s" % idiomav) except: idiomav="" channelslist = channels_list() for channel in channelslist: # Pasa si no ha elegido "todos" y no está en la categoría elegida if category<>"*" and category not in channel[4]: #logger.info(channel[0]+" no entra por tipo #"+channel[4]+"#, el usuario ha elegido #"+category+"#") continue # Pasa si no ha elegido "todos" y no está en el idioma elegido if channel[3]<>"" and idiomav<>"" and idiomav not in channel[3]: #logger.info(channel[0]+" no entra por idioma #"+channel[3]+"#, el usuario ha elegido #"+idiomav+"#") continue addfolder(channel[0] , channel[1] , "mainlist" , channel[2]) # Label (top-right)... import xbmcplugin 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 borrar_busqueda(params,url,category): channel = params.get("channel") matches = [] try: presets = config.getSetting("presets_buscados") if "|" in presets: presets = matches = presets.split("|") for count, preset in enumerate( presets ): if url in preset: del presets[ count ] break elif presets == url: presets = "" except: presets = "" if len(matches)>1: presets2 = "" c = 0 barra = "" for preset in presets: if c>0: barra = "|" presets2 = presets2 + barra + preset c +=1 presets = presets2 elif len(matches) == 1: presets = presets[0] config.setSetting("presets_buscados",presets) # refresh container so item is removed xbmc.executebuiltin( "Container.Refresh" )
def mainlist(params,url,category): logger.info("[peliculasyonkis.py] mainlist") activar = config.getSetting("activar") print "activado como :%s" %activar if activar == "": activar = "false" config.setSetting("activar",activar) if activar == "false": flecha = "+" else: flecha = "-" # Añade al listado de XBMC xbmctools.addnewfolder( CHANNELNAME , "listnovedades" , category , "Estrenos de cartelera" ,"http://www.peliculasyonkis.com/ultimas-peliculas/cartelera/","","") xbmctools.addnewfolder( CHANNELNAME , "listnovedades" , category , "Estrenos de DVD" ,"http://www.peliculasyonkis.com/ultimas-peliculas/estrenos-dvd/","","") xbmctools.addnewfolder( CHANNELNAME , "listnovedades" , category , "Ultimas Peliculas Actualizadas","http://www.peliculasyonkis.com/ultimas-peliculas/actualizadas/","","") xbmctools.addnewfolder( CHANNELNAME , "listnovedades" , category , "Ultimas peliculas añadidas a la web","http://www.peliculasyonkis.com/ultimas-peliculas/estrenos-web/","","") xbmctools.addnewfolder( CHANNELNAME , "listcategorias" , category , "Listado por categorias","http://www.peliculasyonkis.com/","","") xbmctools.addnewfolder( CHANNELNAME , "listalfabetico" , category , "Listado alfabético","http://www.peliculasyonkis.com/","","") xbmctools.addnewfolder( CHANNELNAME , "buscaporanyo" , category , "Busqueda por Año","http://www.peliculasyonkis.com/","","") xbmctools.addnewfolder( CHANNELNAME , "search" , category , "Buscar","","","") # Label (top-right)... xbmcplugin.setPluginCategory( handle=int( sys.argv[ 1 ] ), category=category ) # Disable sorting... xbmcplugin.addSortMethod( handle=int( sys.argv[ 1 ] ), sortMethod=xbmcplugin.SORT_METHOD_NONE ) # End of directory... xbmcplugin.endOfDirectory( handle=int( sys.argv[ 1 ] ), succeeded=True )
def _get_output_manifest_file_name(genomic_set_id, timestamp=None): file_timestamp = timestamp if timestamp else clock.CLOCK.now() now_cdt_str = _UTC.localize(file_timestamp).astimezone(_US_CENTRAL).replace(tzinfo=None)\ .strftime(OUTPUT_CSV_TIME_FORMAT) folder_name = config.getSetting(GENOMIC_BIOBANK_MANIFEST_FOLDER_NAME) return folder_name + '/' + _MANIFEST_FILE_NAME_PREFIX + '-' + str(genomic_set_id) + '-v1' + \ now_cdt_str + '.CSV'
def mainlist(params,url,category): logger.info("[pelisflv.py] mainlist") # A�ade al listado de XBMC xbmctools.addnewfolder( CHANNELNAME , "listvideos" , category , "Novedades" ,"http://www.pelisflv.net","","") xbmctools.addnewfolder( CHANNELNAME , "listvideos" , category , "Estrenos","http://www.pelisflv.net/search/label/Estrenos","","") xbmctools.addnewfolder( CHANNELNAME , "ListadoSeries" , category , "Series" ,"http://www.pelisflv.net/","","") xbmctools.addnewfolder( CHANNELNAME , "ListadoSeries" , category , "Series Animadas" ,"http://www.pelisflv.net/","","") xbmctools.addnewfolder( CHANNELNAME , "ListadoSeries" , category , "Anime" ,"http://www.pelisflv.net/","","") xbmctools.addnewfolder( CHANNELNAME , "ListadoSeries" , category , "Categorias" ,"http://www.pelisflv.net/","","") xbmctools.addnewfolder( CHANNELNAME , "ListadoSeries" , category , "Calidad" ,"http://www.pelisflv.net/","","") xbmctools.addnewfolder( CHANNELNAME , "ListadoSeries" , category , "Audio" ,"http://www.pelisflv.net/","","") xbmctools.addnewfolder( CHANNELNAME , "search" , category , "Buscar","http://www.pelisflv.net/","","") if config.getSetting("singlechannel")=="true": xbmctools.addSingleChannelOptions(params,url,category) # Label (top-right)... xbmcplugin.setPluginCategory( handle=int( sys.argv[ 1 ] ), category=category ) # Disable sorting... xbmcplugin.addSortMethod( handle=int( sys.argv[ 1 ] ), sortMethod=xbmcplugin.SORT_METHOD_NONE ) # End of directory... xbmcplugin.endOfDirectory( handle=int( sys.argv[ 1 ] ), succeeded=True )
def listchannels(params,url,category): logger.info("[channelselector.py] listchannels") idioma = config.getSetting("languagefilter") logger.info("[channelselector.py] idioma=%s" % idioma) langlistv = ["","ES","EN","IT","PT"] idiomav = langlistv[int(idioma)] logger.info("[channelselector.py] idiomav=%s" % idiomav) channelslist = channels_list() for channel in channelslist: # Pasa si no ha elegido "todos" y no está en la categoría elegida if category<>"*" and category not in channel[4]: logger.info(channel[0]+" no entra por tipo #"+channel[4]+"#, el usuario ha elegido #"+category+"#") continue # Pasa si no ha elegido "todos" y no está en el idioma elegido if channel[3]<>"" and idiomav<>"" and idiomav not in channel[3]: logger.info(channel[0]+" no entra por idioma #"+channel[3]+"#, el usuario ha elegido #"+idiomav+"#") continue addfolder(channel[0] , channel[1] , "mainlist" , channel[2]) # 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 generate_samples(fraction_missing): """Creates fake sample CSV data in GCS. Args: fraction_missing: This many samples which exist as BiobankStoredSamples will not have rows generated in the fake CSV. """ bucket_name = config.getSetting(config.BIOBANK_SAMPLES_BUCKET_NAME) now = clock.CLOCK.now() file_name = '/%s/fake_%s.csv' % (bucket_name, now.strftime(INPUT_CSV_TIME_FORMAT)) num_rows = 0 sample_id_start = random.randint(1000000, 10000000) with cloudstorage_api.open(file_name, mode='w') as dest: writer = csv.writer(dest, delimiter="\t") writer.writerow(_HEADERS) biobank_order_dao = BiobankOrderDao() with biobank_order_dao.session() as session: rows = biobank_order_dao.get_ordered_samples_sample( session, 1 - fraction_missing, _BATCH_SIZE) for biobank_id, collected_time, test in rows: if collected_time is None: logging.warning( 'biobank_id=%s test=%s skipped (collected=%s)', biobank_id, test, collected_time) continue minutes_delta = random.randint( 0, _MAX_MINUTES_BETWEEN_SAMPLE_COLLECTED_AND_CONFIRMED) confirmed_time = collected_time + datetime.timedelta( minutes=minutes_delta) writer.writerow([ sample_id_start + num_rows, None, # no parent confirmed_time.strftime(_TIME_FORMAT), to_client_biobank_id(biobank_id), test, confirmed_time.strftime(_TIME_FORMAT), 'KIT' ]) # reuse confirmed time as created time num_rows += 1 participant_dao = ParticipantDao() with participant_dao.session() as session: rows = participant_dao.get_biobank_ids_sample( session, _PARTICIPANTS_WITH_ORPHAN_SAMPLES, _BATCH_SIZE) for biobank_id, sign_up_time in rows: minutes_delta = random.randint( 0, _MAX_MINUTES_BETWEEN_PARTICIPANT_CREATED_AND_CONFIRMED) confirmed_time = sign_up_time + datetime.timedelta( minutes=minutes_delta) tests = random.sample(BIOBANK_TESTS, random.randint(1, len(BIOBANK_TESTS))) for test in tests: writer.writerow([ sample_id_start + num_rows, None, confirmed_time.strftime(_TIME_FORMAT), to_client_biobank_id(biobank_id), test, confirmed_time.strftime(_TIME_FORMAT), 'KIT' ]) num_rows += 1 logging.info("Generated %d samples in %s.", num_rows, file_name)
def get_last_genomic_set_file_info(): """Finds the latest CSV & updates/inserts relevant genomic tables from its rows.""" bucket_name = config.getSetting(config.GENOMIC_SET_BUCKET_NAME) # raises if missing csv_file, csv_filename = _open_latest_genomic_set_file(bucket_name) timestamp = timestamp_from_filename(csv_filename) return csv_file, csv_filename, timestamp
def videosprogtv(params,url,category): logger.info("[dospuntocerovision.py] videosprogtv") if config.getSetting("forceview")=="true": xbmc.executebuiltin("Container.SetViewMode(53)") #53=icons patronvideos = '<a onblur=.*?href="(.*?)"><img.*?src="(.*?)".*?alt=' # Descarga la p�gina data = scrapertools.cachePage(url) #logger.info(data) # Extrae las entradas (carpetas) matches = re.compile(patronvideos,re.DOTALL).findall(data) scrapertools.printMatches(matches) for match in matches: # URL scrapedurl = match[0] # Titulo titulo = match[0] if titulo.endswith(".html"): for campo in re.findall("http://.*?/.*?/.*?/(.*?).html",match[0]): scrapedtitle = campo scrapedtitle = scrapedtitle.replace("-"," ") else: #http://3.bp.blogspot.com/__kdloiikFIQ/Sbvq6Xis_GI/AAAAAAAAYBw/CrgJne1OfXs/s320/hora+de+jose+mota.JPG #logger.info("titulo "+match[0]) for campo in re.findall("http://.*?/.*?/.*?/.*?/.*?/.*?/(.*?).JPG",match[1]): scrapedtitle = campo scrapedtitle = scrapedtitle.replace("+"," ") # Thumbnail scrapedthumbnail = match[1] # procesa el resto scrapedplot = "" # Depuracion if (DEBUG): logger.info("scrapedtitle="+scrapedtitle) logger.info("scrapedurl="+scrapedurl) logger.info("scrapedthumbnail="+scrapedthumbnail) # A�ade al listado de XBMC xbmctools.addnewfolder( CHANNELNAME , "listvideos" , category , scrapedtitle , scrapedurl , scrapedthumbnail , scrapedplot ) # Label (top-right)... xbmcplugin.setPluginCategory( handle=int( sys.argv[ 1 ] ), category=category ) # Disable sorting... xbmcplugin.addSortMethod( handle=int( sys.argv[ 1 ] ), sortMethod=xbmcplugin.SORT_METHOD_NONE ) # End of directory... xbmcplugin.endOfDirectory( handle=int( sys.argv[ 1 ] ), succeeded=True )
def _create_and_upload_result_file(genomic_set): result_filename = genomic_set.genomicSetFile.replace('.', '-'+_RESULT_FILE_SUFFIX+'.') bucket_name = config.getSetting(config.GENOMIC_SET_BUCKET_NAME) exporter = SqlExporter(bucket_name) export_sql = """ SELECT :genomic_set_name AS genomic_set_name, :genomic_set_criteria AS genomic_set_criteria, participant_id AS pid, biobank_order_id, CASE WHEN ny_flag IS TRUE THEN 'Y' ELSE 'N' END AS ny_flag, sex_at_birth, genome_type, validation_status as status, validation_flags as invalid_reason FROM genomic_set_member WHERE genomic_set_id=:genomic_set_id ORDER BY id """ query_params = {'genomic_set_name': genomic_set.genomicSetName, 'genomic_set_criteria': genomic_set.genomicSetCriteria, 'genomic_set_id': genomic_set.id, } exporter.run_export(result_filename, export_sql, query_params, transformf=_transform_result_row_for_export)
def launchplayer(mediaurl, listitem): # Añadimos el listitem a una lista de reproducción (playlist) logger.info("[xbmctools.py] 5") playlist = xbmc.PlayList( xbmc.PLAYLIST_VIDEO ) playlist.clear() playlist.add( mediaurl, listitem ) # Reproduce logger.info("[xbmctools.py] 6") playersettings = config.getSetting('player_type') logger.info("[xbmctools.py] playersettings="+playersettings) logger.info("[xbmctools.py] 7") player_type = xbmc.PLAYER_CORE_AUTO if playersettings == "0": player_type = xbmc.PLAYER_CORE_AUTO logger.info("[xbmctools.py] PLAYER_CORE_AUTO") elif playersettings == "1": player_type = xbmc.PLAYER_CORE_MPLAYER logger.info("[xbmctools.py] PLAYER_CORE_MPLAYER") elif playersettings == "2": player_type = xbmc.PLAYER_CORE_DVDPLAYER logger.info("[xbmctools.py] PLAYER_CORE_DVDPLAYER") logger.info("[xbmctools.py] 8") xbmcPlayer = xbmc.Player( player_type ) xbmcPlayer.play(playlist)
def mainlist(params,url,category): logger.info("[nolomires.py] mainlist") # A�ade al listado de XBMC xbmctools.addnewfolder( CHANNELNAME , "search" , category , "Buscar","http://www.nolomires.com/","","") xbmctools.addnewfolder( CHANNELNAME , "LastSearch" , category , "Peliculas Buscadas Recientemente","http://www.nolomires.com/tag/estrenos-2010/","","") xbmctools.addnewfolder( CHANNELNAME , "listvideosMirror" , category , "Ultimos Estrenos","http://www.nolomires.com/","","") xbmctools.addnewfolder( CHANNELNAME , "TagList" , category , "Tag de Estrenos por a�o" ,"http://www.nolomires.com/","","") xbmctools.addnewfolder( CHANNELNAME , "MostWatched" , category , "Peliculas Mas Vistas","http://www.nolomires.com/","","") xbmctools.addnewfolder( CHANNELNAME , "ListaCat" , category , "Listado por Categorias" ,"http://www.nolomires.com/","","") xbmctools.addnewfolder( CHANNELNAME , "listvideos" , category , "Ultimas Pel�culas A�adidas" ,"http://www.nolomires.com/","","") if config.getSetting("singlechannel")=="true": xbmctools.addSingleChannelOptions(params,url,category) # Label (top-right)... xbmcplugin.setPluginCategory( handle=int( sys.argv[ 1 ] ), category=category ) # Disable sorting... xbmcplugin.addSortMethod( handle=int( sys.argv[ 1 ] ), sortMethod=xbmcplugin.SORT_METHOD_NONE ) # End of directory... xbmcplugin.endOfDirectory( handle=int( sys.argv[ 1 ] ), succeeded=True )
def detail(params,url,category): logger.info("[pintadibujos.py] detail") if config.getSetting("forceview")=="true": xbmc.executebuiltin("Container.SetViewMode(50)") #full list title = urllib.unquote_plus( params.get("title") ) thumbnail = urllib.unquote_plus( params.get("thumbnail") ) # Descarga la página data = scrapertools.cachePage(url) #logger.info(data) # ------------------------------------------------------------------------------------ # Busca los enlaces a los videos # ------------------------------------------------------------------------------------ listavideos = servertools.findvideos(data) for video in listavideos: xbmctools.addnewvideo( CHANNELNAME , "play" , category , video[2] , title + " - " + video[0] , video[1] , thumbnail , "" ) # ------------------------------------------------------------------------------------ # Label (top-right)... xbmcplugin.setPluginCategory( handle=pluginhandle, category=category ) # Disable sorting... xbmcplugin.addSortMethod( handle=pluginhandle, sortMethod=xbmcplugin.SORT_METHOD_NONE ) # End of directory... xbmcplugin.endOfDirectory( handle=pluginhandle, succeeded=True )
def get_last_biobank_sample_file_info(): """Finds the latest CSV & updates/inserts BiobankStoredSamples from its rows.""" bucket_name = config.getSetting(config.BIOBANK_SAMPLES_BUCKET_NAME) # raises if missing csv_file, csv_filename = _open_latest_samples_file(bucket_name) timestamp = _timestamp_from_filename(csv_filename) return csv_file, csv_filename, timestamp
def mainlist(params, url, category): logger.info("[peliculasonlineflv.py] mainlist") # Añade al listado de XBMC xbmctools.addnewfolder(CHANNELNAME, "listvideos", category, "Peliculas - Novedades", "http://peliculasonlineflv.org/", "", "") xbmctools.addnewfolder(CHANNELNAME, "ListCat", category, "Peliculas - Generos", "http://peliculasonlineflv.org/", "", "") #xbmctools.addnewfolder( CHANNELNAME , "DocuSeries" , category , "Documentales - Series Disponibles" ,"http://peliculasonlineflv.wordpress.com/","","") xbmctools.addnewfolder(CHANNELNAME, "DocuTag", category, "Peliculas - Tag", "http://peliculasonlineflv.org/", "", "") xbmctools.addnewfolder(CHANNELNAME, "DocuARCHIVO", category, "Peliculas - Archivo", "http://peliculasonlineflv.org/", "", "") xbmctools.addnewfolder(CHANNELNAME, "search", category, "Buscar", "", "", "") if config.getSetting("singlechannel") == "true": xbmctools.addSingleChannelOptions(params, url, category) # Propiedades 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 mainlist(params,url,category): logger.info("[descargacineclasico.py] mainlist") xbmctools.addnewfolder( CHANNELNAME , "movielist" , CHANNELNAME , "Aventuras" , "http://descargacineclasico.blogspot.com/search/label/Aventuras?updated-max=&max-results=1000" , "", "" ) xbmctools.addnewfolder( CHANNELNAME , "movielist" , CHANNELNAME , "Ciencia Ficción" , "http://descargacineclasico.blogspot.com/search/label/Ciencia%20Ficcion?updated-max=&max-results=1000" , "", "" ) xbmctools.addnewfolder( CHANNELNAME , "movielist" , CHANNELNAME , "Comedias" , "http://descargacineclasico.blogspot.com/search/label/Comedias?updated-max=&max-results=1000" , "", "" ) xbmctools.addnewfolder( CHANNELNAME , "movielist" , CHANNELNAME , "Drama" , "http://descargacineclasico.blogspot.com/search/label/Drama?updated-max=&max-results=1000" , "", "" ) xbmctools.addnewfolder( CHANNELNAME , "movielist" , CHANNELNAME , "Intriga" , "http://descargacineclasico.blogspot.com/search/label/Intriga?updated-max=&max-results=1000" , "", "" ) xbmctools.addnewfolder( CHANNELNAME , "movielist" , CHANNELNAME , "Románticas" , "http://descargacineclasico.blogspot.com/search/label/Romanticas?updated-max=&max-results=1000" , "", "" ) xbmctools.addnewfolder( CHANNELNAME , "movielist" , CHANNELNAME , "Series" , "http://descargacineclasico.blogspot.com/search/label/Series?updated-max=&max-results=1000" , "", "" ) xbmctools.addnewfolder( CHANNELNAME , "movielist" , CHANNELNAME , "Western" , "http://descargacineclasico.blogspot.com/search/label/Wester?updated-max=&max-results=1000" , "", "" ) xbmctools.addnewfolder( CHANNELNAME , "movielist" , CHANNELNAME , "Novedades" , "http://descargacineclasico.blogspot.com/" , "", "" ) xbmctools.addnewfolder( CHANNELNAME , "movielist" , CHANNELNAME , "Todas" , "http://descargacineclasico.blogspot.com/search?updated-max=&max-results=1000" , "", "" ) if config.getSetting("singlechannel")=="true": xbmctools.addSingleChannelOptions(params,url,category) # Label (top-right)... xbmcplugin.setPluginCategory( handle=pluginhandle, category=category ) # Disable sorting... xbmcplugin.addSortMethod( handle=pluginhandle, sortMethod=xbmcplugin.SORT_METHOD_NONE ) # End of directory... xbmcplugin.endOfDirectory( handle=pluginhandle, succeeded=True )
def listchannels(params,url,category): logger.info("[channelselector.py] listchannels") # Verifica actualizaciones solo en el primer nivel try: import updater except ImportError: logger.info("[channelselector.py] No disponible modulo actualizaciones") else: if config.getSetting("updatecheck2") == "true": logger.info("[channelselector.py] Verificar actualizaciones activado") updater.checkforupdates() else: logger.info("[channelselector.py] Verificar actualizaciones desactivado") # addfolder("Antena3","a3","mainlist") # addfolder("ADNStream","adnstream","mainlist") # addfolder("Barcelona TV","barcelonatv","mainlist") # addfolder("Clan TV","clantv","mainlist") # addfolder("El cine de las 3 mellizas","tresmellizas","mainlist") # addfolder("Boing","boing","mainlist") # #addfolder("Totlol","totlol","mainlist") # addfolder("EITB","eitb","mainlist") # addfolder("Extremadura TV","extremaduratv","mainlist") # addfolder("Hogarutil","hogarutil","mainlist") # addfolder("Plus TV","plus","mainlist") # addfolder("Andalucia TV","rtva","mainlist") # addfolder("TVE","rtve","mainlist") # addfolder("TVE Programas","rtveprogramas","mainlist") # addfolder("TVE Mediateca","rtvemediateca","mainlist") # #addfolder("TV Azteca","tva","mainlist") # addfolder("Berria TB","berriatb","mainlist") # addfolder("Earth TV","earthtv","mainlist") # addfolder("Euronews","euronews","mainlist") # addfolder("Comunidad Valenciana","rtvv","mainlist") # #addfolder("Terra TV","terratv","mainlist") # addfolder("Turbonick","turbonick","mainlist") # addfolder("TV3","tv3","mainlist") # addfolder("TVG","tvg","mainlist") # addfolder("Mallorca TV","tvmallorca","mainlist") # addfolder("Meristation","meristation","mainlist") # addfolder("7rm","sieterm","mainlist") # addfolder("Televisión Canaria","rtvc","mainlist") # addfolder("Internautas TV","internautastv","mainlist") # addfolder("Publico.tv","publicotv","mainlist") addfolder("Σκαι: Οι Νεοι Φακελοι","skai_folders","mainlist") addfolder("Σκαι TV","skai_tv","mainlist") cadena = config.getLocalizedString(30100) logger.info("cadena="+cadena) addfolder(cadena,"configuracion","mainlist") # Configuracion if (parametrizacion.DOWNLOAD_ENABLED): addfolder(config.getLocalizedString(30101),"descargados","mainlist") # Descargas addfolder(config.getLocalizedString(30102),"favoritos","mainlist") # Favoritos # Label (top-right)... xbmcplugin.setPluginCategory( handle=int( sys.argv[ 1 ] ), category="Canales" ) xbmcplugin.addSortMethod( handle=int( sys.argv[ 1 ] ), sortMethod=xbmcplugin.SORT_METHOD_NONE ) xbmcplugin.endOfDirectory( handle=int( sys.argv[ 1 ] ), succeeded=True )
def gethighurl(code): megavideologin = config.getSetting("megavideouser") if DEBUG: xbmc.output("[megaupload.py] megavideouser=#"+megavideologin+"#") megavideopassword = config.getSetting("megavideopassword") if DEBUG: xbmc.output("[megaupload.py] megavideopassword=#"+megavideopassword+"#") cookie = getmegauploaduser(megavideologin,megavideopassword) if DEBUG: xbmc.output("[megaupload.py] cookie=#"+cookie+"#") if len(cookie) == 0: advertencia = xbmcgui.Dialog() resultado = advertencia.ok('Cuenta de Megaupload errónea' , 'La cuenta de Megaupload que usas no es válida' , 'Comprueba el login y password en la configuración') return "" return getmegauploadvideo(code,cookie)
def process_genotyping_manifest_files(): bucket_names = config.getSettingList(config.GENOMIC_CENTER_BUCKET_NAME) genotyping_folder_name = config.getSetting( GENOMIC_GENOTYPING_SAMPLE_MANIFEST_FOLDER_NAME) for bucket_name in bucket_names: process_genotyping_manifest_file_from_bucket(bucket_name, genotyping_folder_name)
def mainlist(params, url, category): logger.info("[mcanime.py] mainlist") # Añade al listado de XBMC xbmctools.addnewfolder(CHANNELNAME, "home", category, "Novedades", "http://www.mcanime.net/", "", "") xbmctools.addnewfolder( CHANNELNAME, "forum", category, "Foro anime en línea", "http://www.mcanime.net/foro/viewforum.php?f=113", "", "", ) xbmctools.addnewfolder( CHANNELNAME, "ddnovedades", category, "Descarga directa - Novedades", "http://www.mcanime.net/descarga_directa/anime", "", "", ) xbmctools.addnewfolder( CHANNELNAME, "ddalpha", category, "Descarga directa - Listado alfabético", "http://www.mcanime.net/descarga_directa/anime", "", "", ) xbmctools.addnewfolder( CHANNELNAME, "ddcat", category, "Descarga directa - Categorías", "http://www.mcanime.net/descarga_directa/anime", "", "", ) xbmctools.addnewfolder( CHANNELNAME, "estrenos", category, "Enciclopedia - Estrenos", "http://www.mcanime.net/enciclopedia/estrenos/anime", "", "", ) if config.getSetting("singlechannel") == "true": xbmctools.addSingleChannelOptions(params, url, category) # Propiedades 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 FullList(params,url,category): logger.info("[mocosoftx.py] FullList") if url=="": url = "http://www.mocosoftx.com/foro/index.php?action=.xml;type=rss2;limit=500;board=14" # Descarga la página data = scrapertools.cachePage(url) #logger.info(data) # Extrae las entradas (carpetas) patron = '<item>(.*?)</item>' matchesITEM = re.compile(patron,re.DOTALL).findall(data) #scrapertools.printMatches(matchesITEM[0]) patronvideos = '<title>(.*?)</title>.*?' patronvideos += '<\!\[CDATA\[<a href="[^"]+" target="_blank"><img src="([^"]+)".*?' for match in matchesITEM: matches = re.compile(patronvideos,re.DOTALL).findall(match) scrapertools.printMatches(matches) for match2 in matches: # Titulo scrapedtitle = match2[0] scrapedtitle = scrapedtitle.replace("<![CDATA[","") scrapedtitle = scrapedtitle.replace("]]>","") # URL scrapedurl = match # Thumbnail scrapedthumbnail = match2[1] # Argumento scrapedplot = "" # Depuracion if (DEBUG): logger.info("scrapedtitle="+scrapedtitle) logger.info("scrapedurl="+scrapedurl) logger.info("scrapedthumbnail="+scrapedthumbnail) # Añade al listado de XBMC xbmctools.addnewfolder( CHANNELNAME , "detail" , category , scrapedtitle , scrapedurl , scrapedthumbnail , scrapedplot) if config.getSetting("singlechannel")=="true": xbmctools.addSingleChannelOptions(params,url,category) # Label (top-right)... xbmcplugin.setPluginCategory( handle=pluginhandle, category=category ) # Disable sorting... xbmcplugin.addSortMethod( handle=pluginhandle, sortMethod=xbmcplugin.SORT_METHOD_NONE ) # End of directory... xbmcplugin.endOfDirectory( handle=pluginhandle, succeeded=True )
def listvideos(params, url, category): logger.info("[filmesonlinebr.py] listvideos") adulto = config.getSetting("enableadultmode") if url == "": url = "http://www.filmesonlinebr.com/" # Descarga la p�gina data = scrapertools.cachePage(url) # Extrae la parte localizada del filme patronfilme = '<div class="item">.*?<div class="thumbnail" style="background: url\(([^\)]+\)) top left no-repeat;">.*?' patronfilme += '<h2><a href="([^"]+)">([^<]+)</a></h2>' matchesfilme = re.compile(patronfilme, re.DOTALL).findall(data) for match in matchesfilme: # Titulo scrapedtitle = match[2] # URL scrapedurl = match[1] # Thumbnail scrapedthumbnail = match[0] # Argumento scrapedplot = "" # Depuracion if (DEBUG): logger.info("scrapedtitle=" + scrapedtitle) logger.info("scrapedurl=" + scrapedurl) logger.info("scrapedthumbnail=" + scrapedthumbnail) # A�ade al listado de XBMC xbmctools.addnewfolder(CHANNELNAME, "detail", category, scrapedtitle, scrapedurl, scrapedthumbnail, scrapedplot) # Extrae la marca de siguiente p�gina patronvideos = "<li><a class='next page-numbers' href='([^']+)'>" matches = re.compile(patronvideos, re.DOTALL).findall(data) scrapertools.printMatches(matches) if len(matches) > 0: scrapedtitle = "P�gina siguiente" scrapedurl = urlparse.urljoin(url, matches[0]) scrapedthumbnail = "" scrapedplot = "" xbmctools.addnewfolder(CHANNELNAME, "listvideos", category, scrapedtitle, scrapedurl, scrapedthumbnail, scrapedplot) # Label (top-right)... xbmcplugin.setPluginCategory(handle=pluginhandle, category=category) # Disable sorting... xbmcplugin.addSortMethod(handle=pluginhandle, sortMethod=xbmcplugin.SORT_METHOD_NONE) # End of directory... xbmcplugin.endOfDirectory(handle=pluginhandle, succeeded=True)
def Activar_Novedades(params, activar, category): if activar == "false": config.setSetting("activar", "true") else: config.setSetting("activar", "false") print "opcion menu novedades :%s" % config.getSetting("activar") #xbmc.executebuiltin('Container.Update') xbmc.executebuiltin('Container.Refresh')
def novedades(params,url,category): logger.info("[documentalesatonline.py] novedades") # Descarga la página data = scrapertools.cachePage(url) #logger.info(data) # Extrae las entradas (carpetas) patronvideos = "<div class='post hentry'>.*?" patronvideos += "<h3 class='post-title entry-title'>[^<]+" patronvideos += "<a href='([^']+)'>([^<]+)</a>.*?" patronvideos += '<img.*?src="([^"]+)"[^>]+>(.*?)<div' matches = re.compile(patronvideos,re.DOTALL).findall(data) scrapertools.printMatches(matches) for match in matches: scrapedtitle = match[1] scrapedurl = urlparse.urljoin(url,match[0]) scrapedthumbnail = match[2] scrapedplot = scrapertools.htmlclean(match[3]) # Depuracion if (DEBUG): logger.info("scrapedtitle="+scrapedtitle) logger.info("scrapedurl="+scrapedurl) logger.info("scrapedthumbnail="+scrapedthumbnail) # Añade al listado de XBMC xbmctools.addnewfolder( CHANNELNAME , "detail" , category , scrapedtitle , scrapedurl , scrapedthumbnail , scrapedplot) # Página siguiente patronvideos = "<a class='blog-pager-older-link' href='([^']+)' id='Blog1_blog-pager-older-link' title='Entradas antiguas'>Entradas antiguas</a>" matches = re.compile(patronvideos,re.DOTALL).findall(data) scrapertools.printMatches(matches) for match in matches: scrapedtitle = "Página siguiente" scrapedurl = urlparse.urljoin(url,match) scrapedthumbnail = "" scrapedplot = "" # Depuracion if (DEBUG): logger.info("scrapedtitle="+scrapedtitle) logger.info("scrapedurl="+scrapedurl) logger.info("scrapedthumbnail="+scrapedthumbnail) # Añade al listado de XBMC xbmctools.addnewfolder( CHANNELNAME , "novedades" , category , scrapedtitle , scrapedurl , scrapedthumbnail , scrapedplot) if config.getSetting("singlechannel")=="true": xbmctools.addSingleChannelOptions(params,url,category) # Label (top-right)... xbmcplugin.setPluginCategory( handle=pluginhandle, category=category ) xbmcplugin.addSortMethod( handle=pluginhandle, sortMethod=xbmcplugin.SORT_METHOD_NONE ) xbmcplugin.endOfDirectory( handle=pluginhandle, succeeded=True )
def Activar_Novedades(params,activar,category): if activar == "false": config.setSetting("activar","true") else: config.setSetting("activar","false") print "opcion menu novedades :%s" %config.getSetting("activar") #xbmc.executebuiltin('Container.Update') xbmc.executebuiltin('Container.Refresh')
def geturl( id ): print '[pelisalacarta] youtube.py Modulo: geturl(%s)' %id quality = int(config.getSetting("quality_youtube")) if id != "": url = "http://www.youtube.com/watch?v=%s" % id print 'esta es la url: %s'%url req = urllib2.Request(url) req.add_header('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) data = response.read() response.close() if data != "": print "Calidad encontrada es :%s" %quality if quality == 8: videourl = geturls(id,data) return videourl regexp = re.compile(r'fmt_stream_map=([^\&]+)\&') match = regexp.search(data) print 'match : %s'%str(match) videourl = "" if match is not None: fmt_stream_map = urllib.unquote_plus(match.group(1)) print "fmt_stream_map :%s" %fmt_stream_map videourls = dict (nvp.replace("|http","*http").split("*") for nvp in fmt_stream_map.split(",")) print videourls while True: Tquality = AVAILABLE_FORMATS[quality] print "AVAILABLE FORMAT :%s %s" %(Tquality,AVAILABLE_FORMATS2[Tquality]) #videourl1 = "http://www.youtube.com/get_video?t=%s&video_id=%s&fmt=%s" % ( tParam ,id,Tquality) try: #videourl = verify_url( videourl1.encode( 'utf-8' ) ).decode( 'utf-8' ) videourl = videourls[Tquality] break except: quality -= 1 if quality == -1: break try: print "Quality Found: (%s) %s " % (AVAILABLE_FORMATS[quality],AVAILABLE_FORMATS2[AVAILABLE_FORMATS[quality]]) except: print "Quality not available, result : -1" if videourl == "": alertaCalidad() return "Esc" return videourl else: alertaNone() else: alertaNone() return "Esc"
def listvideos(params,url,category): logger.info("[filmesonlinebr.py] listvideos") adulto = config.getSetting("enableadultmode") if url=="": url = "http://www.filmesonlinebr.com/" # Descarga la p�gina data = scrapertools.cachePage(url) # Extrae la parte localizada del filme patronfilme ='<div class="item">.*?<div class="thumbnail" style="background: url\(([^\)]+\)) top left no-repeat;">.*?' patronfilme +='<h2><a href="([^"]+)">([^<]+)</a></h2>' matchesfilme = re.compile(patronfilme,re.DOTALL).findall(data) for match in matchesfilme: # Titulo scrapedtitle = match[2] # URL scrapedurl = match[1] # Thumbnail scrapedthumbnail = match[0] # Argumento scrapedplot = "" # Depuracion if (DEBUG): logger.info("scrapedtitle="+scrapedtitle) logger.info("scrapedurl="+scrapedurl) logger.info("scrapedthumbnail="+scrapedthumbnail) # A�ade al listado de XBMC xbmctools.addnewfolder( CHANNELNAME , "detail" , category , scrapedtitle , scrapedurl , scrapedthumbnail, scrapedplot ) # Extrae la marca de siguiente p�gina patronvideos = "<li><a class='next page-numbers' href='([^']+)'>" matches = re.compile(patronvideos,re.DOTALL).findall(data) scrapertools.printMatches(matches) if len(matches)>0: scrapedtitle = "P�gina siguiente" scrapedurl = urlparse.urljoin(url,matches[0]) scrapedthumbnail = "" scrapedplot = "" xbmctools.addnewfolder( CHANNELNAME , "listvideos" , category , scrapedtitle , scrapedurl , scrapedthumbnail, scrapedplot ) # Label (top-right)... xbmcplugin.setPluginCategory( handle=pluginhandle, category=category ) # Disable sorting... xbmcplugin.addSortMethod( handle=pluginhandle, sortMethod=xbmcplugin.SORT_METHOD_NONE ) # End of directory... xbmcplugin.endOfDirectory( handle=pluginhandle, succeeded=True )
def gethighurl(code): xbmc.output("[megaporn.py] Usa modo premium") code = getcode(code) try: megaporncookie = config.getSetting("megaporncookie") if DEBUG: xbmc.output("[megaporn.py] megaporncookie=#"+megaporncookie+"#") #if megaporncookie=="": xbmc.output("[megaporn.py] Averiguando cookie...") megapornlogin = config.getSetting("megapornuser") if DEBUG: xbmc.output("[megaporn.py] megapornuser=#"+megapornlogin+"#") megapornpassword = config.getSetting("megapornpassword") if DEBUG: xbmc.output("[megaporn.py] megapornpassword=#"+megapornpassword+"#") megaporncookie = GetMegapornUser(megapornlogin, megapornpassword) if DEBUG: xbmc.output("[megaporn.py] megaporncookie=#"+megaporncookie+"#") except: megaporcookie = "" if len(megaporncookie) == 0: advertencia = xbmcgui.Dialog() resultado = advertencia.ok('Cuenta de Megaporn errónea' , 'La cuenta de Megaporn que usas no es válida' , 'Comprueba el login y password en la configuración') return "" req = urllib2.Request("http://www.megaporn.com/video/xml/player_login.php?u="+megaporncookie+"&v="+code) req.add_header('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) data=response.read() response.close() # saca los enlaces patronvideos = 'downloadurl="([^"]+)"' matches = re.compile(patronvideos,re.DOTALL).findall(data) movielink = "" if len(matches)>0: movielink = matches[0] movielink = movielink.replace("%3A",":") movielink = movielink.replace("%2F","/") movielink = movielink.replace("%20"," ") return movielink
def listseriesthumbnails(params,url,category): logger.info("[seriesyonkis.py] listseriesthumbnails") if config.getSetting("forceview")=="true": xbmc.executebuiltin("Container.SetViewMode(53)") #53=icons # Descarga la página data = scrapertools.cachePage(url) #logger.info(data) # Extrae las entradas (carpetas) #<td><center><a href='http://www.seriesyonkis.com/serie/a-camara-super-lenta/' title='A cámara súper lenta'><img src='http://images.seriesyonkis.com/images/a-camara-super-lenta.jpg' alt='A cámara súper lenta'/><br />A cámara súper lenta</a></center></td> if 'Numeric' in url: patronvideos = "<td><center><a href='([^']+)' title='([^']+)'><img src='([^']+)'.*?</td>" t=1 h=0 else: patronvideos = "<td><center><a title='([^']+)' href='([^']+)'><img src='([^']+)'.*?</td>" t=0 h=1 matches = re.compile(patronvideos,re.DOTALL).findall(data) scrapertools.printMatches(matches) for match in matches: # Titulo scrapedtitle = match[t] # URL scrapedurl = match[h] # Thumbnail scrapedthumbnail = match[2] # procesa el resto scrapedplot = "" Serie = scrapedtitle # JUR-Añade nombre serie para librería # Depuracion if (DEBUG): logger.info("scrapedtitle="+scrapedtitle) logger.info("scrapedurl="+scrapedurl) logger.info("scrapedthumbnail="+scrapedthumbnail) logger.info("Serie="+Serie) # Añade al listado de XBMC xbmctools.addnewfolder( CHANNELNAME , "list" , category , scrapedtitle , scrapedurl , scrapedthumbnail , scrapedplot, Serie ) # Label (top-right)... xbmcplugin.setPluginCategory( handle=int( sys.argv[ 1 ] ), category=category ) # Disable sorting... xbmcplugin.addSortMethod( handle=int( sys.argv[ 1 ] ), sortMethod=xbmcplugin.SORT_METHOD_NONE ) # End of directory... xbmcplugin.endOfDirectory( handle=int( sys.argv[ 1 ] ), succeeded=True )
def mainlist(params,url,category): logger.info("[documentalesyonkis.py] mainlist") if config.getSetting("forceview")=="true": xbmc.executebuiltin("Container.SetViewMode(50)") #full list xbmctools.addnewfolder( CHANNELNAME , "lastvideolist" , category , "Últimos documentales","http://documentales.videosyonkis.com/ultimos-videos.php","","") xbmctools.addnewfolder( CHANNELNAME , "allvideolist" , category , "Listado completo","http://documentales.videosyonkis.com/lista-videos.php","","") if config.getSetting("singlechannel")=="true": xbmctools.addSingleChannelOptions(params,url,category) # Label (top-right)... xbmcplugin.setPluginCategory( handle=int( sys.argv[ 1 ] ), category=category ) # Disable sorting... xbmcplugin.addSortMethod( handle=int( sys.argv[ 1 ] ), sortMethod=xbmcplugin.SORT_METHOD_NONE ) # End of directory... xbmcplugin.endOfDirectory( handle=int( sys.argv[ 1 ] ), succeeded=True )
def recalculate_metrics(): in_progress = MetricsVersionDao().get_version_in_progress() if in_progress: logging.info("=========== Metrics pipeline already running ============") return '{"metrics-pipeline-status": "running"}' else: bucket_name = app_identity.get_default_gcs_bucket_name() logging.info("=========== Starting metrics export ============") MetricsExport.start_export_tasks(bucket_name, int(config.getSetting(config.METRICS_SHARDS, 1))) return '{"metrics-pipeline-status": "started"}'
def _get_sheet_id(): """ Get the google sheet id for the bucket-name-to-organization-external-id mapping """ hpo_report_config_mixin_path = config.getSetting( config.HPO_REPORT_CONFIG_MIXIN_PATH) with cloudstorage.open(hpo_report_config_mixin_path, 'r') as handle: hpo_config = json.load(handle) sheet_id = hpo_config.get('hpo_report_google_sheet_id') if sheet_id is None: raise ValueError("Missing config value: hpo_report_google_sheet_id") return sheet_id
def listcategorias(params,url,category): logger.info("[dospuntocerovision.py] listcategorias") if config.getSetting("forceview")=="true": xbmc.executebuiltin("Container.SetViewMode(50)") #full list patronvideos = '<a onblur=.*?href="(.*?)"><img.*?src="(.*?)" alt=' # Descarga la p�gina data = scrapertools.cachePage(url) #logger.info(data) # Extrae las entradas (carpetas) matches = re.compile(patronvideos,re.DOTALL).findall(data) scrapertools.printMatches(matches) for match in matches: # URL scrapedurl = match[0] #http://1.bp.blogspot.com/__kdloiikFIQ/SftOQ_gIDsI/AAAAAAAAbE8/mboXI4XyhyA/s400/accion.jpg # Titulo for campo in re.findall("http://.*?/.*?/.*?/.*?/.*?/.*?/(.*?).jpg",match[1]): scrapedtitle = campo scrapedtitle = scrapedtitle.replace("+"," ") # Thumbnail scrapedthumbnail = match[1] # procesa el resto scrapedplot = "" # Depuracion if (DEBUG): logger.info("scrapedtitle="+scrapedtitle) logger.info("scrapedurl="+scrapedurl) logger.info("scrapedthumbnail="+scrapedthumbnail) # A�ade al listado de XBMC xbmctools.addnewfolder( CHANNELNAME , "listcategoriasvideos" , category , scrapedtitle , scrapedurl , scrapedthumbnail , scrapedplot ) # Label (top-right)... xbmcplugin.setPluginCategory( handle=int( sys.argv[ 1 ] ), category=category ) # Disable sorting... xbmcplugin.addSortMethod( handle=int( sys.argv[ 1 ] ), sortMethod=xbmcplugin.SORT_METHOD_NONE ) # End of directory... xbmcplugin.endOfDirectory( handle=int( sys.argv[ 1 ] ), succeeded=True )
def gethighurl(code): megavideologin = config.getSetting("megavideouser") if DEBUG: xbmc.output("[megaupload.py] megavideouser=#" + megavideologin + "#") megavideopassword = config.getSetting("megavideopassword") if DEBUG: xbmc.output("[megaupload.py] megavideopassword=#" + megavideopassword + "#") cookie = getmegauploaduser(megavideologin, megavideopassword) if DEBUG: xbmc.output("[megaupload.py] cookie=#" + cookie + "#") if len(cookie) == 0: advertencia = xbmcgui.Dialog() resultado = advertencia.ok( 'Cuenta de Megaupload errónea', 'La cuenta de Megaupload que usas no es válida', 'Comprueba el login y password en la configuración') return "" return getmegauploadvideo(code, cookie)
def movielist(params,url,category): logger.info("[pintadibujos.py] mainlist") if config.getSetting("forceview")=="true": xbmc.executebuiltin("Container.SetViewMode(53)") #53=icons # Descarga la página data = scrapertools.cachePage(url) #logger.info(data) # Extrae las entradas (carpetas) patronvideos = '<td><a href="([^"]+)" target="_blank"><img SRC="([^"]+)"(| ALT=".*?") BORDER' matches = re.compile(patronvideos,re.DOTALL).findall(data) scrapertools.printMatches(matches) for match in matches: # Titulo if match[2] == "": longitud = len(match[1]) scrapedtitle = match[1][:longitud-4] scrapedtitle = scrapedtitle.replace("_"," ") else: scrapedtitle = match[2].replace(" ALT=","") scrapedtitle = scrapedtitle.replace('"','') # URL scrapedurl = urlparse.urljoin(url,match[0]) # Thumbnail scrapedthumbnail = urlparse.urljoin(url,match[1]) # procesa el resto scrapeddescription = "" # Depuracion if (DEBUG): logger.info("scrapedtitle="+scrapedtitle) logger.info("scrapedurl="+scrapedurl) logger.info("scrapedthumbnail="+scrapedthumbnail) # Añade al listado de XBMC xbmctools.addthumbnailfolder( CHANNELNAME , scrapedtitle , scrapedurl , scrapedthumbnail, "detail" ) # Label (top-right)... xbmcplugin.setPluginCategory( handle=pluginhandle, category=category ) # Disable sorting... xbmcplugin.addSortMethod( handle=pluginhandle, sortMethod=xbmcplugin.SORT_METHOD_NONE ) # End of directory... xbmcplugin.endOfDirectory( handle=pluginhandle, succeeded=True )
def delete_service_account_keys(): days_to_delete = config.getSetting(config.DAYS_TO_DELETE_KEYS) service_accounts_with_long_lived_keys = config.getSettingList( config.SERVICE_ACCOUNTS_WITH_LONG_LIVED_KEYS, default=[]) app_id = app_identity.get_application_id() if app_id is None: return project_name = 'projects/' + app_id try: service = discovery.build('iam', 'v1') request = service.projects().serviceAccounts().list(name=project_name) response = request.execute() accounts = response['accounts'] for account in accounts: if account['email'] in service_accounts_with_long_lived_keys: logging.info( 'Skip key expiration check for Service Account {}'.format( account)) continue serviceaccount = project_name + '/serviceAccounts/' + account[ 'email'] request = service.projects().serviceAccounts().keys().list( name=serviceaccount, keyTypes='USER_MANAGED') response = request.execute() if 'keys' in response: keys = response['keys'] for key in keys: keyname = key['name'] startdate = datetime.strptime(key['validAfterTime'], '%Y-%m-%dT%H:%M:%SZ') key_age_days = (datetime.utcnow() - startdate).days if key_age_days >= days_to_delete: logging.warning( 'Deleting service Account key older than {} days [{}]: {}' .format(days_to_delete, key_age_days, keyname)) delete_request = service.projects().serviceAccounts( ).keys().delete(name=keyname) delete_request.execute() else: logging.info( 'Service Account key is {} days old: {}'.format( key_age_days, keyname)) except KeyError: logging.info( 'No Service Accounts found in project "{}"'.format(app_id))
def mainlist(params,url,category): logger.info("[channelselector.py] mainlist") # Verifica actualizaciones solo en el primer nivel try: import updater except ImportError: logger.info("[channelselector.py] No disponible modulo actualizaciones") else: if config.getSetting("updatecheck2") == "true": logger.info("[channelselector.py] Verificar actualizaciones activado") updater.checkforupdates() else: logger.info("[channelselector.py] Verificar actualizaciones desactivado") idioma = config.getSetting("languagefilter") logger.info("[channelselector.py] idioma=%s" % idioma) langlistv = [config.getLocalizedString(30025),config.getLocalizedString(30026),config.getLocalizedString(30027),config.getLocalizedString(30028),config.getLocalizedString(30029)] try: idiomav = langlistv[int(idioma)] except: idiomav = langlistv[0] #logger.info("[channelselector.py] idiomav=%s" % idiomav) addfolder(config.getLocalizedString(30118)+" ("+idiomav+")","channelselector","channeltypes") #searchwebs=": Cinetube,Peliculasyonkis,Cinegratis,tumejortv.com,Peliculas21,Cine15,Seriesyonkis,Yotix.tv,DocumaniaTV,Discoverymx,Stagevu,tu.tv" #channelslist.append([ config.getLocalizedString(30103)+searchwebs , "buscador" , "Buscador" , "" , "B" ])# Buscador addfolder(config.getLocalizedString(30103),"buscador" ,"mainlist") addfolder(config.getLocalizedString(30128),"trailertools" ,"mainlist") addfolder(config.getLocalizedString(30102),"favoritos" ,"mainlist") if (DOWNLOAD_ENABLED): addfolder(config.getLocalizedString(30101),"descargados","mainlist") addfolder(config.getLocalizedString(30100),"configuracion" ,"mainlist") addfolder(config.getLocalizedString(30104),"ayuda" ,"mainlist") # Label (top-right)... import xbmcplugin xbmcplugin.setPluginCategory( handle=int( sys.argv[ 1 ] ), category="" ) xbmcplugin.addSortMethod( handle=int( sys.argv[ 1 ] ), sortMethod=xbmcplugin.SORT_METHOD_NONE ) xbmcplugin.endOfDirectory( handle=int( sys.argv[ 1 ] ), succeeded=True )
def make_update_participant_summaries_job(): config_param = config.EHR_STATUS_BIGQUERY_VIEW_PARTICIPANT try: bigquery_view = config.getSetting(config_param, None) except config.InvalidConfigException as e: LOG.warn("Config lookup exception for {}: {}".format(config_param, e)) bigquery_view = None if bigquery_view: query = 'SELECT person_id FROM `{}`'.format(bigquery_view) return cloud_utils.bigquery.BigQueryJob( query, default_dataset_id='operations_analytics', page_size=1000 ) else: return None
def _validate_consent_pdfs(resource): """Checks for any consent-form-signed-pdf extensions and validates their PDFs in GCS.""" if resource.get('resourceType') != 'QuestionnaireResponse': raise ValueError('Expected QuestionnaireResponse for "resourceType" in %r.' % resource) consent_bucket = config.getSetting(config.CONSENT_PDF_BUCKET) for extension in resource.get('extension', []): if extension['url'] != _SIGNED_CONSENT_EXTENSION: continue local_pdf_path = extension['valueString'] _, ext = os.path.splitext(local_pdf_path) if ext.lower() != '.pdf': raise BadRequest('Signed PDF must end in .pdf, found %r (from %r).' % (ext, local_pdf_path)) # Treat the value as a bucket-relative path, allowing a leading slash or not. if not local_pdf_path.startswith('/'): local_pdf_path = '/' + local_pdf_path _raise_if_gcloud_file_missing('/%s%s' % (consent_bucket, local_pdf_path))
def make_update_organizations_job(): config_param = config.EHR_STATUS_BIGQUERY_VIEW_ORGANIZATION try: bigquery_view = config.getSetting(config_param, None) except config.InvalidConfigException as e: LOG.warn("Config lookup exception for {}: {}".format(config_param, e)) bigquery_view = None if bigquery_view: query = 'SELECT org_id, person_upload_time FROM `{}`'.format(bigquery_view) return cloud_utils.bigquery.BigQueryJob( query, default_dataset_id='operations_analytics', page_size=1000 ) else: return None
def upsert_from_latest_csv(): """Finds the latest CSV & updates/inserts BiobankStoredSamples from its rows.""" bucket_name = config.getSetting(config.BIOBANK_SAMPLES_BUCKET_NAME) # raises if missing csv_file, csv_filename = _open_latest_samples_file(bucket_name) timestamp = _timestamp_from_filename(csv_filename) now = clock.CLOCK.now() if now - timestamp > _MAX_INPUT_AGE: raise DataError( 'Input %r (timestamp %s UTC) is > 24h old (relative to %s UTC), not importing.' % (csv_filename, timestamp, now), external=True) csv_reader = csv.DictReader(csv_file, delimiter='\t') written = _upsert_samples_from_csv(csv_reader) ParticipantSummaryDao().update_from_biobank_stored_samples() return written, timestamp
def mainlist(params, url, category): logger.info("[pelispekes.py] mainlist") # Añade al listado de XBMC xbmctools.addnewfolder(CHANNELNAME, "novedades", category, "Novedades", "http://pelispekes.com/", "", "") xbmctools.addnewfolder(CHANNELNAME, "Listcat", category, "Categorias", "http://pelispekes.com/", "", "") if config.getSetting("singlechannel") == "true": xbmctools.addSingleChannelOptions(params, url, category) # Cierra el directorio 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 getDownloadListPath(): # La ruta de la lista de descargas es un parámetro downloadpath = config.getSetting("downloadlistpath") # No está fijada, intenta forzarla try: if downloadpath == "": logger.info("[downloadtools.py] downloadpath está vacio") # Busca un setting del skin (Telebision) try: import xbmc downloadpath = xbmc.getInfoLabel('Skin.String(downloadpath)') logger.info("[downloadtools.py] downloadpath en el skin es "+downloadpath) except: pass # No es Telebision, fuerza el directorio home de XBMC if downloadpath == "": downloadpath = os.path.join (config.DATA_PATH,"downloads","list") logger.info("[downloadtools.py] getDownloadPath: downloadpath=%s" % downloadpath) if not os.path.exists(downloadpath): logger.info("[downliadtools.py] download path doesn't exist:"+downloadpath) os.mkdir(downloadpath) config.setSetting("downloadlistpath",downloadpath) # Es Telebision, lo pone en el skin else: # guardar setting del skin en setting del plugin downloadpath = os.path.join( downloadpath , "list" ) downloadpath = xbmc.translatePath( downloadpath ) logger.info("[downloadtools.py] downloadpath nativo es "+downloadpath) config.setSetting("downloadlistpath", downloadpath) except: pass logger.info("[downloadtools.py] downloadlistpath="+downloadpath) try: os.mkdir(downloadpath) except: pass return downloadpath
def detail(params, url, category): logger.info("[filmesonlinebr.py] detail") adulto = config.getSetting("enableadultmode") title = xbmc.getInfoLabel("ListItem.Title") thumbnail = urllib.unquote_plus(params.get("thumbnail")) plot = unicode(xbmc.getInfoLabel("ListItem.Plot"), "utf-8") if url == "": url = "http://www.filmesonlinebr.com/" # Descarga la p�gina data = scrapertools.cachePage(url) # Extrae las entradas (videos) # patron = '<div id="article">[^<]+<h2>(.*?)<h2>Comments:</h2>' matchtype = re.compile(patron, re.DOTALL).findall(data) print "matchtype :%s" % matchtype[0] if ("porno" or "p**nô" or "xxx") in string.lower(matchtype[0]): if adulto == "false": advertencia() return matches = megasearch(matchtype, data) listar(title, thumbnail, plot, matches, category) else: patron = "<h2(.*?)</h2>" matchtemp = re.compile(patron, re.DOTALL).findall(data) print matchtemp if len(matchtemp) > 0: patron = "<h2(.*?)</h2>" matchtemp = re.compile(patron, re.DOTALL).findall(matchtype[0]) try: if "Temporada " in matchtemp[0]: for match in matchtemp: patron = "<h2%s(.*?)</p>" % match[0] matchesdata = re.compile(patron, re.DOTALL).findall( matchtype[0]) print matchesdata[0] matches = megasearch(matchtype, matchesdata[0]) titulo = re.sub("<[^>]+>", " ", match).replace(">", "") listar(titulo, thumbnail, plot, matches, category) except: matches = megasearch(matchtype, data) listar(title, thumbnail, plot, matches, category) close_directory(params, url, category)