def alphaserieslist(params,url,category):
	logger.info("[watchanimeon.py] alphaserieslist")

	xbmctools.addnewfolder( CHANNELNAME ,"singleletterserieslist", category , ".",url,"","")
	xbmctools.addnewfolder( CHANNELNAME ,"singleletterserieslist", category , "A",url,"","")
	xbmctools.addnewfolder( CHANNELNAME ,"singleletterserieslist", category , "B",url,"","")
	xbmctools.addnewfolder( CHANNELNAME ,"singleletterserieslist", category , "C",url,"","")
	xbmctools.addnewfolder( CHANNELNAME ,"singleletterserieslist", category , "D",url,"","")
	xbmctools.addnewfolder( CHANNELNAME ,"singleletterserieslist", category , "E",url,"","")
	xbmctools.addnewfolder( CHANNELNAME ,"singleletterserieslist", category , "F",url,"","")
	xbmctools.addnewfolder( CHANNELNAME ,"singleletterserieslist", category , "G",url,"","")
	xbmctools.addnewfolder( CHANNELNAME ,"singleletterserieslist", category , "H",url,"","")
	xbmctools.addnewfolder( CHANNELNAME ,"singleletterserieslist", category , "I",url,"","")
	xbmctools.addnewfolder( CHANNELNAME ,"singleletterserieslist", category , "J",url,"","")
	xbmctools.addnewfolder( CHANNELNAME ,"singleletterserieslist", category , "K",url,"","")
	xbmctools.addnewfolder( CHANNELNAME ,"singleletterserieslist", category , "L",url,"","")
	xbmctools.addnewfolder( CHANNELNAME ,"singleletterserieslist", category , "M",url,"","")
	xbmctools.addnewfolder( CHANNELNAME ,"singleletterserieslist", category , "N",url,"","")
	xbmctools.addnewfolder( CHANNELNAME ,"singleletterserieslist", category , "O",url,"","")
	xbmctools.addnewfolder( CHANNELNAME ,"singleletterserieslist", category , "P",url,"","")
	xbmctools.addnewfolder( CHANNELNAME ,"singleletterserieslist", category , "Q",url,"","")
	xbmctools.addnewfolder( CHANNELNAME ,"singleletterserieslist", category , "R",url,"","")
	xbmctools.addnewfolder( CHANNELNAME ,"singleletterserieslist", category , "S",url,"","")
	xbmctools.addnewfolder( CHANNELNAME ,"singleletterserieslist", category , "T",url,"","")
	xbmctools.addnewfolder( CHANNELNAME ,"singleletterserieslist", category , "U",url,"","")
	xbmctools.addnewfolder( CHANNELNAME ,"singleletterserieslist", category , "V",url,"","")
	xbmctools.addnewfolder( CHANNELNAME ,"singleletterserieslist", category , "W",url,"","")
	xbmctools.addnewfolder( CHANNELNAME ,"singleletterserieslist", category , "X",url,"","")
	xbmctools.addnewfolder( CHANNELNAME ,"singleletterserieslist", category , "Y",url,"","")
	xbmctools.addnewfolder( CHANNELNAME ,"singleletterserieslist", category , "Z",url,"","")

	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("[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 searchresults(params,url,category):
	xbmc.output("[peliculasyonkis.py] searchresults")

	if xbmctools.getPluginSetting("forceview")=="true":
		xbmc.executebuiltin("Container.SetViewMode(53)")  #53=icons

	# Descarga la página
	data = scrapertools.cachePage(url)
	#xbmc.output(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): xbmc.output("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 allmovieslist(params,url,category):
	logger.info("[watchanimeon.py] allmovieslist")

	# Descarga la página
	data = scrapertools.cachePage(url)

	# Extrae el bloque con las entradas correspondientes a esa letra
	patron = '<ul class="sip-list">(.*?)</ul>'
	matches = re.compile(patron,re.DOTALL).findall(data)
	scrapertools.printMatches(matches)

	if len(matches)>0:
		data = matches[0]

	# Ahora extrae las series
	patron = '<li><a href="([^"]+)"[^>]+>([^<]+)</a></li>'
	matches = re.compile(patron,re.DOTALL).findall(data)
	scrapertools.printMatches(matches)

	# Las añade a XBMC
	for match in matches:
		scrapedtitle = match[1].replace("&#8211;","-")
		scrapedurl = urlparse.urljoin(url,match[0])
		scrapedthumbnail = ""
		scrapedplot = ""
		if (DEBUG): logger.info("title=["+scrapedtitle+"], url=["+scrapedurl+"], thumbnail=["+scrapedthumbnail+"]")

		# Añade al listado de XBMC
		xbmctools.addnewfolder( CHANNELNAME , "detallecapitulo" , category , scrapedtitle , scrapedurl , scrapedthumbnail, scrapedplot )

	# Asigna el título, desactiva la ordenación, y cierra el directorio
	xbmcplugin.setPluginCategory( handle=pluginhandle, category=category )
	xbmcplugin.addSortMethod( handle=pluginhandle, sortMethod=xbmcplugin.SORT_METHOD_NONE )
	xbmcplugin.endOfDirectory( handle=pluginhandle, succeeded=True )
def mainlist(params, url, category):
    xbmc.output("[veocine.py] mainlist")

    # Añade al listado de XBMC
    xbmctools.addnewfolder(CHANNELNAME, "videolist", "", "Peliculas", "http://www.veocine.es/peliculas.html", "", "")
    xbmctools.addnewfolder(
        CHANNELNAME, "videolist", "", "Documentales", "http://www.veocine.es/documentales.html", "", ""
    )
    xbmctools.addnewfolder(
        CHANNELNAME, "videolist", "", "Peliculas infantiles", "http://www.veocine.es/infantil.html", "", ""
    )
    xbmctools.addnewfolder(
        CHANNELNAME, "videolist", "", "Peliculas VOS", "http://www.veocine.es/peliculavos.html", "", ""
    )
    xbmctools.addnewfolder(CHANNELNAME, "videolist", "", "Anime", "http://www.veocine.es/anime.html", "", "")

    if xbmctools.getPluginSetting("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.listchannels")

    lista = filterchannels(category)
    for channel in lista:
        if channel.type=="xbmc" or channel.type=="generic":
            if channel.channel=="personal":
                thumbnail=config.get_setting("personalchannellogo")
            elif channel.channel=="personal2":
                thumbnail=config.get_setting("personalchannellogo2")
            elif channel.channel=="personal3":
                thumbnail=config.get_setting("personalchannellogo3")
            elif channel.channel=="personal4":
                thumbnail=config.get_setting("personalchannellogo4")
            elif channel.channel=="personal5":
                thumbnail=config.get_setting("personalchannellogo5")
            else:
                thumbnail=channel.thumbnail
                if thumbnail == "":
                    thumbnail=urlparse.urljoin(get_thumbnail_path(),channel.channel+".png")
            addfolder(channel.title , channel.channel , "mainlist" , channel.channel, thumbnail = thumbnail)

    # 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 )

    if config.get_setting("forceview")=="true":
        # Confluence - Thumbnail
        import xbmc
        xbmc.executebuiltin("Container.SetViewMode(500)")
def ListadoTotal(params,url,category):
	logger.info("[peliculas24h.py] ListadoTotal")

	# Descarga la p�gina
	data = scrapertools.cachePage(url)
	#logger.info(data)

	# Patron de las entradas
	patron = "<a dir='ltr' href='([^']+)'>(.*?)</a>"
	matches = re.compile(patron,re.DOTALL).findall(data)
	scrapertools.printMatches(matches)

	# A�ade las entradas encontradas
	for match in matches:
		# Atributos
		scrapedtitle = match[1]
		scrapedurl = match[0]
		scrapedthumbnail = ""
		scrapedplot = ""
		if (DEBUG): logger.info("title=["+scrapedtitle+"], url=["+scrapedurl+"], thumbnail=["+scrapedthumbnail+"]")

		# A�ade al listado de XBMC
		xbmctools.addnewfolder( CHANNELNAME , "detail" , category , scrapedtitle , scrapedurl , scrapedthumbnail, scrapedplot )

	# Asigna el t�tulo, desactiva la ordenaci�n, y cierra el directorio
	xbmcplugin.setPluginCategory( handle=pluginhandle, category=category )
	xbmcplugin.addSortMethod( handle=pluginhandle, sortMethod=xbmcplugin.SORT_METHOD_NONE )
	xbmcplugin.endOfDirectory( handle=pluginhandle, succeeded=True )
def parsewebcategorias(params,url,category):
    logger.info("[redestv.py] buscacategorias")
    data = scrapertools.cachePage("http://www.redes-tv.com/index.php?option=com_xmap&sitemap=1&Itemid=31")
    #href='http://www.redestv.com/category/arte/' title="ARTE">ARTE</a></li><li><a
    #href="/index.php?option=com_content&amp;view=category&amp;layout=blog&amp;id=1&amp;Itemid=9" title="Biotecnolog\xc3\xada y Salud"
    patronvideos  = "index.php." + url + '(.*?)</ul>'
    #patronvideos=patronvideos.replace("&","\&")
    #patronvideos=patronvideos.replace(";","\;")
    #patronvideos=patronvideos.replace("=","\=")
    #patronvideos=patronvideos.replace("_","\_")
    #logger.info(patronvideos)
    #logger.info("web"+data)
    matches = re.compile(patronvideos,re.DOTALL).findall(data)
    if DEBUG:
        scrapertools.printMatches(matches)
    if len(matches)>0:
        #href="/index.php?option=com_content&amp;view=article&amp;id=65:473-farmacos-para-las-emociones&amp;catid=1:biosalud&amp;Itemid=9" title="473: Fármacos para las emociones"
        patronvideos = 'href="(.+?)" title="(.+?)"'
        matches1 = re.compile(patronvideos).findall(matches[0])
        for i in range(len(matches1)):
            #xbmctools.addnewvideo( CHANNELNAME , "buscavideos" , category, matches1[i][1] , matches1[i][0] , "thumbnail" , "")
            xbmctools.addnewvideo( CHANNELNAME , "buscavideos" , category , "redestv",  matches1[i][1] , matches1[i][0] , "thumbnail" , "")
 
    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 novedades(params,url,category):
    logger.info("[redestv.py] parseweb")
 
    # ------------------------------------------------------
    # Descarga la página
    # ------------------------------------------------------
    data = scrapertools.cachePage(url)
    #logger.info(data)
 
    #<div style="text-align: justify;">Cre?amos que el ser humano era el ?nico animal capaz de sentir empat?a.  Sin embargo, el altruismo existe en muchos otros animales. Estar  conectado con los dem?s, entenderlos y sentir su dolor no es exclusivo  del ser humano. El prim?tologo Frans de Waal, gran estudiador de las  emociones animales, habla con Punset sobre empat?a y simpat?a,  capacidades clave para el ?xito en la vida social.</div><div class="jcomments-links"> <a href="/index.php?option=com_content&amp;view=article&amp;id=161:501-nuestro-cerebro-altruista&amp;catid=2:cermen&amp;Itemid=10#addcomments" class="comment-link">Escribir un comentario</a></div> 
 
    patronvideos  = '<td class="contentheading" width="100%">.+?<a href="(.+?)" class="contentpagetitle">\s+(\d+.+?)</a>'
    #patronvideos  = '<div style="text-align: justify;">.+?</div>.+?<a href="(.+?)#'
 
    #logger.info("web"+data)
    matches = re.compile(patronvideos,re.DOTALL).findall(data)
    if DEBUG:
        scrapertools.printMatches(matches)
    #xbmctools.addnewfolder( CHANNELNAME , "buscavideos" , category, "redestv" , "http://www.redes-tv.com"+matches[0][0] , "" , "")
    #scrapertools.printMatches(matches)
 
    #    patronvideos1 = 'src="http://www.megavideo.com/v/(.{8}).+?".+?></embed>.*?<p>(.+?)</p><div'
    #    matches1 = re.compile(patronvideos1,re.DOTALL).findall(data)
    #    if DEBUG:
    #        scrapertools.printMatches(matches1)
 
    for i in range(len(matches)):
        xbmctools.addnewvideo( CHANNELNAME , "buscavideos" , category , "redestv" , matches[i][1] , matches[i][0] , "thumbnail" , "")
 
    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 )
Пример #10
0
def listchannels(params, url, category):
    xbmc.output("[channelselector.py] listchannels")

    # Verifica actualizaciones solo en el primer nivel
    if xbmcplugin.getSetting("updatecheck2") == "true":
        xbmc.output("updatecheck2=true")
        import updater

        updater.checkforupdates()
    else:
        xbmc.output("updatecheck2=false")

    CHANNELNAME = "kideoschannel"
    xbmctools.addnewfolder(CHANNELNAME, "ageslist", CHANNELNAME, xbmc.getLocalizedString(30501), "", "", "")
    xbmctools.addnewfolder(CHANNELNAME, "categorylist", CHANNELNAME, xbmc.getLocalizedString(30502), "", "", "")
    xbmctools.addnewfolder(CHANNELNAME, "userlist", CHANNELNAME, xbmc.getLocalizedString(30503), "", "", "")
    xbmctools.addnewfolder("configuracion", "mainlist", "configuracion", xbmc.getLocalizedString(30504), "", "", "")
    xbmctools.addnewfolder("descargados", "mainlist", "descargados", xbmc.getLocalizedString(30505), "", "", "")

    # Label (top-right)...
    xbmcplugin.setPluginCategory(handle=int(sys.argv[1]), category="Canales")

    # 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)
Пример #11
0
 def end_call(self,movies=False) :
     if movies :
         xbmcplugin.setContent(int(sys.argv[1]),'movies')
     xbmcplugin.setPluginCategory(handle=int(sys.argv[1]),category=__language__(30000))
     xbmcplugin.addSortMethod(handle=int(sys.argv[ 1 ]),sortMethod=xbmcplugin.SORT_METHOD_UNSORTED)
     xbmcplugin.addSortMethod(handle=int(sys.argv[ 1 ]),sortMethod=xbmcplugin.SORT_METHOD_LABEL)
     xbmcplugin.addSortMethod(handle=int(sys.argv[ 1 ]),sortMethod=xbmcplugin.SORT_METHOD_DURATION)
     xbmcplugin.addSortMethod(handle=int(sys.argv[ 1 ]),sortMethod=xbmcplugin.SORT_METHOD_EPISODE)
     xbmcplugin.addSortMethod(handle=int(sys.argv[ 1 ]),sortMethod=xbmcplugin.SORT_METHOD_FILE)
     xbmcplugin.addSortMethod(handle=int(sys.argv[ 1 ]),sortMethod=xbmcplugin.SORT_METHOD_GENRE)
     xbmcplugin.addSortMethod(handle=int(sys.argv[ 1 ]),sortMethod=xbmcplugin.SORT_METHOD_LABEL)
     xbmcplugin.addSortMethod(handle=int(sys.argv[ 1 ]),sortMethod=xbmcplugin.SORT_METHOD_LABEL_IGNORE_THE)
     xbmcplugin.addSortMethod(handle=int(sys.argv[ 1 ]),sortMethod=xbmcplugin.SORT_METHOD_MPAA_RATING)
     xbmcplugin.addSortMethod(handle=int(sys.argv[ 1 ]),sortMethod=xbmcplugin.SORT_METHOD_NONE)
     xbmcplugin.addSortMethod(handle=int(sys.argv[ 1 ]),sortMethod=xbmcplugin.SORT_METHOD_PLAYLIST_ORDER)
     xbmcplugin.addSortMethod(handle=int(sys.argv[ 1 ]),sortMethod=xbmcplugin.SORT_METHOD_PRODUCTIONCODE)
     xbmcplugin.addSortMethod(handle=int(sys.argv[ 1 ]),sortMethod=xbmcplugin.SORT_METHOD_PROGRAM_COUNT)
     xbmcplugin.addSortMethod(handle=int(sys.argv[ 1 ]),sortMethod=xbmcplugin.SORT_METHOD_SIZE)
     xbmcplugin.addSortMethod(handle=int(sys.argv[ 1 ]),sortMethod=xbmcplugin.SORT_METHOD_SONG_RATING)
     xbmcplugin.addSortMethod(handle=int(sys.argv[ 1 ]),sortMethod=xbmcplugin.SORT_METHOD_STUDIO)
     xbmcplugin.addSortMethod(handle=int(sys.argv[ 1 ]),sortMethod=xbmcplugin.SORT_METHOD_STUDIO_IGNORE_THE)
     xbmcplugin.addSortMethod(handle=int(sys.argv[ 1 ]),sortMethod=xbmcplugin.SORT_METHOD_TITLE)
     xbmcplugin.addSortMethod(handle=int(sys.argv[ 1 ]),sortMethod=xbmcplugin.SORT_METHOD_TITLE_IGNORE_THE)
     xbmcplugin.addSortMethod(handle=int(sys.argv[ 1 ]),sortMethod=xbmcplugin.SORT_METHOD_TRACKNUM)
     xbmcplugin.addSortMethod(handle=int(sys.argv[ 1 ]),sortMethod=xbmcplugin.SORT_METHOD_UNSORTED)
     xbmcplugin.addSortMethod(handle=int(sys.argv[ 1 ]),sortMethod=xbmcplugin.SORT_METHOD_VIDEO_RATING)
     xbmcplugin.addSortMethod(handle=int(sys.argv[ 1 ]),sortMethod=xbmcplugin.SORT_METHOD_VIDEO_RUNTIME)
     xbmcplugin.addSortMethod(handle=int(sys.argv[ 1 ]),sortMethod=xbmcplugin.SORT_METHOD_VIDEO_TITLE)
     xbmcplugin.addSortMethod(handle=int(sys.argv[ 1 ]),sortMethod=xbmcplugin.SORT_METHOD_VIDEO_YEAR)        
     xbmcplugin.endOfDirectory(int(sys.argv[1]))
def detail(params, url, category):
    logger.info("[documentalesatonline.py] detail")

    title = unicode(xbmc.getInfoLabel("ListItem.Title"), "utf-8")
    thumbnail = urllib.unquote_plus(params.get("thumbnail"))
    plot = unicode(xbmc.getInfoLabel("ListItem.Plot"), "utf-8")

    # 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.addvideo(CHANNELNAME, "Megavideo - " + video[0], video[1], category, video[2])
        # ------------------------------------------------------------------------------------

        # 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 categorias(params, url, category):
    logger.info("[documentalesatonline.py] novedades")

    # Descarga la página
    data = scrapertools.cachePage(url)
    # logger.info(data)

    # Extrae las entradas (carpetas)
    patronvideos = "<a dir='ltr' href='([^']+)'>([^<]+)</a>[^<]+<span dir='ltr'>([^<]+)</span>"
    matches = re.compile(patronvideos, re.DOTALL).findall(data)
    scrapertools.printMatches(matches)

    for match in matches:
        scrapedtitle = match[1] + " " + match[2]
        scrapedurl = urlparse.urljoin(url, match[0])
        scrapedthumbnail = ""
        scrapedplot = ""
        if DEBUG:
            logger.info("title=[" + scrapedtitle + "], url=[" + scrapedurl + "], thumbnail=[" + scrapedthumbnail + "]")

        # Añade al listado de XBMC
        xbmctools.addnewfolder(
            CHANNELNAME, "novedades", category, scrapedtitle, scrapedurl, scrapedthumbnail, scrapedplot
        )

        # Label (top-right)...
    xbmcplugin.setPluginCategory(handle=pluginhandle, category=category)
    xbmcplugin.addSortMethod(handle=pluginhandle, sortMethod=xbmcplugin.SORT_METHOD_NONE)
    xbmcplugin.endOfDirectory(handle=pluginhandle, succeeded=True)
