Exemplo n.º 1
0
 def itemlistHook(itemlist):
     itemlist.insert(
         0,
         item.clone(title=support.typo('Tutti', 'bold'),
                    action='peliculas'))
     itemlist.append(
         item.clone(title=support.typo('Cerca...', 'bold'),
                    action='search',
                    search=True,
                    thumbnail=support.thumb('search.png')))
     return itemlist
Exemplo n.º 2
0
def genres(item):
    support.info()
    # support.dbg()
    itemlist = []

    genres = json.loads(support.match(response.text, patron='genres="([^"]+)').match.replace('"','"'))

    for genre in genres:
        item.args['genres'] = [genre]
        itemlist.append(item.clone(title=support.typo(genre['name'],'bold'), action='peliculas'))
    return support.thumb(itemlist)
Exemplo n.º 3
0
def submenu_year(item):
    itemlist = []
    from datetime import date
    current = date.today().year
    first = int(httptools.downloadpage('{}/api/anime/advanced-search?page=0&size=1&sort=startDate,asc&sort=id'.format(host)).json[0]['startDate'].split('-')[0]) -1
    for year in range(current, first, -1):
        itemlist.append(item.clone(title = support.typo(year, 'bold'),
                                action= 'submenu_season',
                                variable= year,
                                thumbnail=support.thumb('year')))
    return itemlist
Exemplo n.º 4
0
 def itemlistHook(itemlist):
     itemlist.pop(0)
     itemlist.append(
         support.Item(
             channel=item.channel,
             title=support.typo('Cerca...', 'bold color kod'),
             contentType='music',
             url=item.url,
             action='search',
             thumbnail=support.thumb(thumb='search.png')))
     return itemlist
Exemplo n.º 5
0
def search_movie_by_genre(item):
    support.info()
    itemlist = []
    data = support.match(item.url, headers=headers).data
    json_object = jsontools.load(data)
    for genre in json_object['hydra:member']:
        itemlist.append(
            item.clone(action="peliculas",
                       title=support.typo(genre['name'],'bold'),
                       contentType='movie',
                       url="%s/api/movies?genres.id=%s" %(host,genre['id'])))
    return support.thumb(itemlist, True)
Exemplo n.º 6
0
def peliculas(item):
    logger.debug()

    itemlist = []

    if item.text:
        data = session.get(
            f'{domain}/cms/routes/search/result?include=default&contentFilter[query]={item.text}'
        ).json()['included']
    else:
        data = session.get(
            f'{domain}/cms/collections/{item.id}?include=default').json(
            )['included']

    images = {
        key['id']: key['attributes']['src']
        for key in data if key['type'] == 'image'
    }

    for key in data:
        if key['type'] == 'show' and 'Free' in str(
                key.get('relationships', {}).get('contentPackages', {}).get(
                    'data', [])) and key['attributes']['episodeCount']:

            if item.filter and key['id'] not in item.filter:
                continue

            thumbId = key['relationships'].get('images', {}).get(
                'data', [{}, {}, {}])[2].get('id', '')
            fanartId = key['relationships'].get('images',
                                                {}).get('data',
                                                        [{}])[0].get('id', '')
            itemlist.append(
                item.clone(
                    title=typo(key['attributes']['name'], 'bold'),
                    plot=key['attributes'].get('description', ''),
                    programid=key['attributes']['alternateId'],
                    seasons=key['attributes']['seasonNumbers'],
                    action='seasons',
                    thumbnail=images[thumbId] if thumbId else item.thumbnail,
                    fanart=images[fanartId] if fanartId else item.fanart,
                    contentType='tvshow'))

    itemlist.sort(key=lambda it: it.title)

    if not itemlist:
        from core.item import Item
        itemlist = [
            Item(title='Nessun Contenuto Free Disponibile',
                 thumbnail=support.thumb('info'))
        ]

    return itemlist
