コード例 #1
0
ファイル: comamosramen.py プロジェクト: lopezvg/addon
def findvideos(item):
    logger.info()
    itemlist = []

    if not item.urls:
        soup = get_source(item.url, soup=True)
        json = jsontools.load(soup.find('script', id='__NEXT_DATA__').text)
        seriesdata = json['props']['pageProps']['data']
        seasons = seriesdata['seasons']
        item.urls = seasons[0]['episodes'][0]['players']

    # Recorremos la lista de servidores
    for option in item.urls:
        server = server_list.get(option['name'].lower())
        # Si no hay server (server nuevo o inválido), continuamos
        if not server:
            continue
        url = '{}{}'.format(server_urls.get(server, ''), option['id'])
        serv_name = servertools.get_server_name(server)

        new_item = Item(action='play',
                        channel=item.channel,
                        infoLabels=item.infoLabels,
                        language=item.language,
                        server=server,
                        thumbnail=item.thumbnail,
                        title='{}: {} {}'.format(
                            config.get_localized_string(60335),
                            serv_name.title(),
                            unify.add_languages('', item.language)),
                        url=url)

        # Chequeos (asignar fanart, plot y formatear títulos)
        if item.fanart and not new_item.fanart:
            new_item.fanart = item.fanart
        if item.contentPlot and not new_item.contentPlot:
            new_item.contentPlot = item.contentPlot
        if not item.contentType == 'movie':
            unify.title_format(new_item)
        itemlist.append(new_item)

    # Si es peli y podemos, agregamos el elemento "Agregar a videoteca"
    if len(itemlist) > 0 and config.get_videolibrary_support(
    ) and item.contentType == 'movie' and not item.videolibrary:
        itemlist.append(
            Item(action="add_pelicula_to_library",
                 channel=item.channel,
                 contentType="movie",
                 contentTitle=item.contentTitle,
                 extra="findvideos",
                 infoLabels={'year': item.infoLabels.get('year')},
                 title="[COLOR yellow]{}[/COLOR]".format(
                     config.get_localized_string(60353)),
                 url=item.url,
                 videolibrary=True))
    return itemlist
コード例 #2
0
def findvideos(item):
    logger.info()
    itemlist = []
    if item.videolibrary:
        return seasons(item)
    servers = [
        opcion for opcion in ({key: val
                               for key, val in sub.items() if val}
                              for sub in item.urls) if opcion
    ]

    # Recorremos la lista de servidores
    for option in servers:
        server = server_list.get(option['opcion'].lower())
        # Si no hay server (server nuevo o inválido), continuamos
        if not server:
            continue
        url = '{}{}'.format(server_urls.get(server, ''), option['url'])
        serv_name = servertools.get_server_name(server)

        new_item = Item(action='play',
                        channel=item.channel,
                        infoLabels=item.infoLabels,
                        language=item.language,
                        server=server,
                        thumbnail=item.thumbnail,
                        title=unify.add_languages(
                            '{}: {}'.format(config.get_localized_string(60335),
                                            serv_name.title()), item.language),
                        url=url)

        # Chequeos (asignar fanart, plot y formatear títulos)
        if item.fanart and not new_item.fanart:
            new_item.fanart = item.fanart
        if item.contentPlot and not new_item.contentPlot:
            new_item.contentPlot = item.contentPlot
        if not item.contentType == 'movie':
            unify.title_format(new_item)
        itemlist.append(new_item)

    # Si es peli y podemos, agregamos el elemento "Agregar a videoteca"
    if len(itemlist) > 0 and config.get_videolibrary_support(
    ) and item.contentType == 'movie' and not item.videolibrary:
        itemlist.append(
            Item(action="add_pelicula_to_library",
                 channel=item.channel,
                 contentType="movie",
                 contentTitle=item.contentTitle,
                 extra="findvideos",
                 infoLabels={'year': item.infoLabels.get('year')},
                 title="[COLOR yellow]{}[/COLOR]".format(
                     config.get_localized_string(60353)),
                 url=item.url,
                 videolibrary=True))
    return itemlist
コード例 #3
0
ファイル: comamosramen.py プロジェクト: jswxjj/addon
def findvideos(item):
    logger.info()
    itemlist = []
    if item.videolibrary:
        return seasons(item)
    servers = item.urls
    for option in servers:
        url = ''
        server = server_list.get(option['opcion'].lower())
        url = '{}{}'.format(server_urls.get(server, ''), option['url'])
        if not server:
            continue
        serv_name = servertools.get_server_name(server)
        new_item = Item(
            action = 'play',
            channel = item.channel,
            infoLabels = item.infoLabels,
            language = item.language,
            server = server,
            thumbnail = item.thumbnail,
            title = unify.add_languages('{}: {}'.format(config.get_localized_string(60335), serv_name.title()), item.language),
            url = url
        )
        if hasattr(item, 'fanart'):
            new_item.fanart = item.fanart
        if item.contentPlot:
            new_item.contentPlot = item.contentPlot
        if not item.contentType == 'movie':
            unify.title_format(new_item)
        itemlist.append(new_item)
    if len(itemlist) > 0 and config.get_videolibrary_support() and item.contentType == 'movie' and not item.videolibrary:
        itemlist.append(
            Item(
                action = "add_pelicula_to_library",
                channel = item.channel,
                contentType = "movie",
                contentTitle = item.contentTitle,
                extra = "findvideos",
                infoLabels = {'year': item.infoLabels.get('year')},
                title = "[COLOR yellow]{}[/COLOR]".format(config.get_localized_string(60353)),
                url = item.url,
                videolibrary = True
            )
        )
    return itemlist