Пример #14
0
def detail(params,url,category):
	logger.info("[divxonline.py] detail")
	title=''
	thumbnail=''
	plot=''

	try:
		title = urllib.unquote_plus( params.get("title") )
		thumbnail = urllib.unquote_plus( params.get("thumbnail") )
		plot = urllib.unquote_plus( params.get("plot") )
	except:
		pass
	# Descarga la página
	data = scrapertools.cachePage(url)
	#logger.info(data)

	# ------------------------------------------------------------------------------------
	# Busca los enlaces a los videos
	# ------------------------------------------------------------------------------------
	
	data=decryptinks(data);
	listavideos = servertools.findvideos(data)

	for video in listavideos:
		videotitle = video[0]
		url = video[1]
		server = video[2]
		xbmctools.addnewvideo( CHANNELNAME , "play" , category , server , title.strip() + " - " + videotitle , url , thumbnail , plot )
	# ------------------------------------------------------------------------------------

	# Cierra el directorio
	xbmcplugin.setPluginCategory( handle=pluginhandle, category=category )
	xbmcplugin.addSortMethod( handle=pluginhandle, sortMethod=xbmcplugin.SORT_METHOD_NONE )
	xbmcplugin.endOfDirectory( handle=pluginhandle, succeeded=True )
Пример #15
0
def busqueda(params,url,category):
	logger.info("busqueda")
	tecleado = ""
	keyboard = xbmc.Keyboard('')
	keyboard.doModal()
	if (keyboard.isConfirmed()):
		tecleado = keyboard.getText()
		if len(tecleado)<=0:
			return
	
	tecleado = tecleado.replace(" ", "+")
	data=scrapertools.cachePagePost("http://www.divxonline.info/buscador.html",'texto=' + tecleado + '&categoria=0&tipobusqueda=1&Buscador=Buscar')

	#logger.info(data)
	data=data[data.find('Se han encontrado un total de'):]
	
	#<li><a href="/pelicula/306/100-chicas-2000/">100 chicas (2000)</a></li>
	patronvideos  = '<li><a href="(.+?)">(.+?)</a></li>'
	matches = re.compile(patronvideos,re.DOTALL).findall(data)
	if DEBUG: 
		scrapertools.printMatches(matches)
	
	for match in matches:
		xbmctools.addnewfolder( CHANNELNAME , "listmirrors" , category , match[1] , 'http://www.divxonline.info' + match[0] , 'scrapedthumbnail', 'scrapedplot' )
	
	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 )
Пример #16
0
def megavideo(params,url,category):
	logger.info("[divxonline.py] megavideo")

	xbmctools.addnewfolder( CHANNELNAME , "movielist" , CHANNELNAME , "Acción" , "http://www.divxonline.info/peliculas/50/accion-megavideo/" , "", "" )
	xbmctools.addnewfolder( CHANNELNAME , "movielist" , CHANNELNAME , "Animación" , "http://www.divxonline.info/peliculas/53/animacion-megavideo/" , "", "" )
	xbmctools.addnewfolder( CHANNELNAME , "movielist" , CHANNELNAME , "Anime" , "http://www.divxonline.info/peliculas/51/anime-megavideo/" , "", "" )
	xbmctools.addnewfolder( CHANNELNAME , "movielist" , CHANNELNAME , "Aventura" , "http://www.divxonline.info/peliculas/52/aventura-megavideo/" , "", "" )
	xbmctools.addnewfolder( CHANNELNAME , "movielist" , CHANNELNAME , "Bélicas" , "http://www.divxonline.info/peliculas/95/belicas-megavideo/" , "", "" )
	xbmctools.addnewfolder( CHANNELNAME , "movielist" , CHANNELNAME , "Ciencia Ficción" , "http://www.divxonline.info/peliculas/55/ciencia-ficcion-megavideo/" , "", "" )
	xbmctools.addnewfolder( CHANNELNAME , "movielist" , CHANNELNAME , "Cine Clásico" , "http://www.divxonline.info/peliculas/58/cine-clasico-megavideo/" , "", "" )
	xbmctools.addnewfolder( CHANNELNAME , "movielist" , CHANNELNAME , "Cine español" , "http://www.divxonline.info/peliculas/57/cine-espa%C3%B1ol-megavideo/" , "", "" )
	xbmctools.addnewfolder( CHANNELNAME , "movielist" , CHANNELNAME , "Clásicos Disney" , "http://www.divxonline.info/peliculas/59/clasicos-disney-megavideo/" , "", "" )
	xbmctools.addnewfolder( CHANNELNAME , "movielist" , CHANNELNAME , "Comedias" , "http://www.divxonline.info/peliculas/60/comedias-megavideo/" , "", "" )
	xbmctools.addnewfolder( CHANNELNAME , "movielist" , CHANNELNAME , "Documentales" , "http://www.divxonline.info/peliculas/54/documentales-megavideo/" , "", "" )
	xbmctools.addnewfolder( CHANNELNAME , "movielist" , CHANNELNAME , "Drama" , "http://www.divxonline.info/peliculas/62/drama-megavideo/" , "", "" )
	xbmctools.addnewfolder( CHANNELNAME , "movielist" , CHANNELNAME , "Infantil" , "http://www.divxonline.info/peliculas/63/infantil-megavideo/" , "", "" )
	xbmctools.addnewfolder( CHANNELNAME , "movielist" , CHANNELNAME , "Musicales" , "http://www.divxonline.info/peliculas/64/musicales-megavideo/" , "", "" )
	xbmctools.addnewfolder( CHANNELNAME , "movielist" , CHANNELNAME , "Suspense" , "http://www.divxonline.info/peliculas/65/suspense-megavideo/" , "", "" )
	xbmctools.addnewfolder( CHANNELNAME , "movielist" , CHANNELNAME , "Terror" , "http://www.divxonline.info/peliculas/66/terror-megavideo/" , "", "" )
	xbmctools.addnewfolder( CHANNELNAME , "movielist" , CHANNELNAME , "Western" , "http://www.divxonline.info/peliculas/67/western-megavideo/" , "", "" )

	# 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 )
Пример #17
0
def veoh(params,url,category):
	logger.info("[divxonline.py] veoh")

	xbmctools.addnewfolder( CHANNELNAME , "movielist" , CHANNELNAME , "Acción" , "http://www.divxonline.info/peliculas/30/accion-veoh/" , "", "" )
	xbmctools.addnewfolder( CHANNELNAME , "movielist" , CHANNELNAME , "Animación" , "http://www.divxonline.info/peliculas/33/animacion-veoh/" , "", "" )
	xbmctools.addnewfolder( CHANNELNAME , "movielist" , CHANNELNAME , "Anime" , "http://www.divxonline.info/peliculas/41/anime-veoh/" , "", "" )
	xbmctools.addnewfolder( CHANNELNAME , "movielist" , CHANNELNAME , "Aventura" , "http://www.divxonline.info/peliculas/32/aventura-veoh/" , "", "" )
	xbmctools.addnewfolder( CHANNELNAME , "movielist" , CHANNELNAME , "Bélicas" , "http://www.divxonline.info/peliculas/96/belicas-veoh/" , "", "" )
	xbmctools.addnewfolder( CHANNELNAME , "movielist" , CHANNELNAME , "Ciencia Ficción" , "http://www.divxonline.info/peliculas/35/ciencia0-ficcion-veoh/" , "", "" )
	xbmctools.addnewfolder( CHANNELNAME , "movielist" , CHANNELNAME , "Cine Clásico" , "http://www.divxonline.info/peliculas/38/cine-clasico-veoh/" , "", "" )
	xbmctools.addnewfolder( CHANNELNAME , "movielist" , CHANNELNAME , "Cine Español" , "http://www.divxonline.info/peliculas/37/cine-español-veoh/" , "", "" )
	xbmctools.addnewfolder( CHANNELNAME , "movielist" , CHANNELNAME , "Clásicos Disney" , "http://www.divxonline.info/peliculas/39/clasicos-disney-veoh/" , "", "" )
	xbmctools.addnewfolder( CHANNELNAME , "movielist" , CHANNELNAME , "Comedias" , "http://www.divxonline.info/peliculas/40/comedias-veoh/" , "", "" )
	xbmctools.addnewfolder( CHANNELNAME , "movielist" , CHANNELNAME , "Cortometrajes" , "http://www.divxonline.info/peliculas/41/cortometrajes-veoh/" , "", "" )
	xbmctools.addnewfolder( CHANNELNAME , "movielist" , CHANNELNAME , "Documentales" , "http://www.divxonline.info/peliculas/34/documentales-veoh/" , "", "" )
	xbmctools.addnewfolder( CHANNELNAME , "movielist" , CHANNELNAME , "Drama" , "http://www.divxonline.info/peliculas/42/dramas-veoh/" , "", "" )
	xbmctools.addnewfolder( CHANNELNAME , "movielist" , CHANNELNAME , "Infantiles" , "http://www.divxonline.info/peliculas/43/infantiles-veoh/" , "", "" )
	xbmctools.addnewfolder( CHANNELNAME , "movielist" , CHANNELNAME , "Musicales" , "http://www.divxonline.info/peliculas/44/musicales-veoh/" , "", "" )
	xbmctools.addnewfolder( CHANNELNAME , "movielist" , CHANNELNAME , "Suspense" , "http://www.divxonline.info/peliculas/45/suspense-veoh/" , "", "" )
	xbmctools.addnewfolder( CHANNELNAME , "movielist" , CHANNELNAME , "Terror" , "http://www.divxonline.info/peliculas/46/terror-veoh/" , "", "" )
	xbmctools.addnewfolder( CHANNELNAME , "movielist" , CHANNELNAME , "Western" , "http://www.divxonline.info/peliculas/49/western-veoh/" , "", "" )

	# 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 errorlist(params,url,category):
	xbmc.output("[descargadoslist.py] errorlist")

	# Crea el directorio de la lista de descargas con error si no existe
	try:
		os.mkdir(DOWNLOAD_PATH)
	except:
		pass
	try:
		os.mkdir(ERROR_PATH)
	except:
		pass

	# Crea un listado con las entradas de favoritos
	xbmc.output("[downloadall.py] ERROR_PATH="+ERROR_PATH)
	ficheros = os.listdir(ERROR_PATH)
	for fichero in ficheros:
		xbmc.output("[downloadall.py] fichero="+fichero)
		try:
			# Lee el bookmark
			titulo,thumbnail,plot,server,url = readbookmarkfile(fichero,ERROR_PATH)

			# Crea la entrada
			# En la categoría va el nombre del fichero para poder borrarlo
			xbmctools.addnewvideo( CHANNELNAME , "playerror" , os.path.join( ERROR_PATH, fichero ) , server , titulo , url , thumbnail, plot )
		except:
			pass
			xbmc.output("[downloadall.py] error al leer bookmark")
			for line in sys.exc_info():
				xbmc.output( "%s" % line , xbmc.LOGERROR )

	# 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 run(self, category=''):
        """
        Run plugin

        :param category: str - plugin sub-category, e.g. 'Comedy'.
            See :func:`xbmcplugin.setPluginCategory` for more info.
        :type category: str
        :raises simpleplugin.SimplePluginError: if unknown action string is provided.
        """
        self._handle = int(sys.argv[1])
        if category:
            xbmcplugin.setPluginCategory(self._handle, category)
        params = self.get_params(sys.argv[2][1:])
        action = params.get('action', 'root')
        self.log_debug(str(self))
        self.log_debug('Actions: {0}'.format(str(self.actions.keys())))
        self.log_debug('Called action "{0}" with params "{1}"'.format(action, str(params)))
        try:
            action_callable = self.actions[action]
        except KeyError:
            raise SimplePluginError('Invalid action: "{0}"!'.format(action))
        else:
            result = action_callable(params)
            self.log_debug('Action return value: {0}'.format(str(result)))
            if isinstance(result, (list, GeneratorType)):
                self._add_directory_items(self.create_listing(result))
            elif isinstance(result, basestring):
                self._set_resolved_url(self.resolve_url(result))
            elif isinstance(result, tuple) and hasattr(result, 'listing'):
                self._add_directory_items(result)
            elif isinstance(result, tuple) and hasattr(result, 'path'):
                self._set_resolved_url(result)
            else:
                self.log_debug('The action "{0}" has not returned any valid data to process.'.format(action))
Пример #20
0
def searchresults(params,url,category):
    logger.info("[pelisflv.py] SearchResult")
    
    
    # Descarga la p�gina
    data = scrapertools.cachePage(url)
    #print data
    # Extrae las entradas (carpetas)
    patronvideos  = '<div class="poster">[^<]+<a href="([^"]+)"'                          # URL
    patronvideos += '><img src="([^"]+)" width=[^\/]+\/>'                                 # TUMBNAIL
    patronvideos += '</a>[^<]+<[^>]+>[^<]+<[^>]+>[^<]+<a href="[^"]+">([^<]+)</a>'        # TITULO 
    matches = re.compile(patronvideos,re.DOTALL).findall(data)
    matches = re.compile(patronvideos,re.DOTALL).findall(data)
    scrapertools.printMatches(matches)

    for match in matches:
        # Atributos
        scrapedurl = match[0]
        
        scrapedtitle =match[2]
        scrapedtitle = scrapedtitle.replace("&#8211;","-")
        scrapedtitle = scrapedtitle.replace("&nbsp;"," ")
        scrapedthumbnail = match[1]
        scrapedplot = ""
        if (DEBUG): logger.info("title=["+scrapedtitle+"], url=["+scrapedurl+"], thumbnail=["+scrapedthumbnail+"]")

        # A�ade al listado de XBMC
        xbmctools.addnewfolder( __channel__ , "detail" , category , scrapedtitle , scrapedurl , scrapedthumbnail, scrapedplot )

    # 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 )
Пример #21
0
def mainlist(params,url,category):
    logger.info("[channelselector.py] mainlist")

    # Verifica actualizaciones solo en el primer nivel
    if config.get_platform()!="boxee":
        try:
            from core import updater
        except ImportError:
            logger.info("[channelselector.py] No disponible modulo actualizaciones")
        else:
            if config.get_setting("updatecheck2") == "true":
                logger.info("[channelselector.py] Verificar actualizaciones activado")
                updater.checkforupdates()
            else:
                logger.info("[channelselector.py] Verificar actualizaciones desactivado")

    itemlist = getmainlist()
    for elemento in itemlist:
        logger.info("[channelselector.py] item="+elemento.title)
        addfolder(elemento.title,elemento.channel,elemento.action)

    # 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 ListaAlfa(params, url, category):

	xbmctools.addnewfolder( CHANNELNAME ,"listvideos", category , "0-9","http://www.cine-adicto.com/tag/9/","","")
	xbmctools.addnewfolder( CHANNELNAME ,"listvideos", category , "A","http://www.cine-adicto.com/tag/a/","","")
	xbmctools.addnewfolder( CHANNELNAME ,"listvideos", category , "B","http://www.cine-adicto.com/tag/b/","","")
	xbmctools.addnewfolder( CHANNELNAME ,"listvideos", category , "C","http://www.cine-adicto.com/tag/c/","","")
	xbmctools.addnewfolder( CHANNELNAME ,"listvideos", category , "D","http://www.cine-adicto.com/tag/d/","","")
	xbmctools.addnewfolder( CHANNELNAME ,"listvideos", category , "E","http://www.cine-adicto.com/tag/e/","","")
	xbmctools.addnewfolder( CHANNELNAME ,"listvideos", category , "F","http://www.cine-adicto.com/tag/f/","","")
	xbmctools.addnewfolder( CHANNELNAME ,"listvideos", category , "G","http://www.cine-adicto.com/tag/g/","","")
	xbmctools.addnewfolder( CHANNELNAME ,"listvideos", category , "H","http://www.cine-adicto.com/tag/h/","","")
	xbmctools.addnewfolder( CHANNELNAME ,"listvideos", category , "I","http://www.cine-adicto.com/tag/i/","","")
	xbmctools.addnewfolder( CHANNELNAME ,"listvideos", category , "J","http://www.cine-adicto.com/tag/j/","","")
	xbmctools.addnewfolder( CHANNELNAME ,"listvideos", category , "K","http://www.cine-adicto.com/tag/k/","","")
	xbmctools.addnewfolder( CHANNELNAME ,"listvideos", category , "L","http://www.cine-adicto.com/tag/l/","","")
	xbmctools.addnewfolder( CHANNELNAME ,"listvideos", category , "M","http://www.cine-adicto.com/tag/m/","","")
	xbmctools.addnewfolder( CHANNELNAME ,"listvideos", category , "N","http://www.cine-adicto.com/tag/n/","","")
	xbmctools.addnewfolder( CHANNELNAME ,"listvideos", category , "O","http://www.cine-adicto.com/tag/o/","","")
	xbmctools.addnewfolder( CHANNELNAME ,"listvideos", category , "P","http://www.cine-adicto.com/tag/p/","","")
	xbmctools.addnewfolder( CHANNELNAME ,"listvideos", category , "Q","http://www.cine-adicto.com/tag/q/","","")
	xbmctools.addnewfolder( CHANNELNAME ,"listvideos", category , "R","http://www.cine-adicto.com/tag/r/","","")
	xbmctools.addnewfolder( CHANNELNAME ,"listvideos", category , "S","http://www.cine-adicto.com/tag/s/","","")
	xbmctools.addnewfolder( CHANNELNAME ,"listvideos", category , "T","http://www.cine-adicto.com/tag/t/","","")
	xbmctools.addnewfolder( CHANNELNAME ,"listvideos", category , "U","http://www.cine-adicto.com/tag/u/","","")
	xbmctools.addnewfolder( CHANNELNAME ,"listvideos", category , "V","http://www.cine-adicto.com/tag/v/","","")
	xbmctools.addnewfolder( CHANNELNAME ,"listvideos", category , "W","http://www.cine-adicto.com/tag/w/","","")
	xbmctools.addnewfolder( CHANNELNAME ,"listvideos", category , "X","http://www.cine-adicto.com/tag/x/","","")
	xbmctools.addnewfolder( CHANNELNAME ,"listvideos", category , "Y","http://www.cine-adicto.com/tag/y/","","")
	xbmctools.addnewfolder( CHANNELNAME ,"listvideos", category , "Z","http://www.cine-adicto.com/tag/z/","","")

	# 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 ListaCat(params,url,category):
	logger.info("[cineadicto.py] ListaCat")
	
	
	xbmctools.addnewfolder( CHANNELNAME ,"ListvideosMirror", category , "Acci�n","http://www.cine-adicto.com/category/categorias/accion/","","")
	xbmctools.addnewfolder( CHANNELNAME ,"ListvideosMirror", category , "Animado","http://www.cine-adicto.com/category/categorias/animado/","","")
	xbmctools.addnewfolder( CHANNELNAME ,"ListvideosMirror", category , "Anime","http://www.cine-adicto.com/category/categorias/anime/","","")
	xbmctools.addnewfolder( CHANNELNAME ,"ListvideosMirror", category , "Asi�ticas","http://www.cine-adicto.com/category/categorias/asiaticas/","","")
	xbmctools.addnewfolder( CHANNELNAME ,"ListvideosMirror", category , "Aventuras","http://www.cine-adicto.com/category/categorias/aventura/","","")
	xbmctools.addnewfolder( CHANNELNAME ,"ListvideosMirror", category , "Ciencia-Ficci�n","http://www.cine-adicto.com/category/categorias/ciencia-ficcion/","","")
	xbmctools.addnewfolder( CHANNELNAME ,"ListvideosMirror", category , "Cl�sicos","http://www.cine-adicto.com/category/categorias/clasicos/","","")
	xbmctools.addnewfolder( CHANNELNAME ,"listvideosMirror", category , "Comedia","http://www.cine-adicto.com/category/categorias/comedia/","","")
	xbmctools.addnewfolder( CHANNELNAME ,"listvideosMirror", category , "Comedias Romanticas","http://www.cine-adicto.com/category/categorias/comedias-romanticas/","","")
	xbmctools.addnewfolder( CHANNELNAME ,"listvideosMirror", category , "Destacado","http://www.cine-adicto.com/category/categorias/destacado/","","")
	xbmctools.addnewfolder( CHANNELNAME ,"listvideosMirror", category , "Documentales","http://www.cine-adicto.com/category/categorias/documentales/","","")
	xbmctools.addnewfolder( CHANNELNAME ,"ListvideosMirror", category , "Drama","http://www.cine-adicto.com/category/categorias/drama/","","")
	xbmctools.addnewfolder( CHANNELNAME ,"ListvideosMirror", category , "Espa�ol Latino","http://www.cine-adicto.com/category/categorias/espanol-latino/","","")
	xbmctools.addnewfolder( CHANNELNAME ,"ListvideosMirror", category , "Estreno","http://www.cine-adicto.com/category/categorias/estreno/","","")
	xbmctools.addnewfolder( CHANNELNAME ,"ListvideosMirror", category , "Infantil","http://www.cine-adicto.com/category/categorias/infantil/","","")
	xbmctools.addnewfolder( CHANNELNAME ,"listvideosMirror", category , "Intriga","http://www.cine-adicto.com/category/categorias/intriga/","","")
	xbmctools.addnewfolder( CHANNELNAME ,"ListvideosMirror", category , "Musicales","http://www.cine-adicto.com/category/categorias/musicales/","","")
	xbmctools.addnewfolder( CHANNELNAME ,"listvideosMirror", category , "Peliculas HD","http://www.cine-adicto.com/category/categorias/peliculas-hd-categorias/","","")
	xbmctools.addnewfolder( CHANNELNAME ,"ListvideosMirror", category , "Romance","http://www.cine-adicto.com/category/categorias/romance/","","")
	xbmctools.addnewfolder( CHANNELNAME ,"listvideosMirror", category , "Suspenso","http://www.cine-adicto.com/category/categorias/suspenso/","","")
	xbmctools.addnewfolder( CHANNELNAME ,"ListvideosMirror", category , "Terror","http://www.cine-adicto.com/category/categorias/terror/","","")
	xbmctools.addnewfolder( CHANNELNAME ,"ListvideosMirror", category , "Thriller","http://www.cine-adicto.com/category/categorias/thriller/","","")
	xbmctools.addnewfolder( CHANNELNAME ,"ListvideosMirror", category , "Western","http://www.cine-adicto.com/category/categorias/western/","","")
	
	# Asigna el t�tulo, desactiva la ordenaci�n, y cierra el directorio
	xbmcplugin.setPluginCategory( handle=pluginhandle, category=category )
	xbmcplugin.addSortMethod( handle=pluginhandle, sortMethod=xbmcplugin.SORT_METHOD_NONE )
	xbmcplugin.endOfDirectory( handle=pluginhandle, succeeded=True )