Exemplo n.º 7
0
def peliculas(item):
    itemlist = []
    if not item.args:
        json_file = loadjs(item.url + 'channel/10005/last/')
        support.log(json_file)
        make_itemlist(itemlist, item, json_file)

    elif ('=' not in item.args) and ('=' not in item.url):
        json_file = loadjs(item.url + item.args)
        make_itemlist(itemlist, item, json_file)

    elif '=' in item.args:
        json_file = current_session.get(item.url + 'channels',
                                        headers=headers,
                                        params=payload).json()
        Filter = support.match(item.args, patron=r'\?([^=]+)=').match
        keys = [i[Filter] for i in json_file['data'] if Filter in i][0]
        for key in keys:
            if key not in ['1', '2']:
                itemlist.append(
                    Item(
                        channel=item.channel,
                        title=support.typo(
                            key.upper() if Filter == 'filter' else key['name'],
                            'bold'),
                        url=item.url + item.args +
                        (key if Filter == 'filter' else str(key['id'])),
                        action='peliculas',
                        args='filters',
                        contentType=item.contentType))

    else:
        json_file = loadjs(item.url)
        make_itemlist(itemlist, item, json_file)
    if 'category' in item.args:
        support.thumb(itemlist, genre=True)
    elif not 'filter' in item.args:
        if item.contentType != 'movie': autorenumber.renumber(itemlist)
        tmdb.set_infoLabels_itemlist(itemlist, seekTmdb=True)
    return itemlist
Exemplo n.º 8
0
def filter_thread(filter, key, item, description):
    thumbnail = plot = fanart = ''
    if item.filterkey in ['actors', 'director']:
        dict_ = {'url': 'search/person', 'language': lang, 'query': filter, 'page': 1}
        tmdb_inf = tmdb.discovery(item, dict_=dict_)
        id = None
        if tmdb_inf.results:
            results = tmdb_inf.results[0]
            id = results['id']
        if id:
            thumbnail = 'http://image.tmdb.org/t/p/original' + results['profile_path'] if results['profile_path'] else item.thumbnail
            json_file = httptools.downloadpage('http://api.themoviedb.org/3/person/'+ str(id) + '?api_key=' + tmdb_api + '&language=en', use_requests=True).data
            support.log(json_file)
            plot += jsontools.load(json_file)['biography']

    if description:
        if filter in description:
            extra = set_extra_values(item, description[filter], item.path)
            thumbnail = extra.thumb if extra.thumb else item.thumbnail
            fanart = extra.fanart if extra.fanart else item.fanart
            plot = extra.plot if extra.plot else item.plot


    item = Item(channel=item.channel,
                title=support.typo(filter, 'bold'),
                url=item.url,
                media_type=item.media_type,
                action='peliculas',
                thumbnail=thumbnail if thumbnail else item.thumbnail,
                fanart=fanart if fanart else item.fanart,
                plot=plot if plot else item.plot,
                path=item.path,
                filterkey=item.filterkey,
                filter=filter,
                key=key)

    if item.filterkey in ['genre']:
        support.thumb(item)

    return item
Exemplo n.º 9
0
 def itemlistHook(itemlist):
     if item.nextpage: item.nextpage += 1
     else: item.nextpage = 2
     if page and item.nextpage < int(page):
         itemlist.append(
             item.clone(title=support.typo(
                 support.config.get_localized_string(30992),
                 'color kod bold'),
                        url='{}&page={}'.format(
                            item.url, item.nextpage),
                        infoLabels={},
                        thumbnail=support.thumb()))
     return itemlist
Exemplo n.º 10
0
def search_movie_by_genre(item):
    support.log()
    itemlist = []
    data = httptools.downloadpage(item.url, headers=headers).data
    json_object = jsontools.load(data)
    for genre in json_object['hydra:member']:
        itemlist.append(
            Item(channel=item.channel,
                 action="peliculas",
                 title=support.typo(genre['name'], 'bold'),
                 contentType='movie',
                 url="%s/api/movies?genres.id=%s" % (host, genre['id']),
                 extra=item.extra))
    return support.thumb(itemlist, True)
