Página 2 de 2

Re: biblioteca Pelisalacarta UI

Publicado: 17 Sep 2015, 08:46
por robalo
El item se debe insertar en la función que muestra todos los episodios y el nombre de la función debe ser 'episodios'.

Un item normal sería así:

Código: Seleccionar todo

    if config.get_library_support() and len(itemlist)>0:
        itemlist.append( Item( channel=item.channel, title="Añadir esta serie a la biblioteca de XBMC", url=url_episodio, action="add_serie_to_library", extra="episodios", show=item.show ) )
extra = action. Nomalmente es "episodios". Para otros casos especiales, estudiar el funcionamiento en el código añadido en el archivo 'navigation.py'
show = title. Título de la serie sin formatear.

Re: biblioteca Pelisalacarta UI

Publicado: 17 Sep 2015, 09:10
por fenice82
thanks for sharing your knowledge, robalo.

now, I don't understand why in spanish channel everithings works well and in the one attached there is a little problem.

channel code (made by robalo?)

Código: Seleccionar todo

# -*- coding: utf-8 -*-
#------------------------------------------------------------
# pelisalacarta- XBMC Plugin
# Canal para seriehd - based on guardaserie channel
# http://blog.tvalacarta.info/plugin-xbmc/pelisalacarta.
#------------------------------------------------------------
import urlparse,urllib2,urllib,re
import os, sys

from core import logger
from core import config
from core import scrapertools
from core.item import Item
from servers import servertools

__channel__ = "seriehd"
__category__ = "S"
__type__ = "generic"
__title__ = "Serie HD"
__language__ = "IT"

headers = [
    ['Host','www.seriehd.org'],
    ['User-Agent','Mozilla/5.0 (Windows NT 6.1; WOW64; rv:39.0) Gecko/20100101 Firefox/39.0'],
    ['Accept-Encoding','gzip, deflate']
]

host = "http://www.seriehd.org"

def isGeneric():
    return True

def mainlist( item ):
    logger.info( "[seriehd.py] mainlist" )

    itemlist = []

    itemlist.append( Item( channel=__channel__, action="fichas", title="[COLOR azure]Serie TV[/COLOR]", url=host+"/serie-tv-streaming/", thumbnail="http://i.imgur.com/rO0ggX2.png" ) )
    itemlist.append( Item( channel=__channel__, action="sottomenu", title="[COLOR orange]Sottomenu...[/COLOR]", url=host, thumbnail="http://i37.photobucket.com/albums/e88/xzener/NewIcons.png" ) )
    itemlist.append( Item( channel=__channel__, action="search", title="[COLOR green]Cerca...[/COLOR]", thumbnail="http://dc467.4shared.com/img/fEbJqOum/s7/13feaf0c8c0/Search") )


    return itemlist

def search( item,texto ):
    logger.info( "[seriehd.py] search" )

    item.url=host + "/?s=" + texto

    try:
        return fichas( item )

    ## Se captura la excepción, para no interrumpir al buscador global si un canal falla.
    except:
        import sys
        for line in sys.exc_info():
            logger.error( "%s" % line )
        return []

def sottomenu( item ):
    logger.info( "[seriehd.py] sottomenu" )
    itemlist = []

    data = scrapertools.cache_page( item.url )

    scrapertools.get_match( data, '<ul class="sub-menu">(.*?)</ul>' )

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

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

    for scrapedurl, scrapedtitle in matches:

        itemlist.append( Item( channel=__channel__, action="fichas", title=scrapedtitle, url=scrapedurl ) )

    ## Elimina 'Serie TV' de la lista de 'sottomenu'
    itemlist.pop(0)

    return itemlist

def fichas( item ):
    logger.info( "[seriehd.py] fichas" )
    itemlist = []

    data = scrapertools.cache_page( item.url )

    patron  = '<h2>(.*?)</h2>\s*'
    patron += '<img src="(.*?)" alt=".*?"/>\s*'
    patron += '<A HREF="(.*?)">'

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

    for scrapedtitle, scrapedthumbnail, scrapedurl in matches:

        itemlist.append( Item( channel=__channel__, action="episodios", title=scrapedtitle, fulltitle=scrapedtitle, url=scrapedurl, show=scrapedtitle, thumbnail=scrapedthumbnail ) )

    #<div class='wp-pagenavi'><span class='current'>1</span><a rel='nofollow' class='page larger' href='http://www.seriehd.org/serie-tv-streaming/page/2/'>2</a></div></div></div>
    next_page = scrapertools.find_single_match( data, "<span class='current'>\d+</span><a rel='nofollow' class='page larger' href='([^']+)'>\d+</a>" )
    if next_page != "":
        itemlist.append( Item( channel=__channel__, action="fichas", title="[COLOR orange]Successivo>>[/COLOR]", url=next_page ) )

    return itemlist

def episodios(item):
    logger.info( "[seriehd.py] episodios" )

    itemlist = []

    data = scrapertools.cache_page( item.url )

    seasons_data = scrapertools.get_match( data, '<select name="stagione" id="selSt">(.*?)</select>' )
    seasons = re.compile( 'data-stagione="(\d+)"', re.DOTALL ).findall( seasons_data )

    for scrapedseason in seasons:

        episodes_data = scrapertools.get_match( data, '<div class="list[^"]+" data-stagione="' + scrapedseason + '">(.*?)</div>' )
        episodes = re.compile( 'data-id="(\d+)"', re.DOTALL ).findall( episodes_data )

        for scrapedepisode in episodes:

            season = str ( int( scrapedseason ) + 1 )
            episode = str ( int( scrapedepisode ) + 1 )
            if len( episode ) == 1: episode = "0" + episode

            title = season + "x" + episode + " - " + item.title

            ## Le pasamos a 'findvideos' la url con dos partes divididas por el caracter "?"
            ## [host+path]?[argumentos]?[Referer]
            url = item.url + "?st_num=" + scrapedseason + "&pt_num=" + scrapedepisode + "?" + item.url

            itemlist.append( Item( channel=__channel__, action="findvideos", title=title, url=url, fulltitle=item.title, show=item.title ) )

    if config.get_library_support() and len(itemlist)>0:
        itemlist.append( Item(channel=__channel__, title="Añadir esta serie a la biblioteca de XBMC", url=item.url, action="add_serie_to_library", extra="episodios", show=item.show) )