def catlist(params,url,category):
	logger.info("[watchanimeon.py] catlist")

	# Descarga la página
	data = scrapertools.cachePage(url)

	# Extrae las categorias
	patron = '<a href="(\/\?genre[^"]+)">([^<]+)</a>'
	matches = re.compile(patron,re.DOTALL).findall(data)
	scrapertools.printMatches(matches)

	# Las añade a XBMC
	for match in matches:
		scrapedtitle = match[1]
		scrapedurl = urlparse.urljoin(url,match[0])
		scrapedthumbnail = ""
		scrapedplot = ""
		if (DEBUG): logger.info("title=["+scrapedtitle+"], url=["+scrapedurl+"], thumbnail=["+scrapedthumbnail+"]")

		# Añade al listado de XBMC
		xbmctools.addnewfolder( CHANNELNAME , "catdetail" , category , scrapedtitle , scrapedurl , scrapedthumbnail, scrapedplot )

	# Asigna el título, desactiva la ordenación, y cierra el directorio
	xbmcplugin.setPluginCategory( handle=pluginhandle, category=category )
	xbmcplugin.addSortMethod( handle=pluginhandle, sortMethod=xbmcplugin.SORT_METHOD_NONE )
	xbmcplugin.endOfDirectory( handle=pluginhandle, succeeded=True )
Пример #25
0
def listcategorias(params,url,category):
	xbmc.output("[yotix.py] listcategorias")

	# ------------------------------------------------------
	# Descarga la página
	# ------------------------------------------------------
	data = scrapertools.cachePage(url)
	#xbmc.output(data)

	# ------------------------------------------------------
	# Extrae las entradas de la home como carpetas
	# ------------------------------------------------------
	patron  = '<a href="(/categoria/[^"]+)">([^<]+)</a>'

	matches = re.compile(patron,re.DOTALL).findall(data)
	if DEBUG: scrapertools.printMatches(matches)

	for match in matches:
		# Atributos
		scrapedtitle = match[1]
		scrapedurl = urlparse.urljoin(url,match[0])
		scrapedthumbnail = ""
		scrapedplot = ""
		if (DEBUG): xbmc.output("title=["+scrapedtitle+"], url=["+scrapedurl+"], thumbnail=["+scrapedthumbnail+"]")

		# Añade al listado de XBMC
		xbmctools.addnewfolder( CHANNELNAME , "videolist" , category , scrapedtitle , scrapedurl , scrapedthumbnail, scrapedplot )

	# 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 airinglist(params,url,category):
	logger.info("[watchanimeon.py] airinglist")

	# Descarga la página
	data = scrapertools.cachePage(url)

	# Extrae las categorias
	patron = '<div class="btm-sidebar">(.*?)</div>'
	matches = re.compile(patron,re.DOTALL).findall(data)
	if len(matches)>0:
		data = matches[0]

	patron = '<li><span class="[^"]+">([^<]+)</span> <a href="([^"]+)">([^<]+)</a></li>'

	matches = re.compile(patron,re.DOTALL).findall(data)
	scrapertools.printMatches(matches)

	# Las añade a XBMC
	for match in matches:
		scrapedtitle = match[2].strip() + " ("+match[0]+")"
		scrapedurl = urlparse.urljoin(url,match[1])
		scrapedthumbnail = ""
		scrapedplot = ""
		if (DEBUG): logger.info("title=["+scrapedtitle+"], url=["+scrapedurl+"], thumbnail=["+scrapedthumbnail+"]")

		# Añade al listado de XBMC
		xbmctools.addnewfolder( CHANNELNAME , "detallecapitulo" , category , scrapedtitle , scrapedurl , scrapedthumbnail, scrapedplot )

	# Asigna el título, desactiva la ordenación, y cierra el directorio
	xbmcplugin.setPluginCategory( handle=pluginhandle, category=category )
	xbmcplugin.addSortMethod( handle=pluginhandle, sortMethod=xbmcplugin.SORT_METHOD_NONE )
	xbmcplugin.endOfDirectory( handle=pluginhandle, succeeded=True )
def newlist(params,url,category):
	logger.info("[watchanimeon.py] newlist")

	# Descarga la página
	data = scrapertools.cachePage(url)

	# Extrae las categorias
	#<div class="newpostz"><div class="newposts"><img src="http://www.watchanimeon.com/images/thumbs/75.jpg" alt="series" /><ul><li>
	#<a href="http://www.watchanimeon.com/naruto-shippuden-episode-126/">Naruto Shippuden Episode 126</a></li></ul>
	#<span><em>More Episodes:</em> <a href="http://www.watchanimeon.com/anime/naruto-shippuden/">Naruto Shippuden</a></span><span><em>Date Published </em>September 4th, 2009</span></div><div class="clear"></div></div>
	patron  = '<div class="newpostz"><div class="newposts"><img src="([^"]+)"[^>]+><ul><li>'
	patron += '<a href="([^"]+)">([^<]+)</a></li></ul>'
	patron += '<span><em>More Episodes.</em> <a href="([^"]+)">([^<]+)</a></span><span><em>Date Published </em>([^<]+)</span></div><div class="clear"></div></div>'
	matches = re.compile(patron,re.DOTALL).findall(data)
	scrapertools.printMatches(matches)

	# Las añade a XBMC
	for match in matches:
		scrapedtitle = match[2]+" ("+match[5]+")"
		scrapedurl = urlparse.urljoin(url,match[1])
		scrapedthumbnail = urlparse.urljoin(url,match[0])
		scrapedplot = ""
		if (DEBUG): logger.info("title=["+scrapedtitle+"], url=["+scrapedurl+"], thumbnail=["+scrapedthumbnail+"]")

		# Añade al listado de XBMC
		xbmctools.addnewfolder( CHANNELNAME , "detallecapitulo" , category , scrapedtitle , scrapedurl , scrapedthumbnail, scrapedplot )

	# Asigna el título, desactiva la ordenación, y cierra el directorio
	xbmcplugin.setPluginCategory( handle=pluginhandle, category=category )
	xbmcplugin.addSortMethod( handle=pluginhandle, sortMethod=xbmcplugin.SORT_METHOD_NONE )
	xbmcplugin.endOfDirectory( handle=pluginhandle, succeeded=True )
Пример #28
0
def mainlist(params,url,category):
    logger.info("[pelisflv.py] mainlist")

    # A�ade al listado de XBMC

    xbmctools.addnewfolder( __channel__ , "listvideofeeds" , category , "Listar - Novedades"    ,"http://www.blogger.com/feeds/3207505541212690627/posts/default?start-index=1&max-results=25","","")
    xbmctools.addnewfolder( __channel__ , "listvideos"     , category , "Listar - Estrenos","http://www.pelisflv.net/search/label/Estrenos","","")
    xbmctools.addnewfolder( __channel__ , "ListadoSeries"  , category , "Listar - Generos"        ,"http://www.pelisflv.net/","","")
    #xbmctools.addnewfolder( __channel__ , "ListadoSeries"  , category , "Listar - Series"        ,"http://www.pelisflv.net/","","")
    xbmctools.addnewfolder( __channel__ , "listvideos"     , category , "Listar - Animacion"        ,"http://www.pelisflv.net/search/label/Animaci%C3%B3n","","")
    xbmctools.addnewfolder( __channel__ , "listvideos"     , category , "Listar - Videos no Megavideo (FLV)"        ,"http://www.pelisflv.net/search/label/Flv","","")
    xbmctools.addnewfolder( __channel__ , "listvideos"     , category , "Listar - Videos en Megavideo"        ,"http://www.pelisflv.net/search/label/Megavideo","","")
    xbmctools.addnewfolder( __channel__ , "listvideos"     , category , "Videos Audio Espa�ol"        ,"http://www.pelisflv.net/search/label/Espa%C3%B1ol","","")
    xbmctools.addnewfolder( __channel__ , "listvideos"     , category , "Videos Audio Latino"        ,"http://www.pelisflv.net/search/label/Latino","","")
    xbmctools.addnewfolder( __channel__ , "listvideos"     , category , "Videos Audio Original Sub Espa�ol"        ,"http://www.pelisflv.net/search/label/Sub%20Espa%C3%B1ol","","")
    xbmctools.addnewfolder( __channel__ , "search"         , category , "Buscar","http://www.pelisflv.net/","","")
    

    # 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 mirrors(params,url,category):
	logger.info("[capitancinema.py] mirrors")

	title = urllib.unquote_plus( params.get("title") )
	thumbnail = urllib.unquote_plus( params.get("thumbnail") )
	plot = urllib.unquote_plus( params.get("plot") )

	# Descarga la página
	data = scrapertools.cachePage(url)
	patronvideos  = '<li><strong>DISPONIBLE EN EL FORO</strong>[^<]+<a href="([^"]+)"'
	matches = re.compile(patronvideos,re.DOTALL).findall(data)
	if len(matches)>0:
		url = matches[0]
		data = scrapertools.cachePage(url)

		# ------------------------------------------------------------------------------------
		# Busca los enlaces a los videos
		# ------------------------------------------------------------------------------------
		listavideos = servertools.findvideos(data)

		for video in listavideos:
			videotitle = video[0]
			url = video[1]
			server = video[2]
			xbmctools.addnewvideo( CHANNELNAME , "play" , category , server , title.strip() + " - " + videotitle , url , thumbnail , plot )
		# ------------------------------------------------------------------------------------

	# Cierra el directorio
	xbmcplugin.setPluginCategory( handle=pluginhandle, category=category )
	xbmcplugin.addSortMethod( handle=pluginhandle, sortMethod=xbmcplugin.SORT_METHOD_NONE )
	xbmcplugin.endOfDirectory( handle=pluginhandle, succeeded=True )
Пример #30
0
def mainlist(params,url,category):
	xbmc.output("[argia.py] mainlist")
	
	###
	### MAIN MENU
	###
	# Full Video List
	xbmctools.addnewfolder( CHANNELCODE , "videolist" , CHANNELNAME , "Denak" , "http://www.argia.com/multimedia?p=1" , "" , "" )
	# Recommended
	xbmctools.addnewfolder( CHANNELCODE , "recommended" , CHANNELNAME , "Gomendatuak" , VIDEOURL , "" , "" )
	# Most Viewed (this week)
	xbmctools.addnewfolder( CHANNELCODE , "mostviewed" , CHANNELNAME , "Asteko ikusienak" , VIDEOURL , "" , "" )
	# Videos (sin categoria)
	xbmctools.addnewfolder( CHANNELCODE , "videolist" , CHANNELNAME , "Bideoak" , "http://www.argia.com/multimedia/bideoak?p=1" , "" , "" )
	# Actos
	xbmctools.addnewfolder( CHANNELCODE , "videolist" , CHANNELNAME , "Ekitaldiak" , "http://www.argia.com/multimedia/ekitaldiak?p=1" , "" , "" )
	# Cortometrajes
	xbmctools.addnewfolder( CHANNELCODE , "videolist" , CHANNELNAME , "Film laburrak" , "http://www.argia.com/multimedia/laburrak?p=1" , "" , "" )
	
	# 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 )
Пример #31
0
    def list_folder(self, folder_id, title, folder_name):
        # Set plugin category. It is displayed in some skins as the name
        # of the current section.
        xbmcplugin.setPluginCategory(self.handle, folder_name)

        data = self.make_request(
            self.MainUrl +
            'list/{}?{}&userid={}&platform={}&content-languages={}'.format(
                folder_id, folder_name, self.userid, self.platform,
                self.languages))

        #web_pdb.set_trace()
        if not data['items']:
            logger.warn('items data is empty for folder! -- {}'.format(data))
            kodiutils.notification('No items found',
                                   'Check logs for api content!')
            return

        for item in data['items']:
            if item['container'] is not None:
                subtype = item['container'].get('type')
            else:
                subtype = item.get('type')

            newtitle = '{} (Count - {})'.format(item['title'],
                                                item.get('videoCount'))
            if subtype in ['folder']:
                self.add_directory_item(content_id=item['id'],
                                        title=newtitle,
                                        description=item.get('description'),
                                        action='folder',
                                        section_next=folder_name,
                                        item=item)

            elif subtype in [
                    'trailer', 'movie', 'video', 'episode', 'teaser', 'music',
                    'webisode', 'clip', 'shorts', 'news', 'album', 'season'
            ]:
                self.add_video_item(item)

            elif subtype in ['original', 'tvshow']:
                self.add_directory_item(
                    content_id=item['id'],
                    title=newtitle,
                    description=self.get_description(item),
                    action='season',
                    section_next=folder_name,
                    item=item)  #item['publisher'].get('name')

            elif subtype not in ['external_link']:
                logger.warn(
                    u'Skipping rendering sub-type from item - {}: {}'.format(
                        subtype, item))
                if settings.is_debug():
                    kodiutils.notification(
                        'Unhandled asset type!',
                        '{}'.format(subtype),
                        icon=xbmcgui.NOTIFICATION_WARNING,
                    )
        #web_pdb.set_trace()
        self.add_next_page_and_search_item(item=data,
                                           original_title=folder_name,
                                           action='folder')

        # Add a sort method for the virtual folder items (alphabetically, ignore articles)
        xbmcplugin.addSortMethod(self.handle, xbmcplugin.SORT_METHOD_NONE)

        # Finish creating a virtual folder.
        xbmcplugin.endOfDirectory(self.handle)
Пример #32
0
 def _fill_media_list(self, ok, videos):
     try:
         # calculate total items
         total_items = len(videos)
         # if ok (always is for now) fill directory
         if (ok):
             # set our thumbnail for queries
             self.query_thumbnail = videos[0]["thumbnail"]
             # enumerate through the list of pictures and add the item to the media list
             for c, video in enumerate(videos):
                 # only add videos with a valid video url
                 if (len(video["video_urls"])):
                     # plot
                     plot = xbmc.getLocalizedString(30904)
                     if (video["desc"]):
                         plot = video["desc"]
                         plot = self._clean_text(plot.strip())
                     # format runtime as 00:00
                     run = int(video["runtime"])
                     runtime = ""
                     # video runtime
                     if (run):
                         runtime = "%02d:%02d" % (
                             int(run / 60),
                             run % 60,
                         )
                     # viewer rating
                     try:
                         rating = float(video["rating"])
                     except:
                         rating = 0.0
                     # genre
                     genre = video["genre"]
                     # updated date
                     #<pubDate>Wed, 16 Apr 2008 18:00:30 +0000</pubDate>
                     mm = [
                         "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul",
                         "Aug", "Sep", "Oct", "Nov", "Dec"
                     ].index(video["date"][8:11])
                     date = "%02d-%02d-%04d" % (
                         int(video["date"][5:7]),
                         mm + 1,
                         int(video["date"][12:16]),
                     )
                     # construct our url
                     video_url = video["video_urls"][0]
                     for vid in video["video_urls"]:
                         if (vid.endswith(".flv")):
                             video_url = vid
                             break
                     url = video_url
                     # set the default icon
                     icon = "DefaultVideo.png"
                     # only need to add label, icon and thumbnail, setInfo() and addSortMethod() takes care of label2
                     listitem = xbmcgui.ListItem(
                         label=video["title"],
                         iconImage=icon,
                         thumbnailImage=video["thumbnail"])
                     # add the different infolabels we want to sort by
                     listitem.setInfo(type="Video",
                                      infoLabels={
                                          "Title": video["title"],
                                          "Director": video["username"],
                                          "Duration": runtime,
                                          "Plot": plot,
                                          "PlotOutline": plot,
                                          "Rating": rating,
                                          "Genre": genre,
                                          "Date": date
                                      })
                     # add the video to the media list
                     ok = xbmcplugin.addDirectoryItem(
                         handle=int(sys.argv[1]),
                         url=url,
                         listitem=listitem,
                         isFolder=False,
                         totalItems=total_items)
                     # if user cancels, call raise to exit loop
                     if (not ok): raise
     except:
         # oops print error message
         print "ERROR: %s::%s (%d) - %s" % (
             self.__class__.__name__,
             sys.exc_info()[2].tb_frame.f_code.co_name,
             sys.exc_info()[2].tb_lineno,
             sys.exc_info()[1],
         )
         ok = False
     # if successful and user did not cancel, add all the required sort methods
     if (ok):
         xbmcplugin.addSortMethod(handle=int(sys.argv[1]),
                                  sortMethod=xbmcplugin.SORT_METHOD_LABEL)
         xbmcplugin.addSortMethod(
             handle=int(sys.argv[1]),
             sortMethod=xbmcplugin.SORT_METHOD_VIDEO_RATING)
         xbmcplugin.addSortMethod(handle=int(sys.argv[1]),
                                  sortMethod=xbmcplugin.SORT_METHOD_DATE)
         xbmcplugin.addSortMethod(
             handle=int(sys.argv[1]),
             sortMethod=xbmcplugin.SORT_METHOD_VIDEO_RUNTIME)
         xbmcplugin.addSortMethod(handle=int(sys.argv[1]),
                                  sortMethod=xbmcplugin.SORT_METHOD_GENRE)
         # set content
         xbmcplugin.setContent(handle=int(sys.argv[1]), content="movies")
         # set our plugin category
         xbmcplugin.setPluginCategory(handle=int(sys.argv[1]),
                                      category=self.args.title)
         # if skin has fanart image use it
         fanart_image = os.path.join(sys.modules["__main__"].__plugin__,
                                     self.args.category + "-fanart.png")
         if (xbmc.skinHasImage(fanart_image)):
             xbmcplugin.setPluginFanart(handle=int(sys.argv[1]),
                                        image=fanart_image)
         # set our fanart from user setting
         elif (self.settings["fanart_image"]):
             xbmcplugin.setPluginFanart(handle=int(sys.argv[1]),
                                        image=self.settings["fanart_image"])
     return ok, total_items
