Example #1
0
def entradas(item):
    logger.info("m3uchannel.entradas")

    itemlist = []

    # Si es una URL la descarga
    if item.url.startswith("http://") or item.url.startswith("https://"):
        data = scrapertools.cache_page(item.url)

    # Si es un fichero local, lo abre
    else:
        infile = open(item.url)
        data = infile.read()
        infile.close()

    # Parsea la lista
    category = item.title
    logger.info("m3uchannel.entradas category=" + category)
    entries = m3utools.parse_items_from_m3u_list(data, category)

    for entry in entries:
        itemlist.append(
            Item(channel=__channel__,
                 title=entry.title,
                 url=entry.url,
                 action="play",
                 folder=False))

    return itemlist
Example #2
0
def entradas(item,data=""):
    logger.info("simpletv.entradas")

    itemlist = []

    # Obtiene la lista de categorias a partir del m3u
    recursividad_permitida = False
    if data=="":
        recursividad_permitida = True
        data = get_online_list()

        # Parsea la lista
        category = item.title
        logger.info("simpletv.entradas category="+category)
        entries = m3utools.parse_items_from_m3u_list(data,category)

    # Si ha encontrado canales, graba el fichero actualizado por si en el futuro falla
    if len(entries)>0:
        f = open(LOCAL_FILE,"w")
        f.write(data)
        f.flush()
        f.close()

    # Si no ha encontrado canales, lee el fichero grabado la última vez y carga de nuevo la lista
    elif recursividad_permitida:
        infile = open(LOCAL_FILE,"r")
        data = infile.read()
        infile.close()
        itemlist = entradas(item,data)

    for entry in entries:
        itemlist.append( Item(channel=__channel__, title=entry.title, url=entry.url, action="play", folder=False) )

    return itemlist
Example #3
0
def entradas(item, data=""):
    logger.info("simpletv.entradas")

    itemlist = []

    # Obtiene la lista de categorias a partir del m3u
    recursividad_permitida = False
    if data == "":
        recursividad_permitida = True
        data = get_online_list()

        # Parsea la lista
        category = item.title
        logger.info("simpletv.entradas category=" + category)
        entries = m3utools.parse_items_from_m3u_list(data, category)

    # Si ha encontrado canales, graba el fichero actualizado por si en el futuro falla
    if len(entries) > 0:
        f = open(LOCAL_FILE, "w")
        f.write(data)
        f.flush()
        f.close()

    # Si no ha encontrado canales, lee el fichero grabado la última vez y carga de nuevo la lista
    elif recursividad_permitida:
        infile = open(LOCAL_FILE, "r")
        data = infile.read()
        infile.close()
        itemlist = entradas(item, data)

    for entry in entries:
        itemlist.append(
            Item(channel=__channel__,
                 title=entry.title,
                 url=entry.url,
                 action="play",
                 folder=False))

    return itemlist
Example #4
0
def entradas(item):
    logger.info("m3uchannel.entradas")

    itemlist = []

    # Si es una URL la descarga
    if item.url.startswith("http://") or item.url.startswith("https://"):
        data = scrapertools.cache_page(item.url)

    # Si es un fichero local, lo abre
    else:
        infile = open( item.url )
        data = infile.read()
        infile.close()

    # Parsea la lista
    category = item.title
    logger.info("m3uchannel.entradas category="+category)
    entries = m3utools.parse_items_from_m3u_list(data,category)

    for entry in entries:
        itemlist.append( Item(channel=__channel__, title=entry.title, url=entry.url, action="play", folder=False) )

    return itemlist