Exemplo n.º 11
0
 def itemlistHook(itemlist):
     args = item.args
     args[0] += 1
     itemlist.append(
         support.Item(channel=item.channel,
                      action=item.action,
                      contentType=item.contentType,
                      title=support.typo(
                          support.config.get_localized_string(30992),
                          'color kod bold'),
                      url=item.url,
                      args=args,
                      thumbnail=support.thumb()))
     return itemlist
Exemplo n.º 12
0
def submenu_season(item):
    itemlist = []
    seasons = {'winter':'Inverno', 'spring':'Primavera', 'summer':'Estate', 'fall':'Autunno'}
    url= '{}/api/seasonal-view?page=0&size=36&years={}'.format(host, item.variable)
    js = httptools.downloadpage(url).json[0]['seasonalAnime']
    for season in js:
        s = season['season'].split('.')[-1]
        title = seasons[s]
        itemlist.append(item.clone(title=title,
                                url = '{}/api/seasonal-view/{}-{}'.format(host, s, item.variable),
                                thumbnail = support.thumb(s),
                                action = 'peliculas',
                                variable=''))
    return itemlist
Exemplo n.º 13
0
def live(item):
    itemlist = [
        item.clone(title=support.typo('La7', 'bold'),
                   fulltitle='La7',
                   url=host + '/dirette-tv',
                   action='play',
                   forcethumb=True),
        item.clone(title=support.typo('La7d', 'bold'),
                   fulltitle='La7d',
                   url=host + '/live-la7d',
                   action='play',
                   forcethumb=True)
    ]
    return support.thumb(itemlist, live=True)
Exemplo n.º 14
0
def live(item):
    logger.debug()
    itemlist = []
    for name, values in liveDict().items():
        itemlist.append(
            item.clone(title=typo(name, 'bold'),
                       fulltitle=name,
                       plot=values['plot'],
                       url=values['url'],
                       id=values['id'],
                       action='play',
                       forcethumb=True,
                       no_return=True))
    return support.thumb(itemlist, live=True)
Exemplo n.º 15
0
def replay_channels(item):
    itemlist = [
        item.clone(title=support.typo('La7', 'bold'),
                   fulltitle='La7',
                   url=host + '/rivedila7/0/la7',
                   action='replay_menu',
                   forcethumb=True),
        item.clone(title=support.typo('La7d', 'bold'),
                   fulltitle='La7d',
                   url=host + '/rivedila7/0/la7d',
                   action='replay_menu',
                   forcethumb=True)
    ]
    return support.thumb(itemlist, live=True)
Exemplo n.º 16
0
def genres_menu(item):
    itemlist = []
    mode = item.mode.replace('show', '')

    genres = tmdb.get_genres(mode)
    for key, value in list(genres[mode].items()):
        discovery = {
            'url': 'discover/%s' % mode,
            'with_genres': key,
            'language': def_lang,
            'page': '1'
        }

        itemlist.append(
            Item(channel=item.channel,
                 title=typo(value, 'bold'),
                 page=1,
                 action='discover_list',
                 discovery=discovery,
                 mode=item.mode))
    from core import support
    support.thumb(itemlist)
    return sorted(itemlist, key=lambda it: it.title)