Пример #33
0
try:
    plot = urllib.unquote_plus(params["plot"])
except:
    pass

if mode == None:
    name = ''
    _check_for_update()
    main()
elif mode == 0:
    showList(url, name)
elif mode == 1:
    playVideo(url, name, thumb, plot)
elif mode == 2:
    name = 'Programs'
    Programs()
elif mode == 3:
    name = 'Topics'
    Topics()
elif mode == 4:
    name = 'Collections'
    Collections()
elif mode == 5:
    name = 'Search'
    Search()

xbmcplugin.setPluginCategory(int(sys.argv[1]), name)
xbmcplugin.addSortMethod(handle=int(sys.argv[1]),
                         sortMethod=xbmcplugin.SORT_METHOD_LABEL)
xbmcplugin.endOfDirectory(int(sys.argv[1]))
Пример #34
0
def do_global_search(text):
    xbmcplugin.setPluginCategory(HANDLE, 'Search Result')
    xbmcplugin.setContent(HANDLE, 'movies')
    if not text:
        keyboard = xbmc.Keyboard('', 'Search iPlayer')
        keyboard.doModal()
        if keyboard.isConfirmed():
            text = keyboard.getText()

    if not text:
        return

    XbmcHelper.search_history_save(text)

    print("*********************** searching {}".format(text))

    progress = {
        'percent': 0,
        'step': 5,
        'counter': 0,
        'length': 0,
        'dialog': xbmcgui.DialogProgress(),
        'results': []
    }

    def _search(site, text, progress):
        try:
            plugin, module, classname = get_plugin({
                'className': [site['className']],
                "module": [site['plugin']]
            })
            progress['dialog'].update(
                progress['percent'], 'Searching %d/%d sites' %
                (progress['counter'], progress['length']), "",
                "Looking on: %s" % classname)
            progress['results'].append(
                (module, classname, plugin().search(text)))
            progress['percent'] += progress['step']
            progress['counter'] += 1
            progress['dialog'].update(
                progress['percent'], 'Searching %d/%d sites' %
                (progress['counter'], progress['length']), "",
                "Looking on: %s" % classname)
        except:
            pass

    threads = []
    for site in SITES:
        if site['version'] > KODI_VERSION or ('searchable' in site
                                              and not site['searchable']):
            continue
        progress['length'] += 1
    progress['dialog'].create(
        'Processing',
        "Searching %d/%d sites" % (progress['counter'], progress['length']))
    progress['step'] = 100 / progress['length']

    for site in SITES:
        if site['version'] > KODI_VERSION or ('searchable' in site
                                              and not site['searchable']):
            continue

        process = Thread(target=_search, args=[site, text, progress])
        process.setDaemon(True)
        process.start()
        threads.append(process)

    for process in threads:
        process.join()

    for module, classname, movies in progress['results']:
        # if movies is not None and len(movies.get('movies')) > 0:
        label = "[COLOR red][B][---- %s : [COLOR yellow]%d found[/COLOR] View All ----][/B][/COLOR]" % (
            classname, len(movies['movies']))
        sli = xbmcgui.ListItem(label=label)
        url = build_url({
            'mode': 'dosearch',
            'module': module,
            'className': classname,
            'url': text
        })
        xbmcplugin.addDirectoryItem(HANDLE, url, sli, isFolder=True)
        for item in movies['movies'][:5]:
            try:
                list_item = xbmcgui.ListItem(label=item['label'])
                list_item.setLabel2(item['realtitle'])
                list_item.setIconImage('DefaultVideo.png')
                list_item.setArt({
                    'thumb': item['thumb'],
                })
                url = build_url({
                    'mode': 'movie',
                    'movie_item': json.dumps(item),
                    'module': module,
                    'className': classname
                })
                is_folder = True
                xbmcplugin.addDirectoryItem(HANDLE, url, list_item, is_folder)
            except:
                print(item)
    xbmcplugin.endOfDirectory(HANDLE)
Пример #35
0
def downloadall(params,url,category):
    logger.info("[downloadall.py] downloadall")

    logger.info("[downloadall.py] DOWNLOAD_PATH=%s" % DOWNLOAD_PATH)

    if usingsamba:
        lista = samba.get_files(DOWNLOAD_PATH)
    else:
        lista = os.listdir(DOWNLOAD_PATH)
    lista.sort()

    logger.info("[downloadall.py] numero de ficheros=%d" % len(lista))

    # Crea un listado con las entradas de favoritos
    for fichero in lista:
        # El primer video de la lista
        logger.info("[downloadall.py] fichero="+fichero)

        if fichero!="error":
            # Descarga el vídeo
            try:
                # Lee el bookmark
                titulo,thumbnail,plot,server,url = readbookmark(fichero)
                logger.info("[downloadall.py] url="+url)

                # Averigua la URL del vídeo
                if (server=="Megavideo" or server=="Megaupload") and config.getSetting("megavideopremium")=="true":
                    if server=="Megaupload":
                        mediaurl = servertools.getmegauploadhigh(url)
                    else:
                        mediaurl = servertools.getmegavideohigh(url)
                else:
                    mediaurl = servertools.findurl(url,server)
                logger.info("[downloadall.py] mediaurl="+mediaurl)
                
                # Genera el NFO
                nfofilepath = downloadtools.getfilefromtitle("sample.nfo",titulo)
                outfile = open(nfofilepath,"w")
                outfile.write("<movie>\n")
                outfile.write("<title>"+titulo+")</title>\n")
                outfile.write("<originaltitle></originaltitle>\n")
                outfile.write("<rating>0.000000</rating>\n")
                outfile.write("<year>2009</year>\n")
                outfile.write("<top250>0</top250>\n")
                outfile.write("<votes>0</votes>\n")
                outfile.write("<outline></outline>\n")
                outfile.write("<plot>"+plot+"</plot>\n")
                outfile.write("<tagline></tagline>\n")
                outfile.write("<runtime></runtime>\n")
                outfile.write("<thumb></thumb>\n")
                outfile.write("<mpaa>Not available</mpaa>\n")
                outfile.write("<playcount>0</playcount>\n")
                outfile.write("<watched>false</watched>\n")
                outfile.write("<id>tt0432337</id>\n")
                outfile.write("<filenameandpath></filenameandpath>\n")
                outfile.write("<trailer></trailer>\n")
                outfile.write("<genre></genre>\n")
                outfile.write("<credits></credits>\n")
                outfile.write("<director></director>\n")
                outfile.write("<actor>\n")
                outfile.write("<name></name>\n")
                outfile.write("<role></role>\n")
                outfile.write("</actor>\n")
                outfile.write("</movie>")
                outfile.flush()
                outfile.close()
                logger.info("[downloadall.py] Creado fichero NFO")
                
                # Descarga el thumbnail
                logger.info("[downloadall.py] thumbnail="+thumbnail)
                thumbnailfile = downloadtools.getfilefromtitle(thumbnail,titulo)
                thumbnailfile = thumbnailfile[:-4] + ".tbn"
                logger.info("[downloadall.py] thumbnailfile="+thumbnailfile)
                try:
                    downloadtools.downloadfile(thumbnail,thumbnailfile)
                    logger.info("[downloadall.py] Thumbnail descargado")
                except:
                    logger.info("[downloadall.py] error al descargar thumbnail")
                    for line in sys.exc_info():
                        logger.error( "%s" % line )
                
                # Descarga el video
                dev = downloadtools.downloadtitle(mediaurl,titulo)
                if dev == -1:
                    # El usuario ha cancelado la descarga
                    logger.info("[downloadall.py] Descarga cancelada")
                    return
                elif dev == -2:
                    # Error en la descarga, lo mueve a ERROR y continua con el siguiente
                    logger.info("[downloadall.py] ERROR EN DESCARGA DE "+fichero)
                    origen = os.path.join( DOWNLOAD_PATH , fichero )
                    destino = os.path.join( ERROR_PATH , fichero )
                    
                    # TODO: Mover en ruta compartida
                    shutil.move( origen , destino )
                else:
                    logger.info("[downloadall.py] Video descargado")
                    # Borra el bookmark e itera para obtener el siguiente video
                    filepath = os.path.join( DOWNLOAD_PATH , fichero )
                    os.remove(filepath)
                    logger.info("[downloadall.py] "+fichero+" borrado")
            except:
                logger.info("[downloadall.py] ERROR EN DESCARGA DE "+fichero)
                origen = os.path.join( DOWNLOAD_PATH , fichero )
                destino = os.path.join( ERROR_PATH , fichero )
                shutil.move( origen , destino )

    # 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 )
Пример #36
0
def router(paramstring):
    xbmc.log(paramstring, 2)
    """
    Router function that calls other functions
    depending on the provided paramstring
    :param paramstring: URL encoded plugin paramstring
    :type paramstring: str
    """
    # Parse a URL-encoded paramstring to the dictionary of
    # {<parameter>: <value>} elements
    params = dict(urlparse.parse_qsl(paramstring))
    # Check the parameters passed to the plugin
    if params:
        if params['action'] == 'list':
            # Display a list of elements
            if params['type'] == 'live':
                mediaset.displayLiveChannelsList(_handle, _url)
            if params['type'] == 'ondemand':
                if 'brandId' in params:
                    if 'subBrandId' in params:
                        mediaset.getOnDemandProgramDetailsCategory(
                            _handle, _url, params['brandId'],
                            params['subBrandId'])
                    else:
                        mediaset.getOnDemandProgramDetails(
                            _handle, _url, params['brandId'])
                else:
                    if 'category' in params:
                        if 'startswith' in params:
                            mediaset.listOnDemandCatalogue(
                                _handle, _url, params['category'],
                                params['startswith'])
                        else:
                            mediaset.listOnDemandCategories(
                                _handle, _url, params['category'])
                    else:
                        mediaset.listOnDemandCategories(_handle, _url)
            if params['type'] == 'cult':
                if 'feedUrl' in params:
                    mediaset.listCultVideos(_handle, _url, params['feedUrl'])

                mediaset.listCultCategories(_handle, _url)

            if params['type'] == 'most_viewed':
                mediaset.listMostViewedVideos(_handle, _url)

            if params['type'] == 'info':
                mediaset.listInfoVideos(_handle, _url)

        elif params['action'] == 'play':
            version = xbmc.getInfoLabel('System.BuildVersion').split('.')[0]

            if params['type'] == 'live':
                params['url'] = mediaset.getLiveChannelUrl(params['callSign'])

            if (xbmc.getCondVisibility('system.platform.linux')
                    and xbmc.getCondVisibility('system.platform.android')
                ) and params['type'] != 'live':
                # solves final url to grab mpd file
                req = urllib2.build_opener()
                req.addheaders = [(
                    'User-Agent',
                    'Mozilla/5.0 (Windows NT 6.1; WOW64; rv:64.0) Gecko/20100101 Firefox/64.0'
                )]
                response = req.open(params['url'])
                params['url'] = response.geturl()

                liz = xbmcgui.ListItem(path=params['url'])
                # To use inputstream.adaptive
                liz.setProperty('inputstreamaddon', 'inputstream.adaptive')
                liz.setProperty('inputstream.adaptive.manifest_type', 'mpd')
                liz.setMimeType('application/dash+xml')
                liz.setContentLookup(False)
            else:
                liz = xbmcgui.ListItem(path=params['url'])

            xbmcplugin.setResolvedUrl(_handle, True, liz)

        else:
            # If the provided paramstring does not contain a supported action
            # we raise an exception. This helps to catch coding errors,
            # e.g. typos in action names.
            raise ValueError('Invalid paramstring: {0}!'.format(paramstring))
    else:
        if 1:
            # If the plugin is called from Kodi UI without any parameters,
            # display the list of video categories
            xbmcplugin.setPluginCategory(_handle, 'Menu')

            menu = mediaset.getMainMenu()

            for m in menu:
                list_item = xbmcgui.ListItem(label=m['label'])
                is_folder = True
                url = get_url(action=m['url']['action'], type=m['url']['type'])
                xbmcplugin.addDirectoryItem(_handle, url, list_item, is_folder)

            # Finish creating a virtual folder.
            xbmcplugin.endOfDirectory(_handle)
Пример #37
0
def list_videos(category_num, subcategory_num, page='1'):
    """
    Create the list of playable videos in the Kodi interface.
    :param category_num: Category number in list
    :param subcategory_num: dict num in subcategory list
    :param page: page number of videos pages
    """
    # Set plugin category. It is displayed in some skins as the name
    # of the current section.
    category_dict = cat[2:][int(category_num)][0]
    subcategory_dict = cat[2:][int(category_num)][int(subcategory_num)]
    category = category_dict['name'] + ' --- ' + subcategory_dict['name']
    xbmcplugin.setPluginCategory(_handle, category)
    # Set plugin content. It allows Kodi to select appropriate views
    # for this type of content.
    xbmcplugin.setContent(_handle, 'videos')
    # Get the list of videos in the category.

    if page == '1':
        url_page = subcategory_dict['href']
    else:
        url_page = subcategory_dict['href'] + 'page/' + page + '/'

    log('url= ' + url_page + '; subcategory= ' + category, xbmc.LOGERROR)
    videos = movistape.movies(url_page)
    # Iterate through videos.
    for video in videos:
        # Create a list item with a text label and a thumbnail image.
        list_item = xbmcgui.ListItem(label=video['title'])
        # Set additional info for the list item.
        # 'mediatype' is needed for skin to display info for this ListItem correctly.
        list_item.setInfo(
            'video',
            {
                'title': video['title'],
                # 'genre': video['genre'],
                'plot': video['description'],
                'genre': video['meta'],
                'mediatype': 'video'
            })
        # Set graphics (thumbnail, fanart, banner, poster, landscape etc.) for the list item.
        # Here we use the same image for all items for simplicity's sake.
        # In a real-life plugin you need to set each image accordingly.
        list_item.setArt({'thumb': video['img'], 'fanart': video['img']})
        # Set 'IsPlayable' property to 'true'.
        # This is mandatory for playable items!
        list_item.setProperty('IsPlayable', 'true')
        # Create a URL for a plugin recursive call.
        # Example: plugin://plugin.video.example/?action=play&video=http://www.vidsplay.com/wp-content/uploads/2017/04/crab.mp4
        url = get_url(action='play', video=video['src'])
        # Add the list item to a virtual Kodi folder.
        # is_folder = False means that this item won't open any sub-list.
        is_folder = False
        # Add our item to the Kodi virtual folder listing.
        xbmcplugin.addDirectoryItem(_handle, url, list_item, is_folder)

    # next page
    page = str(int(page) + 1)
    list_item = xbmcgui.ListItem(label='Next')
    list_item.setInfo('video', {
        'title': 'Next',
        'genre': 'next page... ' + page,
        'mediatype': 'video'
    })
    url = get_url(action='listing_video',
                  category=category_num,
                  subcategory=subcategory_num,
                  page=page)
    is_folder = True
    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_NONE)
    # Finish creating a virtual folder.
    xbmcplugin.endOfDirectory(_handle)
Пример #38
0
def list_videos(category):
    """
    Create the list of playable videos in the Kodi interface.

    :param category: Category name
    :type category: str
    """
    # Set plugin category. It is displayed in some skins as the name
    # of the current section.
    xbmcplugin.setPluginCategory(_handle, category)
    # Set plugin content. It allows Kodi to select appropriate views
    # for this type of content.
    xbmcplugin.setContent(_handle, 'videos')
    # Get the list of videos in the category.
    videos = get_videos(category)

    # Iterate through each video.
    for video_id in videos:
        # Get the video item to process.
        video_item = videos[video_id]

        # Create a list item with a text label and a thumbnail image.
        list_item = xbmcgui.ListItem(label=video_item["title"])

        # Set additional info for the list item.
        # 'mediatype' is needed for skin to display info for this ListItem correctly.
        list_item.setInfo('video', {'title': video_item["title"],
                                    'genre': category.title(),
                                    'mediatype': 'video'})

        # Set graphics (thumbnail, fanart, banner, poster, landscape etc.) for the list item.
        # Here we use the same image for all items for simplicity's sake.
        # In a real-life plugin you need to set each image accordingly.
        list_item.setArt({'thumb': video_item["thumbnail"],
                          'icon': video_item["thumbnail"],
                          'fanart': video_item["thumbnail"]
                          })

        # Set 'IsPlayable' property to 'true'.
        # This is mandatory for playable items!
        list_item.setProperty('IsPlayable', 'true')

        referer_header = urllib.urlencode({"Referer": video_item["location"]})
        video_item['url'] += '|%s&amp;%s' % (user_agent_headers, referer_header)

        # Create a URL for a plugin recursive call.
        # Example: plugin://plugin.video.example/?action=play&
        #                           video=[video url]
        url = get_url(action='play', video=video_item['url'])

        # video_url = 'plugin://plugin.video.f4mTester/?url=' + urllib.quote_plus(video['video']) + \
        #            '&amp;streamtype=HLSRETRY&name=' + urllib.quote_plus(video['name']) + \
        #            '&amp;|User-Agent=Mozilla/5.0 (Windows NT 10.0; WOW64; rv:47.0) Gecko/20100101 Firefox/47.0 ' \
        #            'FirePHP/0.7.4&amp;X-Requested-With=ShockwaveFlash/22.0.0.192&amp;Referer=' + \
        #             urllib.quote_plus(video['reference'])
        # url = get_url(action='play', video=video_url)

        # Add the list item to a virtual Kodi folder.
        # is_folder = False means that this item won't open any sub-list.
        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_LABEL_IGNORE_THE)
    # Finish creating a virtual folder.
    xbmcplugin.endOfDirectory(_handle)
def show_listing(list_items,
                 category=None,
                 sort='unsorted',
                 ascending=True,
                 content=None,
                 cache=None,
                 selected=None):
    """Show a virtual directory in Kodi"""
    from xbmcgui import ListItem
    from addon import plugin

    set_property('container.url', 'plugin://' + addon_id() + plugin.path)
    xbmcplugin.setPluginFanart(handle=plugin.handle,
                               image=from_unicode(addon_fanart()))

    usemenucaching = get_setting_bool('usemenucaching', default=True)
    if cache is None:
        cache = usemenucaching
    elif usemenucaching is False:
        cache = False

    if content:
        # content is one of: files, songs, artists, albums, movies, tvshows, episodes, musicvideos
        xbmcplugin.setContent(plugin.handle, content=content)

    # Jump through hoops to get a stable breadcrumbs implementation
    category_label = ''
    if category:
        if not content:
            category_label = 'VRT NU / '
        if plugin.path.startswith(('/favorites/', '/resumepoints/')):
            category_label += localize(30428) + ' / '  # My
        if isinstance(category, int):
            category_label += localize(category)
        else:
            category_label += category
    elif not content:
        category_label = 'VRT NU'
    xbmcplugin.setPluginCategory(handle=plugin.handle, category=category_label)

    # FIXME: Since there is no way to influence descending order, we force it here
    if not ascending:
        sort = 'unsorted'

    # NOTE: When showing tvshow listings and 'showoneoff' was set, force 'unsorted'
    if get_setting_bool(
            'showoneoff',
            default=True) and sort == 'label' and content == 'tvshows':
        sort = 'unsorted'

    # Add all sort methods to GUI (start with preferred)
    xbmcplugin.addSortMethod(handle=plugin.handle,
                             sortMethod=SORT_METHODS[sort])
    for key in sorted(SORT_METHODS):
        if key != sort:
            xbmcplugin.addSortMethod(handle=plugin.handle,
                                     sortMethod=SORT_METHODS[key])

    # FIXME: This does not appear to be working, we have to order it ourselves
