Merge branch 'stable' of github.com:kodiondemand/addon into stable

This commit is contained in:
marco
2020-04-02 21:47:08 +02:00
6 changed files with 145 additions and 81 deletions
+22 -24
View File
@@ -33,10 +33,10 @@ list_quality = ['1080p', '720p', '360p']
@support.menu @support.menu
def mainlist(item): def mainlist(item):
support.log()
film = ['', film = ['',
('Novità', ['/nuove-uscite/', 'peliculas', 'news']), ('Novità', ['/nuove-uscite/', 'peliculas', 'news']),
('Al Cinema', ['/al-cinema/', 'peliculas', 'cinema']), ('Al Cinema', ['/al-cinema/', 'peliculas', 'cinema']),
('A-Z',['/lista-film/', 'genres', 'az']),
('Generi', ['', 'genres', 'genres']), ('Generi', ['', 'genres', 'genres']),
('Anni', ['', 'genres', 'years']), ('Anni', ['', 'genres', 'years']),
('Qualità', ['', 'genres', 'quality']), ('Qualità', ['', 'genres', 'quality']),
@@ -47,41 +47,35 @@ def mainlist(item):
@support.scrape @support.scrape
def peliculas(item): def peliculas(item):
support.log() patron = r'<div class="wrapperImage">[ ]?(?:<span class="hd">(?P<quality>[^<>]+))?.+?href="(?P<url>[^"]+)".+?src="(?P<thumb>[^"]+)".+?<h2 class="titleFilm">[^>]+>'\
r'(?P<title>.+?)[ ]?(?:|\[(?P<lang>[^\]]+)\])?(?:\((?P<year>\d{4})\))?</a>.*?(?:IMDB\:</strong>[ ](?P<rating>.+?)<|</h2> )'
patronBlock = r'h1>(?P<block>.*?)<div class="row ismobile">'
patron = r'<div class="wrapperImage">[ ]?(?:<span class="hd">(?P<quality>[^<>]+))?.+?'\ if item.args == 'az':
'href="(?P<url>[^"]+)".+?src="(?P<thumb>[^"]+)".+?<h2 class="titleFilm">[^>]+>'\ patron = r'<img style="[^"]+" src="(?P<thumb>[^"]+)"[^>]+>[^>]+>[^>]+>[^>]+>[^>]+><a href="(?P<url>[^"]+)" [^>]+>(?P<title>[^<\[]+)(?:\[(?P<lang>[^\]]+)\]\s*)?<'\
'(?P<title>.+?)[ ]?(?:|\[(?P<lang>[^\]]+)\])?(?:\((?P<year>\d{4})\))?</a>.*?'\ r'[^>]+>[^>]+>[^>]+>[^>]+>\s*(?P<year>\d{4})[^>]+>[^>]+>\s*(?P<quality>[^<]+).*?<span class="label">(?P<ratting>[^<]+)<'
'(?:IMDB\:</strong>[ ](?P<rating>.+?)<|</h2> )' patronBlock =''
patronBlock = r'<h1 class="titleSection titleLastIns">.+?</h1>(?P<block>.*?)<div class="row ismobile">'
if item.args == 'genres': elif item.args == 'genres':
patron = r'<div class="wrapperImage">[ ]?(?:<span class="hd">'\ patron = r'<div class="wrapperImage">[ ]?(?:<span class="hd">(?P<quality>[^<>]+))?.+?href="(?P<url>[^"]+)".+?src="(?P<thumb>[^"]+)"'\
'(?P<quality>[^<>]+))?.+?href="(?P<url>[^"]+)".+?src="(?P<thumb>[^"]+)"'\ r'.+?<h2 class="titleFilm(?:Mobile)?">[^>]+>(?P<title>.+?)[ ]?(?:|\[(?P<lang>[^\]]+)\])?(?:\((?P<year>\d{4})\))?</a>.*?(IMDB\:[ ](?P<rating>.+?))<'
'.+?<h2 class="titleFilm(?:Mobile)?">[^>]+>(?P<title>.+?)[ ]?'\
'(?:|\[(?P<lang>[^\]]+)\])?(?:\((?P<year>\d{4})\))?</a>.*?'\
'(IMDB\:[ ](?P<rating>.+?))<'
elif item.args == 'search': elif item.args == 'search':
patronBlock = r'<section id="lastUpdate">(?P<block>.*?)<div class="row ismobile">' patronBlock = r'<section id="lastUpdate">(?P<block>.*?)<div class="row ismobile">'
patron = r'<a href="(?P<url>[^"]+)">\s*<div class="wrapperImage">(?:<span class="hd">(?P<quality>[^<]+)'\ patron = r'<a href="(?P<url>[^"]+)">\s*<div class="wrapperImage">(?:<span class="hd">(?P<quality>[^<]+)<\/span>)?<img[^s]+src="(?P<thumb>[^"]+)"'\
'<\/span>)?<img[^s]+src="(?P<thumb>[^"]+)"[^>]+>[^>]+>[^>]+>(?P<title>[^<]+)<[^<]+>'\ r'[^>]+>[^>]+>[^>]+>(?P<title>[^<]+)<[^<]+>(?:.*?IMDB:\s(\2[^<]+)<\/div>)?'
'(?:.*?IMDB:\s(\2[^<]+)<\/div>)?'
elif not item.args: if not item.args:
patronBlock = r'ULTIMI INSERITI(?P<block>.*?)<div class="sliderLastUpdate ismobile ">' patronBlock = r'ULTIMI INSERITI(?P<block>.*?)<div class="sliderLastUpdate ismobile ">'
# nella pagina "CERCA", la voce "SUCCESSIVO" apre la maschera di inserimento dati # nella pagina "CERCA", la voce "SUCCESSIVO" apre la maschera di inserimento dati
patronNext = r'<a class="next page-numbers" href="([^"]+)">' patronNext = r'<a class="next page-numbers" href="([^"]+)">'
#debug = True
return locals() return locals()
@support.scrape @support.scrape
def genres(item): def genres(item):
support.log('genres', item)
#debug = True
action = 'peliculas' action = 'peliculas'
patron = r'<li><a href="(?P<url>[^"]+)">(?P<title>[^<]+)<' patronMenu = r'<li><a href="(?P<url>[^"]+)">(?P<title>[^<]+)<'
if item.args == 'genres': if item.args == 'genres':
patronBlock = r'<ul class="listSubCat" id="Film">(?P<block>.*)<ul class="listSubCat" id="Anno">' patronBlock = r'<ul class="listSubCat" id="Film">(?P<block>.*)<ul class="listSubCat" id="Anno">'
@@ -93,8 +87,12 @@ def genres(item):
patronBlock = r'<h3 class="titleSidebox dado">FILM RANDOM</h3>(?P<block>.*)</section>' patronBlock = r'<h3 class="titleSidebox dado">FILM RANDOM</h3>(?P<block>.*)</section>'
patron = r'<li><a href="(?P<url>[^"]+)">(?P<title>[^<[]+)(?:\[(?P<lang>.+?)\])?<' patron = r'<li><a href="(?P<url>[^"]+)">(?P<title>[^<[]+)(?:\[(?P<lang>.+?)\])?<'
action = 'findvideos' action = 'findvideos'
elif item.args == 'az':
item.args = 'genres' blacklist = ['FILM 4K IN STREAMING']
patron = r'<a title="(?P<title>[^"]+)" href="(?P<url>[^"]+)"'
item.args = 'az'
if not item.args == 'az':
item.args = 'genres'
return locals() return locals()
+90 -36
View File
@@ -26,6 +26,8 @@ def mainlist(item):
('Documentari {bullet bold}', ['/documentari/index.json', 'menu']), ('Documentari {bullet bold}', ['/documentari/index.json', 'menu']),
('Programmi TV{bullet bold}', ['/programmi/index.json', 'menu']), ('Programmi TV{bullet bold}', ['/programmi/index.json', 'menu']),
('Programmi per Bambini {bullet bold}', ['/bambini/index.json', 'menu']), ('Programmi per Bambini {bullet bold}', ['/bambini/index.json', 'menu']),
('Teen {bullet bold}', ['/teen/index.json', 'learning']),
('Learning {bullet bold}', ['/learning/index.json', 'learning']),
('Teche Rai {bullet bold storia}', ['/techerai/index.json', 'menu']), ('Teche Rai {bullet bold storia}', ['/techerai/index.json', 'menu']),
('Musica e Teatro {bullet bold}', ['/performing-arts/index.json', 'menu']) ('Musica e Teatro {bullet bold}', ['/performing-arts/index.json', 'menu'])
] ]
@@ -44,11 +46,24 @@ def menu(item):
url = item.url, args = 'genre', action = 'submenu'), url = item.url, args = 'genre', action = 'submenu'),
support.Item(channel= item.channel, title = support.typo('A-Z','submenu'), support.Item(channel= item.channel, title = support.typo('A-Z','submenu'),
url = item.url, args = 'az', action = 'submenu')] url = item.url, args = 'az', action = 'submenu'),
support.Item(channel= item.channel, title = support.typo('Cerca','submenu'),
url = item.url, action = 'search')]
return support.thumb(itemlist) return support.thumb(itemlist)
def learning(item):
support.log()
itemlist =[]
json = current_session.get(item.url).json()['contents']
for key in json:
support.log(key['name'])
itemlist.append(support.Item(channel = item.channel, title = support.typo(key['name'],'bold'), fulltitle = key['name'], show = key['name'],
url = key['contents'], thumbnail = item.thumbnail, action = 'peliculas', args = item.args))
return itemlist
def submenu(item): def submenu(item):
support.log() support.log()
itemlist = [] itemlist = []
@@ -113,13 +128,17 @@ def search(item, text):
support.log() support.log()
itemlist =[] itemlist =[]
try: try:
json = current_session.get(host + '/dl/RaiTV/RaiPlayMobile/Prod/Config/programmiAZ-elenco.json').json() if item.url:
for key in json: item.search = text
for key in json[key]: itemlist = peliculas(item)
if 'PathID' in key and (text.lower() in key['name'].lower()): else:
itemlist.append(support.Item(channel = item.channel, title = support.typo(key['name'],'bold'), fulltitle = key['name'], show = key['name'], url = key['PathID'].replace('/?json', '.json'), action = 'Type', json = current_session.get(host + '/dl/RaiTV/RaiPlayMobile/Prod/Config/programmiAZ-elenco.json').json()
thumbnail = getUrl(key['images']['portrait'] if 'portrait' in key['images'] else key['images']['portrait43'] if 'portrait43' in key['images'] else key['images']['landscape']), for key in json:
fanart = getUrl(key['images']['landscape'] if 'landscape' in key['images'] else key['images']['landscape43']))) for key in json[key]:
if 'PathID' in key and (text.lower() in key['name'].lower()):
itemlist.append(support.Item(channel = item.channel, title = support.typo(key['name'],'bold'), fulltitle = key['name'], show = key['name'], url = key['PathID'].replace('/?json', '.json'), action = 'Type',
thumbnail = getUrl(key['images']['portrait'] if 'portrait' in key['images'] else key['images']['portrait43'] if 'portrait43' in key['images'] else key['images']['landscape']),
fanart = getUrl(key['images']['landscape'] if 'landscape' in key['images'] else key['images']['landscape43'])))
except: except:
import sys import sys
for line in sys.exc_info(): for line in sys.exc_info():
@@ -152,17 +171,17 @@ def dirette(item):
def peliculas(item): def peliculas(item):
support.log() support.log(item.url)
itemlist = [] itemlist = []
keys = [] keys = []
key_list = [] key_list = []
# pagination options # pagination options
pag = item.page if item.page else 1 pag = item.page if item.page else 1
pagination = 40 pagination = 40 if not item.search else ''
# load json # load json
if item.args == 'az': if type(item.url) in [dict, list]:
json = item.url json = item.url
for key in json: for key in json:
if item.search.lower() in key['name'].lower(): if item.search.lower() in key['name'].lower():
@@ -216,18 +235,47 @@ def select(item):
def episodios(item): def episodios(item):
support.log() support.log(len(item.url))
itemlist = [] itemlist = []
with futures.ThreadPoolExecutor() as executor: if type(item.url) in [list, dict] and len(item.url) > 1 and ('name' in item.url[0] and 'stagione' not in item.url[0]['name'].lower()):
itlist = [executor.submit(load_episodes, key, item) for key in item.url] for key in item.url:
for res in futures.as_completed(itlist): itemlist.append(support.Item(channel = item.channel, title = support.typo(key['name'], 'bold'), fulltitle = item.fulltitle, show = item.show, thumbnail = item.thumbnail,
if res.result(): fanart = item.fanart, url = getUrl(key['path_id']), plot = item.plot, contentType = 'tvshow',
itemlist += res.result() action = 'episodios'))
if itemlist and itemlist[0].VL:
itemlist.reverse() elif type(item.url) in [list, dict]:
support.videolibrary(itemlist, item) with futures.ThreadPoolExecutor() as executor:
itlist = [executor.submit(load_episodes, key, item) for key in item.url]
for res in futures.as_completed(itlist):
if res.result():
itemlist += res.result()
if itemlist and itemlist[0].VL:
# itemlist.reverse()
itemlist = sorted(itemlist, key=lambda it: it.order)
support.videolibrary(itemlist, item)
else:
itemlist = sorted(itemlist, key=lambda it: it.title)
else: else:
itemlist = sorted(itemlist, key=lambda it: it.title) if type(item.url) in [list, dict]: item.url = getUrl(item.url[0]['path_id'])
json = current_session.get(item.url).json()['items']
for key in json:
ep = support.match(key['subtitle'], patron=r'(?:St\s*(\d+))?\s*Ep\s*(\d+)').match
if ep:
season = '1' if not ep[0] else ep[0]
episode = ep[1].zfill(2)
title = support.re.sub(r'(?:St\s*\d+)?\s*Ep\s*\d+','',key['subtitle'])
title = season + 'x' + episode + (' - ' + title if not title.startswith(' ') else title if title else '')
else:
title = key['subtitle'].strip()
# title = key['subtitle'].strip()
if not title:
title = key['name']
itemlist.append(support.Item(channel = item.channel, title = support.typo(title, 'bold'), fulltitle = item.fulltitle, show = item.show, thumbnail = item.thumbnail,
fanart = getUrl(key['images']['landscape']), url = key['video_url'], plot = key['description'], contentType = 'episode',
action = 'findvideos', VL=True if ep else False))
if itemlist and itemlist[0].VL: support.videolibrary(itemlist, item)
return itemlist return itemlist
@@ -274,34 +322,40 @@ def getUrl(pathId):
def addinfo(key, item): def addinfo(key, item):
support.log() support.log()
info = current_session.get(getUrl(key['info_url'])).json() info = current_session.get(getUrl(key['info_url'])).json()
it = support.Item( channel = item.channel, title = support.typo(key['name'],'bold'), fulltitle = key['name'], show = key['name'], if not item.search or item.search.lower() in key['name'].lower():
thumbnail = getUrl(key['images']['portrait_logo']), fanart = getUrl(key['images']['landscape']), url = getUrl(key['path_id']), plot = info['description']) it = support.Item( channel = item.channel, title = support.typo(key['name'],'bold'), fulltitle = key['name'], show = key['name'],
if key['layout'] == 'single': thumbnail = getUrl(key['images']['portrait_logo'] if key['images']['portrait_logo'] else key['images']['landscape']), fanart = getUrl(key['images']['landscape']), url = getUrl(key['path_id']), plot = info['description'])
it.action = 'findvideos' if 'layout' not in key or key['layout'] == 'single':
it.contentType = 'movie' it.action = 'findvideos'
it.contentTitle = it.fulltitle it.contentType = 'movie'
else: it.contentTitle = it.fulltitle
it.action = 'select' else:
it.contentType = 'tvshow' it.action = 'select'
it.contentSerieName = it.fulltitle it.contentType = 'tvshow'
return it it.contentSerieName = it.fulltitle
return it
def load_episodes(key, item): def load_episodes(key, item):
support.log() support.log()
itemlist=[] itemlist = []
json = current_session.get(getUrl(key['path_id'])).json()['items'] json = current_session.get(getUrl(key['path_id'])).json()['items']
order = 0
for key in json: for key in json:
ep = support.match(key['subtitle'], patron=r'St\s*(\d+)\s*Ep\s*(\d+)').match ep = support.match(key['subtitle'], patron=r'(?:St\s*(\d+))?\s*Ep\s*(\d+)').match
if ep: if ep:
title = ep[0] + 'x' + ep[1].zfill(2) + support.re.sub(r'St\s*\d+\s*Ep\s*\d+','',key['subtitle']) season = '1' if not ep[0] else ep[0]
episode = ep[1].zfill(2)
title = season + 'x' + episode + support.re.sub(r'(?:St\s*\d+)?\s*Ep\s*\d+','',key['subtitle'])
order = int(season + episode)
else: else:
title = key['subtitle'].strip() title = key['subtitle'].strip()
if not title: if not title:
title = key['name'] title = key['name']
itemlist.append(support.Item(channel = item.channel, title = support.typo(title, 'bold'), fulltitle = item.fulltitle, show = item.show, thumbnail = item.thumbnail, itemlist.append(support.Item(channel = item.channel, title = support.typo(title, 'bold'), fulltitle = item.fulltitle, show = item.show, thumbnail = item.thumbnail,
fanart = getUrl(key['images']['landscape']), url = key['video_url'], plot = key['description'], contentType = 'episode', fanart = getUrl(key['images']['landscape']), url = key['video_url'], plot = key['description'], contentType = 'episode',
action = 'findvideos', VL=True if ep else False)) action = 'findvideos', VL=True if ep else False, order=order))
return itemlist return itemlist
+2
View File
@@ -385,6 +385,8 @@ def thumb(item_or_itemlist=None, genre=False, thumb=''):
icon_dict = {'channels_movie':['film'], icon_dict = {'channels_movie':['film'],
'channels_tvshow':['serie','tv','episodi','episodio','fiction'], 'channels_tvshow':['serie','tv','episodi','episodio','fiction'],
'channels_documentary':['documentari','documentario', 'documentary'], 'channels_documentary':['documentari','documentario', 'documentary'],
'channels_teenager':['ragazzi','teenager', 'teen'],
'channels_learning':['learning'],
'channels_all':['tutti'], 'channels_all':['tutti'],
'news':['novità', "novita'", 'aggiornamenti', 'nuovi', 'nuove'], 'news':['novità', "novita'", 'aggiornamenti', 'nuovi', 'nuove'],
'now_playing':['cinema', 'in sala'], 'now_playing':['cinema', 'in sala'],
+14 -4
View File
@@ -54,14 +54,24 @@ def get_video_url(page_url, premium=False, user="", password="", video_password=
data = block if block else data data = block if block else data
# URL # URL
# logger.info(data) # logger.info(data)
matches = scrapertools.find_multiple_matches(data, '''src:\s*["']?(http.*?\.mp4)''') if vres:
# logger.info(str(matches)) matches = scrapertools.find_multiple_matches(data, '''src:\s*["']?(http.*?\.mp4)''')
else:
matches = scrapertools.find_multiple_matches(data, '''src:\s*["']?(http.*?\.mp4)(?:[^,]+,[^,]+,res:([^,]+))?''')
if matches:
if len(matches[0])==2:
i=0
for m in matches:
vres.append("%sx" % m[1])
matches[i]=m[0]
i+=1
_headers = urllib.urlencode(httptools.default_headers) _headers = urllib.urlencode(httptools.default_headers)
i = 0 i = 0
for media_url in matches: for media_url in matches:
# URL del vídeo # URL del vídeo
video_urls.append([vres[i] + " mp4 [Akvideo] ", media_url.replace('https://', 'http://') + '|' + _headers]) video_urls.append([vres[i] if i<len(vres) else "" + " mp4 [Akvideo] ", media_url.replace('https://', 'http://') + '|' + _headers])
i = i + 1 i = i + 1
return sorted(video_urls, key=lambda x: int(x[0].split('x')[0])) return sorted(video_urls, key=lambda x: int(x[0].split('x')[0])) if vres else video_urls
+2 -2
View File
@@ -283,7 +283,7 @@ def episodios(item, json ='', key='', itemlist =[]):
ep = 1 ep = 1
season = infoLabels['season'] if 'season' in infoLabels else item.contentSeason if item.contentSeason else 1 season = infoLabels['season'] if 'season' in infoLabels else item.contentSeason if item.contentSeason else 1
if inspect.stack()[1][3] not in ['add_tvshow', 'get_episodes', 'update', 'find_episodes', 'search']: if inspect.stack()[1][3] not in ['add_tvshow', 'get_episodes', 'update', 'find_episodes', 'search'] and not show_seasons:
Pagination = int(defp) if defp.isdigit() else '' Pagination = int(defp) if defp.isdigit() else ''
else: Pagination = '' else: Pagination = ''
pag = item.page if item.page else 1 pag = item.page if item.page else 1
@@ -314,7 +314,7 @@ def episodios(item, json ='', key='', itemlist =[]):
title = ' - ' + option['title'] if 'title' in option else '' title = ' - ' + option['title'] if 'title' in option else ''
title = '%sx%s%s' % (season_number, episode_number, title) title = '%sx%s%s' % (season_number, episode_number, title)
extra = set_extra_values(item, option, item.path) extra = set_extra_values(item, option, item.path)
if season_number == item.filterseason or not item.filterseason: if not item.filterseason or season_number == int(item.filterseason):
itemlist.append(Item(channel = item.channel, itemlist.append(Item(channel = item.channel,
title = set_title(title, extra.language, extra.quality), title = set_title(title, extra.language, extra.quality),
fulltitle = item.fulltitle, fulltitle = item.fulltitle,
+15 -15
View File
@@ -1,40 +1,40 @@
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
from core import httptools
from core import servertools from core import servertools
from core.support import match, log
from core.item import Item from core.item import Item
from platformcode import config, logger from platformcode import config, logger
def mainlist(item): def mainlist(item):
logger.info() log()
itemlist = [] itemlist = []
itemlist.append(Item(channel=item.channel, action="search", title=config.get_localized_string(60089))) itemlist.append(Item(channel=item.channel, action="search", title=config.get_localized_string(60089), thumbnail=item.thumbnail, args='server'))
itemlist.append(Item(channel=item.channel, action="search", title=config.get_localized_string(60090))) itemlist.append(Item(channel=item.channel, action="search", title=config.get_localized_string(60090), thumbnail=item.thumbnail, args='direct'))
itemlist.append(Item(channel=item.channel, action="search", title=config.get_localized_string(60091))) itemlist.append(Item(channel=item.channel, action="search", title=config.get_localized_string(60091), thumbnail=item.thumbnail))
return itemlist return itemlist
# Al llamarse "search" la función, el launcher pide un texto a buscar y lo añade como parámetro # Al llamarse "search" la función, el launcher pide un text a buscar y lo añade como parámetro
def search(item, texto): def search(item, text):
logger.info("texto=" + texto) log(text)
if not texto.startswith("http"): if not text.startswith("http"):
texto = "http://" + texto text = "http://" + text
itemlist = [] itemlist = []
if "servidor" in item.title: if "server" in item.args:
itemlist = servertools.find_video_items(data=texto) itemlist = servertools.find_video_items(data=text)
for item in itemlist: for item in itemlist:
item.channel = "url" item.channel = "url"
item.action = "play" item.action = "play"
elif "directo" in item.title: elif "direct" in item.args:
itemlist.append(Item(channel=item.channel, action="play", url=texto, server="directo", title=config.get_localized_string(60092))) itemlist.append(Item(channel=item.channel, action="play", url=text, server="directo", title=config.get_localized_string(60092)))
else: else:
data = httptools.downloadpage(texto).data data = match(text).data
itemlist = servertools.find_video_items(data=data) itemlist = servertools.find_video_items(data=data)
for item in itemlist: for item in itemlist:
item.channel = "url" item.channel = "url"