Exemplo n.º 17
0
def peliculas(item):
    support.info()
    itemlist = []
    keys = []
    key_list = []

    # pagination options
    pag = item.page if item.page else 1
    pagination = 40 if not item.search else ''

    # load json
    if type(item.url) in [dict, list]:
        json = item.url
        for key in json:
            if item.search.lower() in key['name'].lower():
                keys.append(key)
    else:
        json = current_session.get(item.url).json()

        # load json for main menu item
        if not item.args:
            json_url = getUrl(json['contents'][-1]['contents'][-1]['path_id'])
            json = current_session.get(json_url).json()['contents']
        else:
            json = json['contents']
        for key in json:
            if len(json[key]) > 0:
                for key in json[key]:
                    keys.append(key)

    # load titles
    for i, key in enumerate(keys):
        if pagination and (pag - 1) * pagination > i: continue  # pagination
        if pagination and i >= pag * pagination: break
        key_list.append(key)

    with futures.ThreadPoolExecutor() as executor:
        itlist = [executor.submit(addinfo, key, item) for key in key_list]
        for res in futures.as_completed(itlist):
            if res.result():
                itemlist.append(res.result())
    itemlist = sorted(itemlist, key=lambda it: it.title)

    if len(keys) > pag * pagination and not item.search:
        itemlist.append(
            item.clone(title=support.typo(
                support.config.get_localized_string(30992), 'color kod bold'),
                       page=pag + 1,
                       thumbnail=support.thumb()))
    return itemlist
Exemplo n.º 18
0
def play(item):
    logger.debug()
    item.manifest = 'hls'
    mgid = support.match(item.url, patron=r'uri":"([^"]+)"').match
    url = 'https://media.mtvnservices.com/pmt/e1/access/index.html?uri=' + mgid + '&configtype=edge&ref=' + item.url
    ID, rootUrl = support.match(
        url,
        patron=[r'"id":"([^"]+)",',
                r'brightcove_mediagenRootURL":"([^"]+)"']).matches
    item.url = jsontools.load(
        support.match(rootUrl.replace('&device={device}', '').format(uri=ID)).
        data)['package']['video']['item'][0]['rendition'][0]['src']

    if item.livefilter:
        d = liveDict()[item.livefilter]
        item = item.clone(title=support.typo(item.livefilter, 'bold'),
                          fulltitle=item.livefilter,
                          url=d['url'],
                          plot=d['plot'],
                          action='play',
                          forcethumb=True,
                          no_return=True)
        support.thumb(item, live=True)
    return [item]
Exemplo n.º 19
0
def live(item):
    logger.debug()
    itemlist = []
    for key, value in liveDict().items():
        itemlist.append(
            item.clone(title=support.typo(key, 'bold'),
                       contentTitle=key,
                       fulltitle=key,
                       show=key,
                       url=value['url'],
                       plot=value['plot'],
                       action='play',
                       forcethumb=True,
                       no_return=True))
    return support.thumb(itemlist, live=True)
Exemplo n.º 20
0
def category(item):
    blacklist = [
        'Serie TV Altadefinizione', 'HD AltaDefinizione', 'Al Cinema',
        'Serie TV', 'Miniserie', 'Programmi Tv', 'Live', 'Trailers',
        'Serie TV Aggiornate', 'Aggiornamenti', 'Featured'
    ]
    itemlist = support.scrape(
        item,
        '<li><a href="([^"]+)"><span></span>([^<]+)</a></li>',
        ['url', 'title'],
        headers,
        blacklist,
        patron_block='<ul class="table-list">(.*?)</ul>',
        action='peliculas')
    return support.thumb(itemlist)
Exemplo n.º 21
0
def menu(item):
    support.info()
    itemlist = [
        item.clone(title=support.typo('Tutti', 'bullet bold'),
                   action='peliculas'),
        item.clone(title=support.typo('Generi', 'submenu'),
                   args='genre',
                   action='submenu'),
        item.clone(title=support.typo('A-Z', 'submenu'),
                   args='az',
                   action='submenu'),
        item.clone(title=support.typo('Cerca', 'submenu'), action='search')
    ]

    return support.thumb(itemlist)
Exemplo n.º 22
0
def submenu(item):
    support.info()
    itemlist = []
    json = current_session.get(item.url).json()['contents'][-1]['contents']
    if item.args == 'az':
        json_url = getUrl(json[-1]['path_id'])
        json = current_session.get(json_url).json()['contents']
        for key in json:
            itemlist.append(item.clone(title = support.typo(key,'bold'), fulltitle = key,
                                       show = key, url = json[key], action = 'peliculas'))
    else:
        for key in json:
            itemlist.append(item.clone(title = support.typo(key['name'],'bold'), fulltitle = key['name'], show = key['name'],
                                       thumbnail = getUrl(key['image']), url = getUrl(key['path_id']), action = 'peliculas'))
        itemlist.pop(-1)
    return support.thumb(itemlist)