#    xbmcplugin.setProperty(handle=plugin.handle, key='sort.ascending', value='true' if ascending else 'false')
#    if ascending:
#        xbmcplugin.setProperty(handle=plugin.handle, key='sort.order', value=str(SORT_METHODS[sort]))
#    else:
#        # NOTE: When descending, use unsorted
#        xbmcplugin.setProperty(handle=plugin.handle, key='sort.order', value=str(SORT_METHODS['unsorted']))

    listing = []
    showfanart = get_setting_bool('showfanart', default=True)
    for title_item in list_items:
        # Three options:
        #  - item is a virtual directory/folder (not playable, path)
        #  - item is a playable file (playable, path)
        #  - item is non-actionable item (not playable, no path)
        is_folder = bool(not title_item.is_playable and title_item.path)
        is_playable = bool(title_item.is_playable and title_item.path)

        list_item = ListItem(label=title_item.label)

        prop_dict = dict(
            IsInternetStream='true' if is_playable else 'false',
            IsPlayable='true' if is_playable else 'false',
            IsFolder='false' if is_folder else 'true',
        )
        if title_item.prop_dict:
            title_item.prop_dict.update(prop_dict)
        else:
            title_item.prop_dict = prop_dict
        # NOTE: The setProperties method is new in Kodi18
        try:
            list_item.setProperties(title_item.prop_dict)
        except AttributeError:
            for key, value in list(title_item.prop_dict.items()):
                list_item.setProperty(key=key, value=str(value))

        # FIXME: The setIsFolder method is new in Kodi18, so we cannot use it just yet
        # list_item.setIsFolder(is_folder)

        if showfanart:
            # Add add-on fanart when fanart is missing
            if not title_item.art_dict:
                title_item.art_dict = dict(fanart=addon_fanart())
            elif not title_item.art_dict.get('fanart'):
                title_item.art_dict.update(fanart=addon_fanart())
            list_item.setArt(title_item.art_dict)

        if title_item.info_dict:
            # type is one of: video, music, pictures, game
            list_item.setInfo(type='video', infoLabels=title_item.info_dict)

        if title_item.stream_dict:
            # type is one of: video, audio, subtitle
            list_item.addStreamInfo('video', title_item.stream_dict)

        if title_item.context_menu:
            list_item.addContextMenuItems(title_item.context_menu)

        url = None
        if title_item.path:
            url = title_item.path

        listing.append((url, list_item, is_folder))

    # Jump to specific item
    if selected is not None:
        pass


#        from xbmcgui import getCurrentWindowId, Window
#        wnd = Window(getCurrentWindowId())
#        wnd.getControl(wnd.getFocusId()).selectItem(selected)

    succeeded = xbmcplugin.addDirectoryItems(plugin.handle, listing,
                                             len(listing))
    xbmcplugin.endOfDirectory(plugin.handle,
                              succeeded,
                              updateListing=False,
                              cacheToDisc=cache)
Пример #40
0
		playList.clear()
		playList.add(video_mp4url, listitem)
		player = xbmc.Player(xbmc.PLAYER_CORE_AUTO)
		player.play(playList)

params = get_params()
mode  = None

try:
	mode  = urllib.unquote_plus(params["mode"])
except:
	pass
try:
	url  = urllib.unquote_plus(params["url"])
except:
	pass

if mode == None:
	get_programs()
	xbmcplugin.setPluginCategory(handle, 'TVJAM.RU')
	xbmcplugin.endOfDirectory(handle)

elif mode == 'channel':
	get_channels(url)
	xbmcplugin.setPluginCategory(handle, 'TVJAM.RU')
	xbmcplugin.endOfDirectory(handle)

elif mode == 'page':
	get_page(url)

Пример #41
0
import xbmcgui
import xbmcaddon
import os
import traceback
from StringIO import StringIO 
import gzip
from urlparse import urlparse 

#'Base settings'
#'Start of the plugin functionality is at the end of the file'
addon = xbmcaddon.Addon()
addonID = 'plugin.video.srf_podcast_ch'
pluginhandle = int(sys.argv[1])
socket.setdefaulttimeout(30)
translation = addon.getLocalizedString
xbmcplugin.setPluginCategory(pluginhandle,"News")
xbmcplugin.setContent(pluginhandle,"tvshows")
addon_work_folder = xbmc.translatePath("special://profile/addon_data/"+addonID)
if not os.path.isdir(addon_work_folder):
    os.mkdir(addon_work_folder)
FavoritesFile = xbmc.translatePath("special://profile/addon_data/"+addonID+"/"+addonID+".favorites")
showSubtitles = addon.getSetting("showSubtitles") == "true"
forceViewMode = addon.getSetting("forceView") == "true"
viewModeShows = str(addon.getSetting("viewIDShows"))
numberOfEpisodesPerPage = str(addon.getSetting("numberOfShowsPerPage"))

#'this method list all SRF-channel when SRF-Podcast was selected in the main menu'
def chooseChannel():
    addChannel('srf', 'SRF', 'chooseOptions')
    addChannel('rts', 'RTS', 'chooseOptions')
    addChannel('rsi', 'RSI', 'chooseOptions')
Пример #42
0
def show_listing(title_items,
                 category=None,
                 sort=None,
                 content=None,
                 cache=True):
    """Show a virtual directory in Kodi"""
    from resources.lib.addon import routing

    if content:
        # content is one of: files, songs, artists, albums, movies, tvshows, episodes, musicvideos, videos, images, games
        xbmcplugin.setContent(routing.handle, content=content)

    # Jump through hoops to get a stable breadcrumbs implementation
    category_label = ''
    if category:
        if not content:
            category_label = addon_name() + ' / '
        if isinstance(category, int):
            category_label += localize(category)
        else:
            category_label += category
    elif not content:
        category_label = addon_name()

    xbmcplugin.setPluginCategory(handle=routing.handle,
                                 category=category_label)

    # Add all sort methods to GUI (start with preferred)
    if sort is None:
        sort = DEFAULT_SORT_METHODS
    elif not isinstance(sort, list):
        sort = [sort] + DEFAULT_SORT_METHODS

    for key in sort:
        xbmcplugin.addSortMethod(handle=routing.handle,
                                 sortMethod=SORT_METHODS[key])

    # Add the listings
    listing = []
    for title_item in title_items:
        # Three options:
        #  - item is a virtual directory/folder (not playable, path)
        #  - item is a playable file (playable, path)
        #  - item is non-actionable item (not playable, no path)
        is_folder = bool(not title_item.is_playable and title_item.path)
        is_playable = bool(title_item.is_playable and title_item.path)

        list_item = xbmcgui.ListItem(label=title_item.title,
                                     path=title_item.path)

        if title_item.prop_dict:
            list_item.setProperties(title_item.prop_dict)
        list_item.setProperty(key='IsPlayable',
                              value='true' if is_playable else 'false')

        list_item.setIsFolder(is_folder)

        if title_item.art_dict:
            list_item.setArt(title_item.art_dict)

        if title_item.info_dict:
            # type is one of: video, music, pictures, game
            list_item.setInfo(type='video', infoLabels=title_item.info_dict)

        if title_item.stream_dict:
            # type is one of: video, audio, subtitle
            list_item.addStreamInfo('video', title_item.stream_dict)

        if title_item.context_menu:
            list_item.addContextMenuItems(title_item.context_menu)

        is_folder = bool(not title_item.is_playable and title_item.path)
        url = title_item.path if title_item.path else None
        listing.append((url, list_item, is_folder))

    succeeded = xbmcplugin.addDirectoryItems(routing.handle, listing,
                                             len(listing))
    xbmcplugin.endOfDirectory(routing.handle, succeeded, cacheToDisc=cache)
Пример #43
0
def seriesalfa(params, url, category):

    xbmctools.addnewfolderextra(CHANNELNAME, "listsimple", category, "0-9",
                                "http://www.series21.com/0-9/", "", "", "")
    xbmctools.addnewfolderextra(CHANNELNAME, "listsimple", category, "A",
                                "http://www.series21.com/a/", "", "", "")
    xbmctools.addnewfolderextra(CHANNELNAME, "listsimple", category, "B",
                                "http://www.series21.com/b/", "", "", "")
    xbmctools.addnewfolderextra(CHANNELNAME, "listsimple", category, "C",
                                "http://www.series21.com/c/", "", "", "")
    xbmctools.addnewfolderextra(CHANNELNAME, "listsimple", category, "D",
                                "http://www.series21.com/d/", "", "", "")
    xbmctools.addnewfolderextra(CHANNELNAME, "listsimple", category, "E",
                                "http://www.series21.com/e/", "", "", "")
    xbmctools.addnewfolderextra(CHANNELNAME, "listsimple", category, "F",
                                "http://www.series21.com/f/", "", "", "")
    xbmctools.addnewfolderextra(CHANNELNAME, "listsimple", category, "G",
                                "http://www.series21.com/g/", "", "", "")
    xbmctools.addnewfolderextra(CHANNELNAME, "listsimple", category, "H",
                                "http://www.series21.com/h/", "", "", "")
    xbmctools.addnewfolderextra(CHANNELNAME, "listsimple", category, "I",
                                "http://www.series21.com/i/", "", "", "")
    xbmctools.addnewfolderextra(CHANNELNAME, "listsimple", category, "J",
                                "http://www.series21.com/j/", "", "", "")
    xbmctools.addnewfolderextra(CHANNELNAME, "listsimple", category, "K",
                                "http://www.series21.com/k/", "", "", "")
    xbmctools.addnewfolderextra(CHANNELNAME, "listsimple", category, "L",
                                "http://www.series21.com/l/", "", "", "")
    xbmctools.addnewfolderextra(CHANNELNAME, "listsimple", category, "M",
                                "http://www.series21.com/m/", "", "", "")
    xbmctools.addnewfolderextra(CHANNELNAME, "listsimple", category, "N",
                                "http://www.series21.com/n/", "", "", "")
    xbmctools.addnewfolderextra(CHANNELNAME, "listsimple", category, "O",
                                "http://www.series21.com/o/", "", "", "")
    xbmctools.addnewfolderextra(CHANNELNAME, "listsimple", category, "P",
                                "http://www.series21.com/p/", "", "", "")
    xbmctools.addnewfolderextra(CHANNELNAME, "listsimple", category, "Q",
                                "http://www.series21.com/q/", "", "", "")
    xbmctools.addnewfolderextra(CHANNELNAME, "listsimple", category, "R",
                                "http://www.series21.com/r/", "", "", "")
    xbmctools.addnewfolderextra(CHANNELNAME, "listsimple", category, "S",
                                "http://www.series21.com/s/", "", "", "")
    xbmctools.addnewfolderextra(CHANNELNAME, "listsimple", category, "T",
                                "http://www.series21.com/t/", "", "", "")
    xbmctools.addnewfolderextra(CHANNELNAME, "listsimple", category, "U",
                                "http://www.series21.com/u/", "", "", "")
    xbmctools.addnewfolderextra(CHANNELNAME, "listsimple", category, "V",
                                "http://www.series21.com/v/", "", "", "")
    xbmctools.addnewfolderextra(CHANNELNAME, "listsimple", category, "W",
                                "http://www.series21.com/w/", "", "", "")
    xbmctools.addnewfolderextra(CHANNELNAME, "listsimple", category, "X",
                                "http://www.series21.com/x/", "", "", "")
    xbmctools.addnewfolderextra(CHANNELNAME, "listsimple", category, "Y",
                                "http://www.series21.com/y/", "", "", "")
    xbmctools.addnewfolderextra(CHANNELNAME, "listsimple", category, "Z",
                                "http://www.series21.com/z/", "", "", "")

    # 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)
Пример #44
0
    def getPictures(self):
        #
        # Get HTML page...
        #
        httpCommunicator = HTTPCommunicator()
        htmlSource = httpCommunicator.get(self.lol_url +
                                          str(self.entries_per_page))

        #
        # Parse HTML page...
        #
        pictures = BeautifulStoneSoup(htmlSource).findAll('picture')
        for picture in pictures:
            #
            # Title (date)
            #
            title = picture.title.string

            #
            # Thumbnail & full image...
            #

            full_image_url = picture.lolimageurl.string
            thumbnail_url = picture.thumbnailimageurl.string

            # Add directory entry...
            listitem = xbmcgui.ListItem(title,
                                        iconImage="DefaultPicture.png",
                                        thumbnailImage=thumbnail_url)
            xbmcplugin.addDirectoryItem(handle=int(sys.argv[1]),
                                        url=full_image_url,
                                        listitem=listitem,
                                        isFolder=False)

        #
        # Next page entry...
        #
        listitem = xbmcgui.ListItem(xbmc.getLocalizedString(30403) %
                                    (self.entries_per_page, self.lol_name),
                                    iconImage="DefaultFolder.png",
                                    thumbnailImage=os.path.join(
                                        self.IMAGES_PATH, 'next-page.png'))
        next_page_url = "%s?action=list&lol_name=%s&lol_url=%s" % (
            sys.argv[0], urllib.quote_plus(
                self.lol_name), urllib.quote_plus(self.lol_url))
        #next_page_url = self.lol_url
        xbmcplugin.addDirectoryItem(handle=int(sys.argv[1]),
                                    url=next_page_url,
                                    listitem=listitem,
                                    isFolder=True)

        #
        # Disable sorting...
        #
        xbmcplugin.addSortMethod(handle=int(sys.argv[1]),
                                 sortMethod=xbmcplugin.SORT_METHOD_NONE)

        #
        # Label (top-right)...
        #
        xbmcplugin.setPluginCategory(
            handle=int(sys.argv[1]),
            category=("%s (%s)" %
                      (self.lol_name,
                       (xbmc.getLocalizedString(30402) % self.current_page))))

        #
        # End of directory...
        #
        xbmcplugin.endOfDirectory(handle=int(sys.argv[1]), succeeded=True)
Пример #45
0
def listarTemporada(params, url, category):
    logger.info("[series21.py] listvideos")
    url1 = "http://www.series21.com"
    if url == "":
        url = "http://www.series21.com"

    # Descarga la página
    data = scrapertools.cachePage(url)
    #logger.info(data)
    titulo_serie = urllib.unquote_plus(params.get("title"))
    if titulo_serie == "Cambiar a otras temporadas":
        titulo_serie = urllib.unquote_plus(params.get("extradata"))
    #thumbnail = urllib.unquote_plus(params.get("thumbnail"))
    #plot = urllib.unquote_plus(params.get("plot"))
    actor = ""
    # Busca el area donde estan los videos y la descripcion
    patronvideos = '<h3>(.*?)</h3>'  # Temporada de la Serie
    patronvideos += '.*?<img.+?src="([^"]+)"  width=.*?/>'  # Thumbnail de la Serie
    patronvideos += '.*?<ul(.*?)</ul>'  # Capitulos de la Serie
    matches = re.compile(patronvideos, re.DOTALL).findall(data)
    patroncapit = '<li><a href="([^"]+)".+?>(.+?)</a>(.+?)</li>'

    patronplot = '<div style="margin:0px; padding:0px; text-align:justify;">(.*?)</div>'
    sinopsis = re.compile(patronplot, re.DOTALL).findall(data)
    plot = "Serie : " + titulo_serie + "\n"

    # Busca los actores
    patronactor = '<div id="actores">(.*?)cursor:pointer'
    matchesactor = re.compile(patronactor, re.DOTALL).findall(data)
    matchesactores = ""
    if len(matchesactor) > 0:
        matchesactores = buscactores(matchesactor[0])
        print ' actores: %s' % str(len(matchesactores))
    if len(matchesactores) > 0:
        actor = "Actores:   "
        c = 0
        actores = "ACTORES DE ESTA SERIE :\n\n"
        for match in matchesactores:
            c = c + 1
            actores = actores + "-" + match[1] + "\n"
            if c == 3 or c == 6:
                actor = actor + match[1] + "\n"
            elif c == 4 or c == 7:
                actor = actor + "*              " + match[1] + " , "
            else:
                actor = actor + match[1] + " , "

    # Abre ventana de eleccion de temporadas

    if len(matches) > 1:
        opciones = []
        opciones.append(" Todas las Temporadas")
        for match in matches:
            temporada = re.sub("<[^>]+>", " ",
                               match[0]).replace("-", "").replace(">", "")
            opciones.append(temporada)
        dia = xbmcgui.Dialog()
        seleccion = dia.select("Elige un tipo de Listado", opciones)
        logger.info("seleccion=%d" % seleccion)
    else:
        seleccion = 0
    if seleccion == -1:
        return
    if seleccion == 0:
        for match in matches:
            print 'esta es la %s' % match[0]
            print 'este es el thumbnail %s ' % match[1]
            thumbnail = urlparse.urljoin(url1, match[1])
            temporada = re.sub("<[^>]+>", " ",
                               match[0]).replace("-", "").replace(">", "")

            temporada += "\n" + actor + "\n" + "Sinopsis : " + str(
                sinopsis[0].replace("\n\t\t\t\t\t", ""))
            matchescapit = re.compile(patroncapit, re.DOTALL).findall(match[2])
            for match1 in matchescapit:
                esp = ""
                subt = ""
                url = match1[0]
                if "esp.gif" in match1[2]:
                    esp = " (Español)"
                if "Subtitulado" in match1[2]:
                    subt = " (VOS)"

                titulo = titulo_serie + " - " + match1[1] + esp + subt
                xbmctools.addnewfolder(CHANNELNAME, "ListarVideos", category,
                                       titulo, url, thumbnail,
                                       plot + temporada)

    else:
        thumbnail = urlparse.urljoin(url1, matches[seleccion - 1][1])
        temporada = re.sub("<[^>]+>", " ", matches[seleccion - 1][0]).replace(
            "-", "").replace(">", "")
        #logger.info("matches "+matches[seleccion-1][2])
        matchescapit = re.compile(patroncapit,
                                  re.DOTALL).findall(matches[seleccion - 1][2])
        plot += temporada + "\n"
        plot += actor + "\n" + "Sinopsis : " + str(sinopsis[0].replace(
            "\n\t\t\t\t\t", ""))
        if len(matchescapit) > 0:
            for match1 in matchescapit:
                url = match1[0]
                titulo = titulo_serie + " - " + match1[1]

                xbmctools.addnewfolder(CHANNELNAME, "ListarVideos", category,
                                       titulo, url, thumbnail, plot)

    # Busca Series relacionadas con los actores
    if len(matchesactores) > 0:
        titulo = "Lista Series relacionadas con los actores"
        xbmctools.addnewfolderextra(CHANNELNAME, "listaractores", category,
                                    titulo, url, thumbnail, actores,
                                    matchesactor[0])

    # 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)