-			
    return itemlist

def findvideos( item ):
    logger.info( "[seriehd.py] findvideos" )

    itemlist = []

    url = item.url.split( '?' )[0]
    post = item.url.split( '?' )[1]
    referer = item.url.split( '?' )[2]

    headers.append( [ 'Referer', referer ] )

    data = scrapertools.cache_page( url, post=post, headers=headers )

    url = scrapertools.get_match( data, '<iframe id="iframeVid" width="100%" height="500px" src="([^"]+)" allowfullscreen></iframe>' )

    server = url.split( '/' )[2]

    title = "[" + server + "] " + item.title

    itemlist.append( Item( channel=__channel__, action="play", title=title, url=url, fulltitle=item.fulltitle, show=item.show, folder=False ) )

    return itemlist

def play( item ):
    logger.info( "[seriehd.py] play" )

    itemlist = servertools.find_video_items( data=item.url )

    for videoitem in itemlist:
        videoitem.title = item.show
        videoitem.fulltitle = item.fulltitle
        videoitem.thumbnail = item.thumbnail
        videoitem.channel = __channel__

    return itemlist
and in the series folder I've

Imagen

to have the right folder name I've to put in the channel file this string

Código: Seleccionar todo

    if config.get_library_support() and len(itemlist)>0:
        itemlist.append( Item(channel=__channel__, title=item.title, url=item.url, action="add_serie_to_library", extra="episodios", show=item.show) )

Re: biblioteca Pelisalacarta UI

Publicado: 17 Sep 2015, 22:58
por robalo
fenice82 escribió:thanks for sharing your knowledge, robalo.

now, I don't understand why in spanish channel everithings works well and in the one attached there is a little problem.

channel code (made by robalo?)
No recuerdo si ese canal está hecho enteremente por mí, creo que no. Colaborar es evidente que sí, al menos a mis ojos :)

Y sí, El error para la añadir correctamente la serie a la bibloteca de xbmc/kodi es pequeño :). Sólo hay que modificar 'show=item.title' por 'show=item.show' en el 'itemlist.append' de los episodios y 'show=item.title' por 'show=item.show' en la línea 'title = season + "x" + episode + " - " + item.title'.

Re: biblioteca Pelisalacarta UI

Publicado: 17 Sep 2015, 23:09
por robalo
Se me ha olvidado comentarte algo muy interesante y que funciona bastante bien para la versión 'ui' de manos de divadr https://github.com/divadres/pelisalacar ... e5f969dd9c creo que te va gustar, funciona mejor que lo que hicimos a demás de darle más funcionalidad.

@divadr: Por si lees este hilo, muchas gracias otra vez, está genial!!.

Re: biblioteca Pelisalacarta UI

Publicado: 19 Sep 2015, 21:31
por fenice82
robalo escribió:Se me ha olvidado comentarte algo muy interesante y que funciona bastante bien para la versión 'ui' de manos de divadr https://github.com/divadres/pelisalacar ... e5f969dd9c creo que te va gustar, funciona mejor que lo que hicimos a demás de darle más funcionalidad.

@divadr: Por si lees este hilo, muchas gracias otra vez, está genial!!.
thank you @robalo for your help and for the link to @divadr github repo.

@divadr thank you for your commit, very useful for mobile devices.

now just to complete the navigation.py I added the download function and it works good but Pelisalacarta-ui don't recognize the default download path (if you see in the configuration menu the third section is empty). I checked the config.py and seems ok. :?

Re: biblioteca Pelisalacarta UI

Publicado: 20 Sep 2015, 11:34
por robalo
fenice82 escribió:now just to complete the navigation.py I added the download function and it works good but Pelisalacarta-ui don't recognize the default download path (if you see in the configuration menu the third section is empty). I checked the config.py and seems ok. :?
Entiendo que se debe a alguna modificación que has hecho al personalizarlo.

Para la descarga de un sólo vídeo (película, episodio, ...) de un servidor concreto, no es necesario hacer modificaciones en navigation.py. Con esta opción no deberías tener problemas por lo que entiendo que se debe a alguna modificación que has hecho al personalizar los procedimientos del archivo 'lancher.py' que intervienen en la opción de descarga de todas las series.

Las únicas modificaciones que se deberían hacer para que funcione la opción 'download_all_episodes' en los dos procedimientos que se añaden a 'navigation.py' (procedimiento 'download_all_episodes' y procedimiento 'episodio_ya_descargado') son las líneas que escriben información en el archivo 'kodi.log' ('logger.info(...'->'plugintools.log(...'). Sólo modificando esas líneas debería de funcionar.

Re: biblioteca Pelisalacarta UI

Publicado: 20 Sep 2015, 12:38
por fenice82
yes... maybe I was not clear in my explanation.

as you can see in the image pelisalacarta-ui have some problem to set the default downloadpath and the other path and this give me problem when I try to download a serie.
Imagen

Re: biblioteca Pelisalacarta UI

Publicado: 20 Sep 2015, 20:36
por robalo
Ok :)

Añadir a 'default.py' o a 'navigation.py'

Código: Seleccionar todo

config.verify_directories_created()