Exemplo n.º 23
0
def categorie(item):
    log()
    itemlist = []
    matches = support.match(
        item, r'<option value="([^"]+)">',
        r'<select name="genere" id="genere" class="selectInput">(.*?)</select>'
    )[0]

    for value in matches:
        url = item.url + value
        itemlist.append(
            Item(channel=item.channel,
                 contentType=item.contentType,
                 action="peliculas",
                 title=support.typo(value, 'bold'),
                 url=url))
    return support.thumb(itemlist)
Exemplo n.º 24
0
def pagination(item, itemlist=[]):
    support.log()
    import json
    itlist = []

    if not itemlist:
        itemlist = []
        for it in item.itemlist:
            itemlist.append(Item().fromurl(it))
    encoded_itemlist = []
    for it in itemlist:
        encoded_itemlist.append(it.tourl())
    if inspect.stack()[1][3] not in [
            'add_tvshow', 'get_episodes', 'update', 'find_episodes', 'search'
    ]:
        Pagination = int(defp) if defp.isdigit() else ''
    else:
        Pagination = ''
    pag = item.page if item.page else 1

    for i, item in enumerate(itemlist):
        if Pagination and (pag - 1) * Pagination > i: continue  # pagination
        if Pagination and i >= pag * Pagination: break  # pagination

        itlist.append(item)

    if Pagination and len(itemlist) >= Pagination:
        if inspect.stack()[1][3] != 'get_newest':
            itlist.append(
                Item(channel=item.channel,
                     action='pagination',
                     contentType=item.contentType,
                     title=support.typo(config.get_localized_string(30992),
                                        'color kod bold'),
                     fulltitle=item.fulltitle,
                     show=item.show,
                     url=item.url,
                     args=item.args,
                     page=pag + 1,
                     path=item.path,
                     media_type=item.media_type,
                     thumbnail=support.thumb(),
                     itemlist=encoded_itemlist))
    return itlist
Exemplo n.º 25
0
def live(item):
    logger.debug()
    itemlist=[]
    urls=[]
    matches = support.match(host, patron=r'(/diretta-tv/[^"]+)"[^>]+>([^ ]+)').matches
    from datetime import date
    today = date.today()
    channels = jsontools.load(support.match(host + '/api/more/tvschedule/' + str(today.year) + str(today.month) + str(today.day)).data)['channels']
    ch_dict = {}
    for channel in channels:
        ch_dict[channel['label']] = channel['channelId']
    for url, title in matches:
        if url not in urls:
            urls.append(url)
            info = jsontools.load(support.match(host +'/api/on-air?channelId=' + ch_dict[title]).data)
            support.info(info)
            plot= '[B]' + info['seriesTitle'] +'[/B]\n' + info['description'] if 'seriesTitle' in info else ''
            itemlist.append(item.clone(title=support.typo(title,'bold'), contentTitle=title, fulltitle=title, show=title, url=host+url, plot=plot, action='play', forcethumb=True, no_return=True))
    return support.thumb(itemlist, live=True)
Exemplo n.º 26
0
def menu(item):
    findhost()
    itemlist = []
    data = httptools.downloadpage(item.url, headers=headers).data
    data = re.sub('\n|\t', '', data)
    block = scrapertoolsV2.find_single_match(
        data, item.args + r'<span.*?><\/span>.*?<ul.*?>(.*?)<\/ul>')
    support.log('MENU BLOCK= ', block)
    patron = r'href="?([^">]+)"?>(.*?)<\/a>'
    matches = re.compile(patron, re.DOTALL).findall(block)
    for scrapedurl, scrapedtitle in matches:
        itemlist.append(
            Item(channel=item.channel,
                 title=scrapedtitle,
                 contentType=item.contentType,
                 action='peliculas',
                 url=host + scrapedurl))

    return support.thumb(itemlist)