Пример #46
0
def buscaporletraActor(params, url, category):
    logger.info("[series21.py] buscaporletra")
    data = scrapertools.cachePage(url)
    patron = '<div class="title">Listado de Actores</div><br/>(.*?)<ul class="menustyle">'
    matches = re.compile(patron, re.DOTALL).findall(data)
    patron = '<a href="(.*?)">(.*?)</a>'
    matches = re.compile(patron, re.DOTALL).findall(matches[0])

    letras = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"

    opciones = []
    opciones.append("Buscar por palabras (Teclado)")
    #opciones.append("0-9")
    for letra in letras:
        opciones.append(letra)
    dia = xbmcgui.Dialog()
    seleccion = dia.select("busqueda rapida, elige uno : ", opciones)
    logger.info("seleccion=%d" % seleccion)
    if seleccion == -1: return
    if seleccion == 0:
        keyboard = xbmc.Keyboard('')
        keyboard.doModal()
        if (keyboard.isConfirmed()):
            tecleado = keyboard.getText()
            if len(tecleado) > 0:
                logger.info("Nuevo string tecleado   " + tecleado)
                for match in matches:
                    if (string.lower(tecleado)) in (string.lower(match[1])):
                        scrapedurl = "http://www.series21.com" + match[0]
                        scrapedtitle = match[1]
                        scrapedthumbnail = ""
                        scrapedplot = " "
                        if (DEBUG):
                            logger.info("scrapedtitle=" + scrapedtitle)
                            logger.info("scrapedurl=" + scrapedurl)
                            logger.info("scrapedthumbnail=" + scrapedthumbnail)
                            #  Añade al listado de XBMC
                            xbmctools.addnewfolderextra(
                                CHANNELNAME, "listsimple", category,
                                scrapedtitle, scrapedurl, scrapedthumbnail,
                                scrapedplot, "actor")

    else:
        for match in matches:
            if match[1][0:1] == letras[seleccion - 1]:
                scrapedurl = "http://www.series21.com" + match[0]
                scrapedtitle = match[1]
                scrapedthumbnail = ""
                scrapedplot = " "
                if (DEBUG):
                    logger.info("scrapedtitle=" + scrapedtitle)
                    logger.info("scrapedurl=" + scrapedurl)
                    logger.info("scrapedthumbnail=" + scrapedthumbnail)
                    #  Añade al listado de XBMC
                    xbmctools.addnewfolderextra(CHANNELNAME, "listsimple",
                                                category, scrapedtitle,
                                                scrapedurl, scrapedthumbnail,
                                                scrapedplot, "actor")

    # 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)
Пример #47
0
def SeriesBuscaAlfa(params, url, category):
    logger.info("[series21.py] peliscat")

    # Descarga la página
    data = scrapertools.cachePage(url)

    # Extrae los Géneros de las Peliculas
    patronvideos = '<div class="serieslist">(.*?)</div><!--list-->'
    matches = re.compile(patronvideos, re.DOTALL).findall(data)
    patronvideos = '<a href="([^"]+)">([^<]+)</a>'
    matches1 = re.compile(patronvideos, re.DOTALL).findall(matches[0])
    letras = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"

    opciones = []
    opciones.append("Buscar por palabras (Teclado)")
    opciones.append("Listado completo")
    opciones.append("0-9")
    for letra in letras:
        opciones.append(letra)
    dia = xbmcgui.Dialog()
    seleccion = dia.select("busqueda rapida, elige uno : ", opciones)
    logger.info("seleccion=%d" % seleccion)
    if seleccion == -1: return
    if seleccion == 0:
        keyboard = xbmc.Keyboard('')
        keyboard.doModal()
        if (keyboard.isConfirmed()):
            tecleado = keyboard.getText()
            if len(tecleado) > 0:
                logger.info("Nuevo string tecleado   " + tecleado)
                for match in matches1:
                    if (string.lower(tecleado)) in (string.lower(match[1])):
                        scrapedurl = "http://www.series21.com" + match[0]
                        scrapedtitle = match[1]
                        scrapedthumbnail = ""
                        scrapedplot = " "
                        if (DEBUG):
                            logger.info("scrapedtitle=" + scrapedtitle)
                            logger.info("scrapedurl=" + scrapedurl)
                            logger.info("scrapedthumbnail=" + scrapedthumbnail)
                            #  Añade al listado de XBMC
                            xbmctools.addnewfolder(CHANNELNAME,
                                                   "listarTemporada", category,
                                                   scrapedtitle, scrapedurl,
                                                   scrapedthumbnail,
                                                   scrapedplot)
    elif seleccion == 1:
        for match in matches1:
            url = urlparse.urljoin(url, match[0])
            genero = match[1]

            xbmctools.addnewfolder(CHANNELNAME, "listarTemporada", category,
                                   genero, url, "", "")
    elif seleccion == 2:
        for match in matches1:

            if match[1][0:1] in ("0123456789"):
                scrapedurl = match[0]
                scrapedtitle = match[1]
                scrapedthumbnail = ""
                scrapedplot = " "
                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)

    else:
        for match in matches1:
            if match[1][0:1] == letras[seleccion - 3]:
                scrapedurl = "http://www.series21.com" + match[0]
                scrapedtitle = match[1]
                scrapedthumbnail = ""
                scrapedplot = " "
                if (DEBUG):
                    logger.info("scrapedtitle=" + scrapedtitle)
                    logger.info("scrapedurl=" + scrapedurl)
                    logger.info("scrapedthumbnail=" + scrapedthumbnail)
                    #  Añade al listado de XBMC
                    xbmctools.addnewfolder(CHANNELNAME, "listarTemporada",
                                           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)
Пример #48
0
def ListarVideos(params, url, category):
    url1 = "http://www.series21.com"
    url1 = urlparse.urljoin(url1, url)
    title = urllib.unquote_plus(params.get("title"))
    thumbnail = urllib.unquote_plus(params.get("thumbnail"))
    plot = urllib.unquote_plus(params.get("plot"))
    data = scrapertools.cachePage(url1)
    # Busca el area donde estan los videos y la descripcion
    patronvideos = '<div id="content">(.*?)<!-- FIN #content-->'
    matches = re.compile(patronvideos, re.DOTALL).findall(data)
    matchesBK = matches[0]

    # Extrae las entradas (videos) para megavideo
    patronvideos = '<span  style="font-size:12px;"><strong>(.*?)</strong></span><br/>.*?'
    patronvideos += '<span.*?>.*?<a href="http\:\/\/www.megavideo.com\/([\?v=|v/|\?d=]+)([A-Z0-9]{8}).*?" target'

    matches = re.compile(patronvideos, re.DOTALL).findall(matches[0])
    scrapertools.printMatches(matches)
    encontrados = set()
    for match in matches:
        if match[2] not in encontrados:
            encontrados.add(match[2])
            if 'v' in match[1]:
                server = "Megavideo"
            else:
                server = "Megaupload"
            doblaje = scrapertools.entityunescape(match[0])
            # Titulo
            scrapedtitle = title + " -   [" + doblaje + "]" + " (" + server + ")"
            # URL
            scrapedurl = match[2]
            # Thumbnail
            scrapedthumbnail = thumbnail
            # Argumento
            #print 'este es el plot %s ' %plot
            #print ' doblaje %s ' %doblaje
            scrapedplot = plot
            if ("Español" in plot) and not (doblaje in plot):
                scrapedplot = scrapedplot.replace("Español", doblaje)
            elif "subtitulado" in plot and not (doblaje in plot):
                scrapedplot = scrapedplot.replace(
                    "Versión original (subtitulado)", doblaje)
            elif not doblaje in plot:
                scrapedplot += "\n" + "Doblaje : " + doblaje

            # Depuracion
            if (DEBUG):
                logger.info("scrapedtitle=" + scrapedtitle)
                logger.info("scrapedurl=" + scrapedurl)
                logger.info("scrapedthumbnail=" + scrapedthumbnail)

            # Añade al listado de XBMC
            xbmctools.addnewvideo(CHANNELNAME, "play", category, server,
                                  scrapedtitle, scrapedurl, scrapedthumbnail,
                                  scrapedplot)
    if len(matches) == 0:
        listavideos = servertools.findvideos(data)
        encontrados = set()
        for titulo, scrapedurl, servidor in listavideos:
            if scrapedurl.strip() not in encontrados:
                encontrados.add(scrapedurl.strip())
                xbmctools.addnewvideo(CHANNELNAME, "play", category, servidor,
                                      title + " - %s" % titulo, scrapedurl,
                                      thumbnail, plot)
    patronvideos = '<span class="bloque-doblaje">(.+?)</span>[^<]+'
    patronvideos += '<span class="bloque-link">[^<]+<a href="javascript\:goTo\(\'([^\']+)\'\, \'([^\']+)\'\)"(.+?)</span>'
    #patronvideos +='(?:\| <a href="javascript\:goTo\(\'([^\']+)\'\, \'([^\']+)\'\)".*?)</span>'
    matches = re.compile(patronvideos, re.DOTALL).findall(data)
    scrapertools.printMatches(matches)
    for match in matches:

        # URL
        if "megavideo" in match[2]:
            server = "Megavideo"
        elif "megaupload" in match[2]:
            server = "Megaupload"
        if "esp.gif" in match[0]:
            doblaje = "Español"

        else:
            doblaje = match[0].strip()
        base64 = decrypt21.Base64()
        try:
            url2 = re.compile(
                "javascript\:goTo\(\'([^\']+)\'\, \'([^\']+)\'\)").findall(
                    match[3])[0]
            scrapedurl2 = base64._extract_code(base64.decode(url2[0]))
            scrapedurl = base64._extract_code(base64.decode(match[1]))
            part1 = " Parte 1 "
            part2 = " Parte 2 "
            scrapedtitle2 = title + part2 + " -   [" + doblaje + "]" + " (" + server + ")"
            #print match[3]
        except:
            scrapedurl = base64._extract_code(base64.decode(match[1]))
            part1 = ""
            part2 = ""

        scrapedtitle = title + part1 + " -   [" + doblaje + "]" + " (" + server + ")"

        # Thumbnail
        scrapedthumbnail = thumbnail
        # Argumento
        scrapedplot = plot

        # Depuracion
        if (DEBUG):
            logger.info("scrapedtitle=" + scrapedtitle)
            logger.info("scrapedurl=" + scrapedurl)
            logger.info("scrapedthumbnail=" + scrapedthumbnail)

        # Añade al listado de XBMC
        xbmctools.addnewvideo(CHANNELNAME, "play", category, server,
                              scrapedtitle, scrapedurl, scrapedthumbnail,
                              scrapedplot)
        if part2:
            xbmctools.addnewvideo(CHANNELNAME, "play", category, server,
                                  scrapedtitle2, scrapedurl2, scrapedthumbnail,
                                  scrapedplot)

    # Extrae las entradas (videos) directos
    patronvideos = 'flashvars="file=([^\&]+)\&amp;controlbar=over'
    matches = re.compile(patronvideos, re.DOTALL).findall(data)
    scrapertools.printMatches(matches)
    if len(matches) > 0:

        data1 = scrapertools.cachePage(matches[0])
        #logger.info(data)
        patron = 'author">(.*?)</media:credit>.*?<media\:content url="([^"]+)"'
        matches = re.compile(patron, re.DOTALL).findall(data1)
        scrapertools.printMatches(matches)

        for match in matches:
            # Añade al listado de XBMC
            xbmctools.addnewvideo(
                CHANNELNAME, "play", category, "Directo",
                title + " -  [" + match[0] + "]" + " (Directo)", match[1],
                thumbnail, plot)
    # Busca el Spoiler
    patronvideos = '(http://www.youtube.com[^"]+)"'
    matchSpoiler = re.compile(patronvideos, re.DOTALL).findall(data)
    if len(matchSpoiler) > 0:
        encontrados = set()
        for match in matchSpoiler:
            if match not in encontrados:
                encontrados.add(match)
                # Añade al listado de XBMC
                xbmctools.addnewvideo(CHANNELNAME, "youtubeplay", category,
                                      "Directo",
                                      "Ver El Spoiler de : " + title, match,
                                      thumbnail, "Ver Video Spoiler")

    # Lista series relacionadas
    titulo = "Ver otros capitulos de esta temporada"
    matches = buscarelacionados(matchesBK)
    plot2 = "CAPITULOS DE ESTA TEMPORADA :\n\n"
    for match in matches:
        plot2 = plot2 + "-" + match[2] + "\n"
    xbmctools.addnewfolderextra(CHANNELNAME, "listarelacionados", category,
                                titulo, url, thumbnail, plot2, matchesBK)
    #<div class="film"><a href="/house/#t_57"><img src="/thumbs/temporadas/95/120/57.jpg"
    # Cambiar de Temporada
    patron = 'div class="film"><a href="([^"]+)"><img src="([^"]+)" style'
    matchSerie = re.compile(patron, re.DOTALL).findall(matchesBK)
    if len(matchSerie) > 1:
        for temp in matchSerie:
            url2 = urlparse.urljoin(url1, temp[0])
            thumbnail = urlparse.urljoin(url1, temp[1])
            titulo = "Cambiar a otras temporadas"
            titulo_serie = temp[0].split("/")
            titulo2 = titulo_serie[1].replace("-", " ")
            #print ' titulo%s ' %titulo2
            xbmctools.addnewfolderextra(CHANNELNAME, "listarTemporada",
                                        category, titulo, url2, thumbnail,
                                        plot, titulo2)
            break

    # 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)
Пример #49
0
def BrowseContent(viewname, type="", folderid=""):
    
    emby = embyserver.Read_EmbyServer()
    art = artwork.Artwork()
    doUtils = downloadutils.DownloadUtils()
    
    #folderid used as filter ?
    if folderid in ["recent","recentepisodes","inprogress","inprogressepisodes","unwatched","nextepisodes","sets","genres","random","recommended"]:
        filter = folderid
        folderid = ""
    else:
        filter = ""
    
    xbmcplugin.setPluginCategory(int(sys.argv[1]), viewname)
    #get views for root level
    if not folderid:
        views = emby.getViews(type)
        for view in views:
            if view.get("name") == viewname.decode('utf-8'):
                folderid = view.get("id")
    
    utils.logMsg("BrowseContent","viewname: %s - type: %s - folderid: %s - filter: %s" %(viewname.decode('utf-8'), type.decode('utf-8'), folderid.decode('utf-8'), filter.decode('utf-8')))
    #set the correct params for the content type
    #only proceed if we have a folderid
    if folderid:
        if type.lower() == "homevideos":
            xbmcplugin.setContent(int(sys.argv[1]), 'episodes')
            itemtype = "Video,Folder,PhotoAlbum"
        elif type.lower() == "photos":
            xbmcplugin.setContent(int(sys.argv[1]), 'files')
            itemtype = "Photo,PhotoAlbum,Folder"
        else:
            itemtype = ""
        
        #get the actual listing
        if type == "recordings":
            listing = emby.getTvRecordings(folderid)
        elif type == "tvchannels":
            listing = emby.getTvChannels()
        elif filter == "recent":
            listing = emby.getFilteredSection(folderid, itemtype=itemtype.split(",")[0], sortby="DateCreated", recursive=True, limit=25, sortorder="Descending")
        elif filter == "random":
            listing = emby.getFilteredSection(folderid, itemtype=itemtype.split(",")[0], sortby="Random", recursive=True, limit=150, sortorder="Descending")
        elif filter == "recommended":
            listing = emby.getFilteredSection(folderid, itemtype=itemtype.split(",")[0], sortby="SortName", recursive=True, limit=25, sortorder="Ascending", filter="IsFavorite")
        elif filter == "sets":
            listing = emby.getFilteredSection(folderid, itemtype=itemtype.split(",")[1], sortby="SortName", recursive=True, limit=25, sortorder="Ascending", filter="IsFavorite")
        else:
            listing = emby.getFilteredSection(folderid, itemtype=itemtype, recursive=False)
        
        #process the listing
        if listing:
            for item in listing.get("Items"):
                li = createListItemFromEmbyItem(item,art,doUtils)
                if item.get("IsFolder") == True:
                    #for folders we add an additional browse request, passing the folderId
                    path = "%s?id=%s&mode=browsecontent&type=%s&folderid=%s" % (sys.argv[0].decode('utf-8'), viewname.decode('utf-8'), type.decode('utf-8'), item.get("Id").decode('utf-8'))
                    xbmcplugin.addDirectoryItem(handle=int(sys.argv[1]), url=path, listitem=li, isFolder=True)
                else:
                    #playable item, set plugin path and mediastreams
                    xbmcplugin.addDirectoryItem(handle=int(sys.argv[1]), url=li.getProperty("path"), listitem=li)


    if filter == "recent":
        xbmcplugin.addSortMethod(int(sys.argv[1]), xbmcplugin.SORT_METHOD_DATE)
    else:
        xbmcplugin.addSortMethod(int(sys.argv[1]), xbmcplugin.SORT_METHOD_VIDEO_TITLE)
        xbmcplugin.addSortMethod(int(sys.argv[1]), xbmcplugin.SORT_METHOD_DATE)
        xbmcplugin.addSortMethod(int(sys.argv[1]), xbmcplugin.SORT_METHOD_VIDEO_RATING)
        xbmcplugin.addSortMethod(int(sys.argv[1]), xbmcplugin.SORT_METHOD_VIDEO_RUNTIME)

    xbmcplugin.endOfDirectory(handle=int(sys.argv[1]))
Пример #50
0
def listsimple(params, url, category):
    logger.info("[series21.py] listsimple")
    url1 = "http://www.series21.com"
    extra = urllib.unquote_plus(params.get("extradata"))
    title = urllib.unquote_plus(params.get("title"))
    # Descarga la página
    data = scrapertools.cachePage(url)
    logger.info("esta es la url: " + url)
    # Extrae las entradas (carpetas)
    scrapedplot = ""
    patronvideos = ""
    if (title == "Series - Estrenos") or url1 + "/nuevo" in url:
        patronvideos = '<div class="film2"[^>]+>.*?'
        patronvideos += '<img src="([^"]+)".*?'  # Imagen
        patronvideos += '<a href="([^"]+)".*?'  # Url
        patronvideos += '<b>([^<]+)</b>.*?'  # Nombre de la serie
        patronvideos += '<div style[^>]+>([^<]+)</div>'  # Titulo del capitulo
        #patronvideos += '.*?<b>(Temporada:</b>.*?)<.*?</a>--><br/>'
        #patronvideos += '.*?<div style=[^>]+>'                                            # Genero
        #patronvideos += '.*?<b>(Doblaje:</b>.*?)<.*?-->'                                   # Idioma

    elif title in "0-9ABCDEFGHIJKLMNOPQRSTUVWXYZ" or extra == "actor":
        patronvideos = '<a href="([^"]+)"'  # url
        patronvideos += '.*?<img src="([^"]+)".*?'  # Imagen
        patronvideos += 'class="titulo">([^<]+)</a>.*?'  # Titulo
        patronvideos += '<b>(Sinopsis: </b>.*?)</div>'  # Sinopsis
    #<li style="margin:0px; padding:0px;  height:18px; margin-left:5px;">
    #						<b>Dexter</b>: <a href="/dexter/5x10-in-the-beginning/">5x10 -  In the Beginning</a>  | Subtitulado
    elif title == "Series - Novedades":
        patronvideos = '<li style=.*?margin-left[^>]+>[^<]+'
        patronvideos += '<b>([^<]+)</b>\: <a href="([^"]+)"'
        patronvideos += '>([^<]+)</a>(.+?)</li>'
        #patronvideos += '<br /><b>(.*?)</b><br />(.*?)</a></div>'
    logger.info("[ listsimple  patronvideos: " + patronvideos)
    #<li style="margin:0px; padding:0px;  height:18px; margin-left:5px;"><a style="text-decoration:none;" href="/bella-calamidades/1x124-capitulo-124/">Bella calamidades 1x124 - Capitulo - 124</a></li>

    matches = re.compile(patronvideos, re.DOTALL).findall(data)
    scrapertools.printMatches(matches)
    solo_capitulo = False
    #logger.info("[ listsimple  matches")
    for match in matches:
        # Atributos
        #scrapedtitle = match[2]
        #scrapedtitle = scrapedtitle.replace("<span class='style4'>","")
        #scrapedtitle = scrapedtitle.replace("</span>","")
        scrapedurl = urlparse.urljoin(url1, match[1])
        scrapedthumbnail = urlparse.urljoin(url1, match[0])
        scrapedthumbnail = scrapedthumbnail.replace(" ", "")
        if title in "0-9ABCDEFGHIJKLMNOPQRSTUVWXYZ" or extra == "actor":
            scrapedtitle = match[2].replace("\n\t", "")
            scrapedplot = match[3].replace("\n", " ") + "\n"
            scrapedurl = urlparse.urljoin(url1, match[0])
            scrapedthumbnail = urlparse.urljoin(url1, match[1])
            scrapedthumbnail = scrapedthumbnail.replace(" ", "")
        if title == "Series - Novedades":
            scrapedurl = urlparse.urljoin(url1, match[1])
            scrapedthumbnail = ""
            #scrapedthumbnail = scrapedthumbnail.replace(" ","")
            solo_capitulo = True
            #scrapedplot  = "Serie:    "+match[2]+"\n"
            #scrapedplot += "Capitulo: "+match[3]
            if "esp.gif" in match[3]:
                idioma = "Español"
            else:
                idioma = match[3].replace("  | ",
                                          "").replace("\t\t\t\t\t\t", "")

            scrapedtitle = "%s - %s (%s)" % (match[0], match[2], idioma)
        if (title == "Series - Estrenos") or url1 + "/nuevo" in url:
            scrapedtitle = match[2]
            scrapedurl = urlparse.urljoin(url1, match[1])
            scrapedthumbnail = urlparse.urljoin(url1, match[0])
            scrapedthumbnail = scrapedthumbnail.replace(" ", "")
            solo_capitulo = True
            scrapedtitle = scrapedtitle + " - " + match[3].replace("\t\t", "")
            #scrapedplot = match[3].replace("\n","")+"\n"
            #scrapedplot  = scrapedplot.replace(":",":          ")
            #scrapedplot += match[5].replace("\n"," ")+"\n"
            #scrapedplot += match[6].replace(":",":      ")
        #scrapedtitle = scrapedtitle.replace("\n\t"," ")
        scrapedplot = re.sub("<[^>]+>", " ", scrapedplot)
        scrapedplot = scrapedplot.replace("&eacute;", "é")
        scrapedplot = scrapedplot.replace("&oacute;", "ó")
        scrapedplot = scrapedplot.replace("&ntilde;", "ñ")
        if (DEBUG):
            logger.info("title=[" + scrapedtitle + "], url=[" + scrapedurl +
                        "], thumbnail=[" + scrapedthumbnail + "]")

        # Añade al listado de XBMC
        if solo_capitulo:
            xbmctools.addnewfolder(CHANNELNAME, "ListarVideos", category,
                                   scrapedtitle, scrapedurl, scrapedthumbnail,
                                   scrapedplot)
        else:
            xbmctools.addnewfolder(CHANNELNAME, "listarTemporada", category,
                                   scrapedtitle, scrapedurl, scrapedthumbnail,
                                   scrapedplot)
        #<div class="pagination" align="center" ><p><span  class='current'>1</span><a  href='/estrenos/2/'>2</a><a  href='/estrenos/2/'>Siguiente &raquo;</a><a  href='/estrenos/2/'></a>
    # Extrae la marca de siguiente página
    if title == "Series - Novedades" or "http://www.series21.com/nuevo" in url:
        patronvideos = '<div class="pagination" align="center" ><div.*?<a href="([^"]+)">Más series'

        matches = re.compile(patronvideos, re.DOTALL).findall(data)
        scrapertools.printMatches(matches)

        if len(matches) > 0:
            extra = "siguiente"
            scrapedtitle = "Página siguiente"
            scrapedurl = urlparse.urljoin(url1, matches[0])
            scrapedthumbnail = ""
            scrapedplot = ""
            xbmctools.addnewfolderextra(CHANNELNAME, "listsimple", category,
                                        scrapedtitle, scrapedurl,
                                        scrapedthumbnail, scrapedplot, extra)
    # 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)
Пример #51
0
    def __init__( self, *args, **kwargs ):
        print "==============================="
        print "  D17 Replay - Version: %s"%__version__
        print "==============================="
        print
        self.set_debug_mode()
        if self.debug_mode:
            print "Python version:"
            print sys.version_info
            print "ROOTDIR: %s"%ROOTDIR
            print "ADDON_DATA: %s"%ADDON_DATA
            print "CACHEDIR: %s"%CACHEDIR  
        params    = self.get_params()
        url       = None
        name      = None
        mode      = None
        iconimage = None            
        try:
            url=urllib.unquote_plus(params["url"])
        except:
            pass
        try:
            name=urllib.unquote_plus(params["name"])
        except:
            pass
        try:
            mode=int(params["mode"])
        except:
            pass
        try:
            iconimage=urllib.unquote_plus(params["iconimage"])
        except:
            pass            
        if self.debug_mode:
            print "Mode: "+str(mode)
            print "URL: "+str(url)
            print "Name: "+str(name)
            print "Iconimage: "+str(iconimage)
 
        # Check if directories in user data exist
        for i in range(len(dirCheckList)):
            self.checkfolder(dirCheckList[i]) 
    
        if mode==None or url==None or len(url)<1:
            if self.debug_mode:
                print "GET_CATEGORIES("+WEBROOT+")"
            self.GET_CATEGORIES(WEBROOT)
            self.clean_thumbnail(str(url))
            xbmcplugin.setPluginCategory(handle=int(sys.argv[1]),category=__language__(30000))
            xbmcplugin.endOfDirectory(int(sys.argv[1]))
            
        elif mode==1:
            if self.debug_mode:
                print "GET_EMISSIONS_DIR : "+url 
            self.GET_EMISSIONS_DIR(url)         
            self.clean_thumbnail(str(url))
            xbmcplugin.setPluginCategory(handle=int(sys.argv[1]),category=__language__(30000))
            xbmcplugin.endOfDirectory(int(sys.argv[1]))            
            
        elif mode==2:
            if self.debug_mode:
                print "GET_EPISODES("+url+")"
            self.GET_EPISODES(url,name)
            self.clean_thumbnail(str(url))
            xbmcplugin.setPluginCategory(handle=int(sys.argv[1]),category=__language__(30000))
            xbmcplugin.endOfDirectory(int(sys.argv[1]))            

        elif mode==3:
            if self.debug_mode:
                print "PLAY_VIDEO"
            print "vid :"+str(url)
            video_url = self.GET_VIDEO_CANAL(str(url),'d17/')
            item = xbmcgui.ListItem(path=video_url) 
            xbmcplugin.setResolvedUrl(handle=int(sys.argv[1]), succeeded=True, listitem=item)
Пример #52
0
def invoke(context):  # pylint: disable=too-many-branches,too-many-statements
    xbmcplugin.setPluginCategory(context.handle,
                                 context.addon.getAddonInfo('name'))

    if not prompt_to_enable_inputstream_adaptive(context):
        xbmcplugin.endOfDirectory(context.handle, False)
        return

    show_main_menu_item = context.settings.show_main_menu_item

    items = []
    users = None

    logged_in = context.api.logged_in
    tv_logged_in = context.api.tv_logged_in

    fanart = context.addon.getAddonInfo('fanart')

    has_channel_mine = False
    if logged_in:
        has_channel_mine = context.api.channel_by_username('mine') != {}

    if not logged_in or not tv_logged_in:
        if show_main_menu_item('sign.in'):
            label = context.i18n('Sign in with Google')
            action = Action(label=bold(label),
                            path=create_addon_path(
                                parameters={'mode': str(MODES.SIGN_IN)}))
            action.ListItem.setArt({
                'icon': GOOGLE_SIGN_IN,
                'thumb': GOOGLE_SIGN_IN,
                'fanart': fanart,
            })

            # artificial centering of plot
            unicode_spaces = ''
            spaces_required = (15 - (len(label) - 19))
            if spaces_required > 0:
                unicode_spaces = '\u2008' * spaces_required
            plot = unicode_spaces + bold(label)
            action.ListItem.setInfo('video', {
                'plot': plot,
                'plotoutline': plot,
            })

            context_menus = _context_menu_hide_menu_item(
                context, 'sign.in', label)
            action.ListItem.addContextMenuItems(context_menus)
            items.append(tuple(action))

    if show_main_menu_item('most.popular'):
        label = context.i18n('Most Popular')
        directory = Directory(
            label=label,
            path=create_addon_path(
                parameters={'mode': str(MODES.MOST_POPULAR)}))
        directory.ListItem.setArt({
            'icon': 'DefaultTVShows.png',
            'thumb': 'DefaultTVShows.png',
            'fanart': fanart,
        })
        context_menus = _context_menu_hide_menu_item(context, 'most.popular',
                                                     label)
        directory.ListItem.addContextMenuItems(context_menus)
        items.append(tuple(directory))

    if show_main_menu_item('most.popular.regionally'):
        label = context.i18n('Most Popular Regionally')
        directory = Directory(
            label=label,
            path=create_addon_path(
                parameters={'mode': str(MODES.MOST_POPULAR_REGIONALLY)}))
        directory.ListItem.setArt({
            'icon': 'DefaultCountry.png',
            'thumb': 'DefaultCountry.png',
            'fanart': fanart,
        })
        context_menus = _context_menu_hide_menu_item(
            context, 'most.popular.regionally', label)
        directory.ListItem.addContextMenuItems(context_menus)
        items.append(tuple(directory))

    if show_main_menu_item('categories'):
        label = context.i18n('Categories')
        directory = Directory(
            label=label,
            path=create_addon_path(parameters={'mode': str(MODES.CATEGORIES)}))
        directory.ListItem.setArt({
            'icon': 'DefaultGenre.png',
            'thumb': 'DefaultGenre.png',
            'fanart': fanart,
        })
        context_menus = _context_menu_hide_menu_item(context, 'categories',
                                                     label)
        directory.ListItem.addContextMenuItems(context_menus)
        items.append(tuple(directory))

    if logged_in:
        if show_main_menu_item('my.channel') and has_channel_mine:
            label = context.i18n('My Channel')
            directory = Directory(
                label=label,
                path=create_addon_path(
                    parameters={'mode': str(MODES.MY_CHANNEL)}))
            directory.ListItem.setArt({
                'icon': 'DefaultTVShows.png',
                'thumb': 'DefaultTVShows.png',
                'fanart': fanart,
            })
            context_menus = _context_menu_hide_menu_item(
                context, 'my.channel', label)
            directory.ListItem.addContextMenuItems(context_menus)
            items.append(tuple(directory))

        if show_main_menu_item('liked.videos'):
            label = context.i18n('Liked Videos')
            directory = Directory(
                label=label,
                path=create_addon_path(
                    parameters={'mode': str(MODES.LIKED_VIDEOS)}))
            directory.ListItem.setArt({
                'icon': 'DefaultTVShows.png',
                'thumb': 'DefaultTVShows.png',
                'fanart': fanart,
            })
            context_menus = _context_menu_hide_menu_item(
                context, 'liked.videos', label)
            directory.ListItem.addContextMenuItems(context_menus)
            items.append(tuple(directory))

        if show_main_menu_item('disliked.videos'):
            label = context.i18n('Disliked Videos')
            directory = Directory(
                label=label,
                path=create_addon_path(
                    parameters={'mode': str(MODES.DISLIKED_VIDEOS)}))
            directory.ListItem.setArt({
                'icon': 'DefaultTVShows.png',
                'thumb': 'DefaultTVShows.png',
                'fanart': fanart,
            })
            context_menus = _context_menu_hide_menu_item(
                context, 'disliked.videos', label)
            directory.ListItem.addContextMenuItems(context_menus)
            items.append(tuple(directory))

        if show_main_menu_item('history'):
            users = UserStorage()
            if users.history_playlist:
                label = context.i18n('History')
                directory = Directory(
                    label=label,
                    path=create_addon_path(
                        parameters={
                            'mode': str(MODES.PLAYLIST),
                            'playlist_id': users.history_playlist
                        }))
                directory.ListItem.setArt({
                    'icon': 'DefaultVideoPlaylists.png',
                    'thumb': 'DefaultVideoPlaylists.png',
                    'fanart': fanart,
                })
                context_menus = _context_menu_hide_menu_item(
                    context, 'history', label)
                directory.ListItem.addContextMenuItems(context_menus)
                items.append(tuple(directory))

        if show_main_menu_item('watch.later'):
            if not users:
                users = UserStorage()

            if users.watchlater_playlist:
                label = context.i18n('Watch Later')
                directory = Directory(
                    label=label,
                    path=create_addon_path(
                        parameters={
                            'mode': str(MODES.PLAYLIST),
                            'playlist_id': users.watchlater_playlist
                        }))
                directory.ListItem.setArt({
                    'icon': 'DefaultVideoPlaylists.png',
                    'thumb': 'DefaultVideoPlaylists.png',
                    'fanart': fanart,
                })
                context_menus = _context_menu_hide_menu_item(
                    context, 'watch.later', label)
                directory.ListItem.addContextMenuItems(context_menus)
                items.append(tuple(directory))

        if show_main_menu_item('playlists') and has_channel_mine:
            label = context.i18n('Playlists')
            directory = Directory(
                label=label,
                path=create_addon_path(parameters={
                    'mode': str(MODES.PLAYLISTS),
                    'channel_id': 'mine'
                }))
            directory.ListItem.setArt({
                'icon': 'DefaultVideoPlaylists.png',
                'thumb': 'DefaultVideoPlaylists.png',
                'fanart': fanart,
            })
            context_menus = _context_menu_hide_menu_item(
                context, 'playlists', label)
            directory.ListItem.addContextMenuItems(context_menus)
            items.append(tuple(directory))

        if show_main_menu_item('subscriptions'):
            label = context.i18n('Subscriptions')
            directory = Directory(
                label=label,
                path=create_addon_path(
                    parameters={'mode': str(MODES.SUBSCRIPTIONS)}))
            directory.ListItem.setArt({
                'icon': 'DefaultStudios.png',
                'thumb': 'DefaultStudios.png',
                'fanart': fanart,
            })
            context_menus = _context_menu_hide_menu_item(
                context, 'subscriptions', label)
            directory.ListItem.addContextMenuItems(context_menus)
            items.append(tuple(directory))

    if context.settings.favorite_channel_maximum > 0 and show_main_menu_item(
            'favorite.channels'):
        label = context.i18n('Favorite Channels')
        directory = Directory(
            label=label,
            path=create_addon_path(
                parameters={'mode': str(MODES.FAVORITE_CHANNELS)}))
        directory.ListItem.setArt({
            'icon': 'DefaultStudios.png',
            'thumb': 'DefaultStudios.png',
            'fanart': fanart,
        })
        context_menus = [
            (context.i18n('Import from xml'),
             'RunScript(%s,mode=%s&action=import)' %
             (ADDON_ID, str(SCRIPT_MODES.FAVORITE_CHANNELS))),
        ]
        context_menus += _context_menu_hide_menu_item(context,
                                                      'favorite.channels',
                                                      label)
        directory.ListItem.addContextMenuItems(context_menus)
        items.append(tuple(directory))

    if context.settings.favorite_playlist_maximum > 0 and show_main_menu_item(
            'favorite.playlists'):
        label = context.i18n('Favorite Playlists')
        directory = Directory(
            label=label,
            path=create_addon_path(
                parameters={'mode': str(MODES.FAVORITE_PLAYLISTS)}))
        directory.ListItem.setArt({
            'icon': 'DefaultVideoPlaylists.png',
            'thumb': 'DefaultVideoPlaylists.png',
            'fanart': fanart,
        })
        context_menus = _context_menu_hide_menu_item(context,
                                                     'favorite.playlists',
                                                     label)
        directory.ListItem.addContextMenuItems(context_menus)
        items.append(tuple(directory))

    if show_main_menu_item('live'):
        label = context.i18n('Live')
        directory = Directory(
            label=label,
            path=create_addon_path(parameters={'mode': str(MODES.LIVE)}))
        directory.ListItem.setArt({
            'icon': 'DefaultMovies.png',
            'thumb': 'DefaultMovies.png',
            'fanart': fanart,
        })
        context_menus = _context_menu_hide_menu_item(context, 'live', label)
        directory.ListItem.addContextMenuItems(context_menus)
        items.append(tuple(directory))

    if show_main_menu_item('search'):
        label = context.i18n('Search')
        directory = Directory(
            label=label,
            path=create_addon_path(parameters={'mode': str(MODES.SEARCH)}))
        directory.ListItem.setArt({
            'icon': 'DefaultAddonsSearch.png',
            'thumb': 'DefaultAddonsSearch.png',
            'fanart': fanart,
        })
        context_menus = _context_menu_hide_menu_item(context, 'search', label)
        directory.ListItem.addContextMenuItems(context_menus)
        items.append(tuple(directory))

    if logged_in:
        if show_main_menu_item('sign.out'):
            label = context.i18n('Sign Out')
            action = Action(label=label,
                            path=create_addon_path(
                                parameters={'mode': str(MODES.SIGN_OUT)}))
            action.ListItem.setArt({
                'icon': 'OverlayLocked.png',
                'thumb': 'OverlayLocked.png',
                'fanart': fanart,
            })
            context_menus = _context_menu_hide_menu_item(
                context, 'sign.out', label)
            action.ListItem.addContextMenuItems(context_menus)
            items.append(tuple(action))

    if show_main_menu_item('manage.users'):
        if not users:
            users = UserStorage()

        label = context.i18n('Manage Users')
        action = Action(label=label,
                        path=create_addon_path(
                            parameters={'mode': str(MODES.MANAGE_USERS)}))
        action.ListItem.setArt({
            'icon': users.avatar or 'DefaultUser.png',
            'thumb': users.avatar or 'DefaultUser.png',
            'fanart': fanart,
        })
        context_menus = _context_menu_hide_menu_item(context, 'manage.users',
                                                     label)
        action.ListItem.addContextMenuItems(context_menus)
        items.append(tuple(action))

    if show_main_menu_item('open.settings'):
        label = context.i18n('Settings')
        action = Action(
            label=label,
            path=create_addon_path(parameters={'mode': str(MODES.SETTINGS)}))
        action.ListItem.setArt({
            'icon': 'DefaultIconInfo.png',
            'thumb': 'DefaultIconInfo.png',
            'fanart': fanart,
        })
        context_menus = _context_menu_hide_menu_item(context, 'open.settings',
                                                     label)
        action.ListItem.addContextMenuItems(context_menus)
        items.append(tuple(action))

    xbmcplugin.addDirectoryItems(context.handle, items, len(items))

    xbmcplugin.endOfDirectory(context.handle, True)