Exemplo n.º 27
0
def live(item):
    support.info()
    itemlist =[]
    info={}
    json = current_session.get(item.url).json()['dirette']
    onAir = current_session.get(onair).json()['on_air']
    support.info(onAir)
    for key in onAir:
        channel = key['channel']
        info[channel] = {}
        info[channel]['fanart'] = getUrl(key['currentItem']['image'])
        info[channel]['plot'] = support.typo(key['currentItem']['name'],'bold')+ '\n\n' + key['currentItem']['description']

    for i, key in enumerate(json):
        channel = key['channel']
        itemlist.append(item.clone(title = support.typo(channel, 'bold'), fulltitle = channel, show = channel, url = key['video']['contentUrl'],
                                   thumbnail = key['transparent-icon'].replace("[RESOLUTION]", "256x-"), forcethumb = True , fanart = info[channel]['fanart'],
                                   plot = info[channel]['plot'], action = 'play'))
    return support.thumb(itemlist, live=True)
Exemplo n.º 28
0
def live(item):
    logger.debug()

    itemlist = []
    data = session.get(
        f'{domain}/cms/routes/epg?include=default').json()['included']

    for key in data:

        if key['type'] == 'channel' and key.get('attributes', {}).get(
                'hasLiveStream', '') and 'Free' in key.get(
                    'attributes', {}).get('packages', []):
            itemlist.append(
                item.clone(
                    title=typo(key['attributes']['name'], 'bold'),
                    fulltitle=key['attributes']['name'],
                    plot=key['attributes'].get('description', ''),
                    url=f"{host}/canali/{key['attributes']['alternateId']}",
                    id=key['id'],
                    action='findvideos'))
    return support.thumb(itemlist, live=True)
Exemplo n.º 29
0
def mainlist(item):
    itemlist = []
    item.action = 'peliculas'
    js = httptools.downloadpage(api_url.format('brands')).json
    for it in js.get('features', []):
        itemlist.append(
            item.clone(url='{}/{}'.format(host, it.get('canonical_url', '')),
                       title=support.typo(it['name'], 'italic') +
                       support.typo(it.get('channels', ''), '_ [] color kod')))
    for it in js.get('brands', []):
        itemlist.append(
            item.clone(url='{}/{}'.format(host, it.get('canonical_url', '')),
                       title=support.typo(it['name'], 'bullet bold') +
                       support.typo(it.get('channels', ''), '_ [] color kod')))

    itemlist.append(
        item.clone(title=support.typo('Cerca...', 'bold color kod'),
                   action='search',
                   thumbnail=support.thumb('search')))
    support.channel_config(item, itemlist)
    return itemlist
Exemplo n.º 30
0
def episodios(item):
    logger.debug()

    itemlist = []
    data = session.get(
        f'{domain}/cms/collections/{item.id}?include=default&{item.seasonparams}&{item.showparams}'
    ).json()['included']
    images = {
        key['id']: key['attributes']['src']
        for key in data if key['type'] == 'image'
    }

    for key in data:
        if key['type'] == 'video' and 'Free' in str(
                key.get('relationships', {}).get('contentPackages', {}).get(
                    'data', [])):
            itemlist.append(
                item.clone(
                    title=
                    f"{item.season}x{key['attributes']['episodeNumber']:02d} - {key['attributes']['name']}",
                    plot=key['attributes']['description'],
                    episode=key['attributes']['episodeNumber'],
                    contentType='episode',
                    action='findvideos',
                    thumbnail=images[key['relationships']['images']['data'][0]
                                     ['id']],
                    id=key['id']))

    itemlist.sort(key=lambda it: it.episode)

    if not itemlist:
        from core.item import Item
        itemlist = [
            Item(title='Nessun Episodio Free Disponibile',
                 thumbnail=support.thumb('info'))
        ]

    return itemlist