Пример #53
0
def browse(media, view_id=None, folder=None, server_id=None):
    ''' Browse content dynamically.
    '''
    LOG.info("--[ v:%s/%s ] %s", view_id, media, folder)

    if not window('jellyfin_online.bool') and server_id is None:

        monitor = xbmc.Monitor()

        for i in range(300):
            if window('jellyfin_online.bool'):
                break
            elif monitor.waitForAbort(0.1):
                return
        else:
            LOG.error("Default server is not online.")

            return

    folder = folder.lower() if folder else None

    if folder is None and media in ('homevideos', 'movies', 'books',
                                    'audiobooks'):
        return browse_subfolders(media, view_id, server_id)

    if folder and folder == 'firstletter':
        return browse_letters(media, view_id, server_id)

    if view_id:

        view = TheVoid('GetItem', {'ServerId': server_id, 'Id': view_id}).get()
        xbmcplugin.setPluginCategory(int(sys.argv[1]), view['Name'])

    content_type = "files"

    if media in ('tvshows', 'seasons', 'episodes', 'movies', 'musicvideos',
                 'songs', 'albums'):
        content_type = media
    elif media in ('homevideos', 'photos'):
        content_type = "images"
    elif media in ('books', 'audiobooks'):
        content_type = "videos"
    elif media == 'music':
        content_type = "artists"

    if folder == 'recentlyadded':
        listing = TheVoid('RecentlyAdded', {
            'Id': view_id,
            'ServerId': server_id
        }).get()
    elif folder == 'genres':
        listing = TheVoid('Genres', {
            'Id': view_id,
            'ServerId': server_id
        }).get()
    elif media == 'livetv':
        listing = TheVoid('LiveTV', {
            'Id': view_id,
            'ServerId': server_id
        }).get()
    elif folder == 'unwatched':
        listing = TheVoid('Browse', {
            'Id': view_id,
            'ServerId': server_id,
            'Filters': ['IsUnplayed']
        }).get()
    elif folder == 'favorite':
        listing = TheVoid('Browse', {
            'Id': view_id,
            'ServerId': server_id,
            'Filters': ['IsFavorite']
        }).get()
    elif folder == 'inprogress':
        listing = TheVoid('Browse', {
            'Id': view_id,
            'ServerId': server_id,
            'Filters': ['IsResumable']
        }).get()
    elif folder == 'boxsets':
        listing = TheVoid(
            'Browse', {
                'Id': view_id,
                'ServerId': server_id,
                'Media': get_media_type('boxsets'),
                'Recursive': True
            }).get()
    elif folder == 'random':
        listing = TheVoid(
            'Browse', {
                'Id': view_id,
                'ServerId': server_id,
                'Media': get_media_type(content_type),
                'Sort': "Random",
                'Limit': 25,
                'Recursive': True
            }).get()
    elif (folder or "").startswith('firstletter-'):
        listing = TheVoid(
            'Browse', {
                'Id': view_id,
                'ServerId': server_id,
                'Media': get_media_type(content_type),
                'Params': {
                    'NameStartsWith': folder.split('-')[1]
                }
            }).get()
    elif (folder or "").startswith('genres-'):
        listing = TheVoid(
            'Browse', {
                'Id': view_id,
                'ServerId': server_id,
                'Media': get_media_type(content_type),
                'Params': {
                    'GenreIds': folder.split('-')[1]
                }
            }).get()
    elif folder == 'favepisodes':
        listing = TheVoid(
            'Browse', {
                'Media': get_media_type(content_type),
                'ServerId': server_id,
                'Limit': 25,
                'Filters': ['IsFavorite']
            }).get()
    elif media == 'homevideos':
        listing = TheVoid(
            'Browse', {
                'Id': folder or view_id,
                'Media': get_media_type(content_type),
                'ServerId': server_id,
                'Recursive': False
            }).get()
    elif media == 'movies':
        listing = TheVoid(
            'Browse', {
                'Id': folder or view_id,
                'Media': get_media_type(content_type),
                'ServerId': server_id,
                'Recursive': True
            }).get()
    elif media in ('boxset', 'library'):
        listing = TheVoid('Browse', {
            'Id': folder or view_id,
            'ServerId': server_id,
            'Recursive': True
        }).get()
    elif media == 'episodes':
        listing = TheVoid(
            'Browse', {
                'Id': folder or view_id,
                'Media': get_media_type(content_type),
                'ServerId': server_id,
                'Recursive': True
            }).get()
    elif media == 'boxsets':
        listing = TheVoid(
            'Browse', {
                'Id': folder or view_id,
                'ServerId': server_id,
                'Recursive': False,
                'Filters': ["Boxsets"]
            }).get()
    elif media == 'tvshows':
        listing = TheVoid(
            'Browse', {
                'Id': folder or view_id,
                'ServerId': server_id,
                'Recursive': True,
                'Media': get_media_type(content_type)
            }).get()
    elif media == 'seasons':
        listing = TheVoid('BrowseSeason', {
            'Id': folder,
            'ServerId': server_id
        }).get()
    elif media != 'files':
        listing = TheVoid(
            'Browse', {
                'Id': folder or view_id,
                'ServerId': server_id,
                'Recursive': False,
                'Media': get_media_type(content_type)
            }).get()
    else:
        listing = TheVoid('Browse', {
            'Id': folder or view_id,
            'ServerId': server_id,
            'Recursive': False
        }).get()

    if listing:

        actions = Actions(server_id)
        list_li = []
        listing = listing if type(listing) == list else listing.get(
            'Items', [])

        for item in listing:

            li = xbmcgui.ListItem()
            li.setProperty('jellyfinid', item['Id'])
            li.setProperty('jellyfinserver', server_id)
            actions.set_listitem(item, li)

            if item.get('IsFolder'):

                params = {
                    'id': view_id or item['Id'],
                    'mode': "browse",
                    'type': get_folder_type(item, media) or media,
                    'folder': item['Id'],
                    'server': server_id
                }
                path = "%s?%s" % ("plugin://plugin.video.jellyfin/",
                                  urllib.urlencode(params))
                context = []

                if item['Type'] in ('Series', 'Season', 'Playlist'):
                    context.append((
                        "Play",
                        "RunPlugin(plugin://plugin.video.jellyfin/?mode=playlist&id=%s&server=%s)"
                        % (item['Id'], server_id)))

                if item['UserData']['Played']:
                    context.append((_(
                        16104
                    ), "RunPlugin(plugin://plugin.video.jellyfin/?mode=unwatched&id=%s&server=%s)"
                                    % (item['Id'], server_id)))
                else:
                    context.append((_(
                        16103
                    ), "RunPlugin(plugin://plugin.video.jellyfin/?mode=watched&id=%s&server=%s)"
                                    % (item['Id'], server_id)))

                li.addContextMenuItems(context)
                list_li.append((path, li, True))

            elif item['Type'] == 'Genre':

                params = {
                    'id': view_id or item['Id'],
                    'mode': "browse",
                    'type': get_folder_type(item, media) or media,
                    'folder': 'genres-%s' % item['Id'],
                    'server': server_id
                }
                path = "%s?%s" % ("plugin://plugin.video.jellyfin/",
                                  urllib.urlencode(params))
                list_li.append((path, li, True))

            else:
                if item['Type'] not in ('Photo', 'PhotoAlbum'):
                    params = {
                        'id': item['Id'],
                        'mode': "play",
                        'server': server_id
                    }
                    path = "%s?%s" % ("plugin://plugin.video.jellyfin/",
                                      urllib.urlencode(params))
                    li.setProperty('path', path)
                    context = [(_(
                        13412
                    ), "RunPlugin(plugin://plugin.video.jellyfin/?mode=playlist&id=%s&server=%s)"
                                % (item['Id'], server_id))]

                    if item['UserData']['Played']:
                        context.append((_(
                            16104
                        ), "RunPlugin(plugin://plugin.video.jellyfin/?mode=unwatched&id=%s&server=%s)"
                                        % (item['Id'], server_id)))
                    else:
                        context.append((_(
                            16103
                        ), "RunPlugin(plugin://plugin.video.jellyfin/?mode=watched&id=%s&server=%s)"
                                        % (item['Id'], server_id)))

                    li.addContextMenuItems(context)

                list_li.append((li.getProperty('path'), li, False))

        xbmcplugin.addDirectoryItems(int(sys.argv[1]), list_li, len(list_li))

    if content_type == 'images':
        xbmcplugin.addSortMethod(int(sys.argv[1]),
                                 xbmcplugin.SORT_METHOD_VIDEO_TITLE)
        xbmcplugin.addSortMethod(int(sys.argv[1]), xbmcplugin.SORT_METHOD_DATE)
        xbmcplugin.addSortMethod(int(sys.argv[1]),
                                 xbmcplugin.SORT_METHOD_VIDEO_RATING)
        xbmcplugin.addSortMethod(int(sys.argv[1]),
                                 xbmcplugin.SORT_METHOD_VIDEO_RUNTIME)

    xbmcplugin.setContent(int(sys.argv[1]), content_type)
    xbmcplugin.endOfDirectory(int(sys.argv[1]))
Пример #54
0
    def __init__( self, *args, **kwargs ):
        print "==============================="
        print "  D8 - Version: %s"%__version__
        print "==============================="
        print
        self.set_debug_mode()
        if self.debug_mode:
            print "Python version:"
            print sys.version_info
            print "ROOTDIR: %s"%ROOTDIR
            print "ADDON_DATA: %s"%ADDON_DATA
            print "CACHEDIR: %s"%CACHEDIR  
        params    = self.get_params()
        url       = None
        name      = None
        mode      = None
        iconimage = ''            
        try:
            url=urllib.unquote_plus(params["url"])
        except:
            pass
        try:
            name=urllib.unquote_plus(params["name"])
        except:
            pass
        try:
            mode=int(params["mode"])
        except:
            pass
        try:
            iconimage=urllib.unquote_plus(params["iconimage"])
        except:
            pass            
        if self.debug_mode:
            print "Mode: "+str(mode)
            print "URL: "+str(url)
            print "Name: "+str(name)
            print "Iconimage: "+str(iconimage)
 
        # Check if directories in user data exist
        for i in range(len(dirCheckList)):
            self.checkfolder(dirCheckList[i]) 
    
        if mode==None or url==None or len(url)<1:
            if self.debug_mode:
                print "GET_CATEGORIES("+WEBSITE+")"
            self.GET_CATEGORIES(WEBSITE)
            self.clean_thumbnail(str(url))
            xbmcplugin.setPluginCategory(handle=int(sys.argv[1]),category=__language__(30000))
            xbmcplugin.endOfDirectory(int(sys.argv[1]))
                            
        elif mode==1:
            if self.debug_mode:
                print "GET_EPISODES D8("+url+","+iconimage+")"
            self.GET_EPISODES_D8(url,iconimage)
            self.clean_thumbnail(str(url))
            xbmcplugin.setPluginCategory(handle=int(sys.argv[1]),category=__language__(30000))
            xbmcplugin.endOfDirectory(int(sys.argv[1]))

        elif mode==2:
            if self.debug_mode:
                print "GET_EMISSIONS : "+url 
            self.GET_EMISSIONS(url)         
            self.clean_thumbnail(str(url))
            xbmcplugin.setPluginCategory(handle=int(sys.argv[1]),category=__language__(30000))
            xbmcplugin.endOfDirectory(int(sys.argv[1]))
                    
        elif mode==3:
            if self.debug_mode:
                print "GET_EMISSIONS_DIR("+url+","+iconimage+")"
            self.GET_EMISSIONS_DIR(url,iconimage)
            self.clean_thumbnail(str(url))
            xbmcplugin.setPluginCategory(handle=int(sys.argv[1]),category=__language__(30000))
            xbmcplugin.endOfDirectory(int(sys.argv[1]))
            
        elif mode==4:
            if self.debug_mode:
                print "GET_EPISODES CANAL("+url+","+iconimage+")"
            self.GET_EPISODES_CANAL(url,iconimage)
            self.clean_thumbnail(str(url))
            xbmcplugin.setPluginCategory(handle=int(sys.argv[1]),category=__language__(30000))
            xbmcplugin.endOfDirectory(int(sys.argv[1]))
            
        elif mode==5:
            if self.debug_mode:
                print "PLAY_VIDEO"
            VID_cplus = re.findall("""CANAL PLUS : VID=(.*)""",url)
            VID_d8    = re.findall("""D8 : VID=(.*)""",url)
            VID_live  = re.findall("""LIVE : VID=(.*)""",url)
            if VID_cplus :
                VID = VID_cplus[0]
                print "vid :"+VID
                video_url = self.GET_VIDEO_CANAL(VID,'cplus/')
            elif VID_d8 :
                VID = VID_d8[0]
                print "vid :"+VID
                video_url = self.GET_VIDEO_CANAL(VID,'d8/')
            elif VID_live :
                VID = VID_live[0]
                print "vid :"+VID
                video_url = self.GET_VIDEO_CANAL(VID,'d8/',live=True)
            item = xbmcgui.ListItem(path=video_url) 
            xbmcplugin.setResolvedUrl(handle=int(sys.argv[1]), succeeded=True, listitem=item)

        elif mode==100:
            if self.debug_mode:
                print "GET_LIVE"
            self.GET_LIVE(url)
            self.clean_thumbnail(str(url))
            xbmcplugin.setPluginCategory(handle=int(sys.argv[1]),category=__language__(30000))
            xbmcplugin.endOfDirectory(int(sys.argv[1]))
        
        xbmcplugin.addSortMethod(handle=int(sys.argv[1]),sortMethod=xbmcplugin.SORT_METHOD_UNSORTED)
        xbmcplugin.addSortMethod(handle=int(sys.argv[1]),sortMethod=xbmcplugin.SORT_METHOD_LABEL)
Пример #55
0
    def set_folder(self,
                   list_items,
                   pluginurl,
                   pluginhandle,
                   pluginquery,
                   folder_type,
                   title=None):

        folder_defs = CONST['FOLDERS'].get(folder_type)
        old_pluginurl = getInfoLabel('Container.FolderPath')
        old_postion = getInfoLabel('Container.CurrentItem')

        addDirectoryItems(pluginhandle, list_items, len(list_items))

        if title is not None:
            setPluginCategory(pluginhandle, title)

        if 'content_type' in folder_defs.keys():
            self.log_debug('set_folder: set content_type: {}',
                           folder_defs['content_type'])
            setContent(pluginhandle, folder_defs['content_type'])
        endOfDirectory(
            handle=pluginhandle,
            cacheToDisc=(
                folder_defs.get('cacheable', False)
                and (self.get_bool_setting('disable_foldercache') is False)))

        self.wait_for_infolabel('Container.FolderPath',
                                compat._format('{}{}', pluginurl, pluginquery))

        if 'view_mode' in folder_defs.keys():
            self.set_view_mode(folder_defs['view_mode'])

        if 'sort' in folder_defs.keys():
            self.set_folder_sort(folder_defs['sort'])

        # reset the postion to the last "known" if it is gt 1, if pluginurls matching -> likely to be a 'refresh'
        if getInfoLabel(
                'Container.FolderPath'
        ) == old_pluginurl and old_postion.isdigit() and int(old_postion) > 1:
            from xbmcgui import Window, getCurrentWindowId, getCurrentWindowDialogId

            # wait untl all Dialogs are closed; 10099 => WINDOW_DIALOG_POINTER => smallest dialog_id; max 500 msecs
            dialog_wait_counter = 0
            while dialog_wait_counter <= 100 and getCurrentWindowDialogId(
            ) >= 10099:
                xbmc_sleep(5)
                dialog_wait_counter += 1
            self.log_debug('waited {} msecs for all dialogs to be closed',
                           (dialog_wait_counter * 5))

            self.log_debug('FolderPath old pos {} ', old_postion)
            focus_id = Window(getCurrentWindowId()).getFocusId()
            set_postion = old_postion

            cmd = compat._format('Control.SetFocus({},{})', focus_id,
                                 set_postion)
            executebuiltin(cmd)
            self.log_debug('set current pos executebuiltin({})', cmd)

            # wait for the correct postion to be applied; max 500 msecs
            self.wait_for_infolabel('Container.CurrentItem',
                                    old_postion,
                                    cycles=100)
Пример #56
0
 def setEndOfDirectory(self):
     iHandler = cPluginHandler().getPluginHandle()
     xbmcplugin.setPluginCategory(iHandler, "")
     xbmcplugin.setContent(iHandler, cGui.CONTENT)
     xbmcplugin.addSortMethod(iHandler, xbmcplugin.SORT_METHOD_NONE)
     xbmcplugin.endOfDirectory(iHandler, True)
    def system(self, data, cl=False):
        util.debug("[SC] SYSYEM CL: %s" % str(cl))
        if cl is False and "setContent" in data:
            xbmcplugin.setContent(int(sys.argv[1]), data["setContent"])
            '''
            view_mode=data["setContent"].lower()
            skin_name=xbmc.getSkinDir() # nacitame meno skinu
            util.debug("[SC] skin_name='"+skin_name+"'")
            try:
                util.debug("[SC] view mode is "+view_mode)
                view_codes=sctop.ALL_VIEW_CODES.get(view_mode)
                view_code=view_codes.get(skin_name)
                util.debug("[SC] view code for "+view_mode+" in "+skin_name+" is "+str(view_code))
                xbmc.executebuiltin("Container.SetViewMode("+str(view_code)+")")
                #xbmc.executebuiltin("Container.Refresh")
            except:
                util.debug("[SC] Unable to find view code for view mode "+str(view_mode)+" and skin "+skin_name)
            '''

        if cl is False and "setPluginCategory" in data:
            xbmcplugin.setPluginCategory(int(sys.argv[1]),
                                         data["setPluginCategory"])

        if cl is False and "addSortMethod" in data:
            xbmcplugin.addSortMethod(
                int(sys.argv[1]), sctop.sortmethod[int(data["addSortMethod"])])

        if cl is False and data.get('addSortMethods'):
            for m in data.get("addSortMethods"):
                xbmcplugin.addSortMethod(int(sys.argv[1]),
                                         sctop.sortmethod[int(m)])

        if cl is False and "setPluginFanart" in data:
            xbmcplugin.setPluginFanart(int(sys.argv[1]),
                                       data["setPluginFanart"])

        if cl is False and "version" in data:
            util.info("[SC] kontrola verzie: %s %s" %
                      (str(sctop.addonInfo('version')), data["version"]))
            if sctop.addonInfo('version') != data[
                    "version"] and sctop.getSetting('ver') != data['version']:
                try:
                    sctop.dialog.ok(
                        sctop.getString(30954),
                        sctop.getString(30955) % str(data['version']))
                except:
                    pass
                xbmc.executebuiltin('UpdateAddonRepos')
                sctop.setSetting('ver', data['version'])
                sctop.setSetting('ws_checkssl', 'false')
                sctop.setSetting('check_ssl1', 'false')
                sctop.setSetting('usecache', 'true')
            if sctop.getSettingAsBool(
                    'cachemigrate'
            ) == '' or sctop.getSettingAsBool('cachemigrate') is False:
                self.parent.cacheMigrate()
                pass
            pass

        if cl is False and "focus" in data:
            self.parent.system = {"focus": data['focus']}

        if cl is True and "focus" in data:
            try:
                self.parent.endOfDirectory()
                util.debug("[SC] nastavujem focus na: %d" % int(data['focus']))
                xel = xbmcgui.Window(xbmcgui.getCurrentWindowId())
                ctr = xel.getControl(xel.getFocusId())
                ctr.selectItem(int(data['focus']))
            except Exception as e:
                util.debug("[SC] error focus :-( %s" %
                           str(traceback.format_exc()))
                pass
Пример #58
0
params = get_params()
list_url = None
list_speeds = 0

try:
    list_url = urllib.unquote_plus(params["list"])
except:
    pass
try:
    list_speeds = params["speeds"]
except:
    pass

if len(params) == 0:
    get_programs()
    xbmcplugin.setPluginCategory(handle, GUZEI_RADIO)
    xbmcplugin.endOfDirectory(handle)

elif list_url != None:
    list_genre = __language__(30001)
    try:
        list_genre = urllib.unquote_plus(params["genre"])
    except:
        pass
    get_list(list_url, list_genre)
    xbmcplugin.setPluginCategory(handle, GUZEI_RADIO + ' / ' + list_genre)
    xbmcplugin.endOfDirectory(handle)

elif list_speeds != None:
    rate = 0
    name = __language__(30002)
Пример #59
0
def finish_directory(handle, category, type):
    xbmcplugin.setPluginCategory(handle, category)
    xbmcplugin.setContent(handle, type)
    xbmcplugin.endOfDirectory(handle)
Пример #60
0
            playList.add(cur_url, listitem)
            i += 1


params = get_params()
mode = None

try:
    mode = urllib.unquote_plus(params["mode"])
except:
    pass

if mode == None:
    listitem = xbmcgui.ListItem('1. VESTI.Live!',
                                iconImage=vesti_thumb,
                                thumbnailImage=vesti_thumb)
    url = sys.argv[0] + "?mode=live"
    xbmcplugin.addDirectoryItem(handle, url, listitem, False)
    get_programs(False)

    xbmcplugin.setPluginCategory(handle, 'VESTI.RU')
    xbmcplugin.addSortMethod(handle, xbmcplugin.SORT_METHOD_DATE)
    xbmcplugin.endOfDirectory(handle)

elif mode == 'live':
    playList = xbmc.PlayList(xbmc.PLAYLIST_VIDEO)
    playList.clear()
    get_programs(True)
    player = xbmc.Player(xbmc.PLAYER_CORE_AUTO)
    player.play(playList)