Merge remote-tracking branch 'origin/master'
This commit is contained in:
@@ -33,10 +33,10 @@ list_quality = ['1080p', '720p', '360p']
|
||||
|
||||
@support.menu
|
||||
def mainlist(item):
|
||||
support.log()
|
||||
film = ['',
|
||||
('Novità', ['/nuove-uscite/', 'peliculas', 'news']),
|
||||
('Al Cinema', ['/al-cinema/', 'peliculas', 'cinema']),
|
||||
('A-Z',['/lista-film/', 'genres', 'az']),
|
||||
('Generi', ['', 'genres', 'genres']),
|
||||
('Anni', ['', 'genres', 'years']),
|
||||
('Qualità', ['', 'genres', 'quality']),
|
||||
@@ -47,41 +47,35 @@ def mainlist(item):
|
||||
|
||||
@support.scrape
|
||||
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>[^<>]+))?.+?'\
|
||||
'href="(?P<url>[^"]+)".+?src="(?P<thumb>[^"]+)".+?<h2 class="titleFilm">[^>]+>'\
|
||||
'(?P<title>.+?)[ ]?(?:|\[(?P<lang>[^\]]+)\])?(?:\((?P<year>\d{4})\))?</a>.*?'\
|
||||
'(?:IMDB\:</strong>[ ](?P<rating>.+?)<|</h2> )'
|
||||
patronBlock = r'<h1 class="titleSection titleLastIns">.+?</h1>(?P<block>.*?)<div class="row ismobile">'
|
||||
if item.args == 'az':
|
||||
patron = r'<img style="[^"]+" src="(?P<thumb>[^"]+)"[^>]+>[^>]+>[^>]+>[^>]+>[^>]+><a href="(?P<url>[^"]+)" [^>]+>(?P<title>[^<\[]+)(?:\[(?P<lang>[^\]]+)\]\s*)?<'\
|
||||
r'[^>]+>[^>]+>[^>]+>[^>]+>\s*(?P<year>\d{4})[^>]+>[^>]+>\s*(?P<quality>[^<]+).*?<span class="label">(?P<ratting>[^<]+)<'
|
||||
patronBlock =''
|
||||
|
||||
if item.args == 'genres':
|
||||
patron = r'<div class="wrapperImage">[ ]?(?:<span class="hd">'\
|
||||
'(?P<quality>[^<>]+))?.+?href="(?P<url>[^"]+)".+?src="(?P<thumb>[^"]+)"'\
|
||||
'.+?<h2 class="titleFilm(?:Mobile)?">[^>]+>(?P<title>.+?)[ ]?'\
|
||||
'(?:|\[(?P<lang>[^\]]+)\])?(?:\((?P<year>\d{4})\))?</a>.*?'\
|
||||
'(IMDB\:[ ](?P<rating>.+?))<'
|
||||
elif item.args == 'genres':
|
||||
patron = r'<div class="wrapperImage">[ ]?(?:<span class="hd">(?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>.+?))<'
|
||||
elif item.args == 'search':
|
||||
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>[^<]+)'\
|
||||
'<\/span>)?<img[^s]+src="(?P<thumb>[^"]+)"[^>]+>[^>]+>[^>]+>(?P<title>[^<]+)<[^<]+>'\
|
||||
'(?:.*?IMDB:\s(\2[^<]+)<\/div>)?'
|
||||
elif not item.args:
|
||||
patron = r'<a href="(?P<url>[^"]+)">\s*<div class="wrapperImage">(?:<span class="hd">(?P<quality>[^<]+)<\/span>)?<img[^s]+src="(?P<thumb>[^"]+)"'\
|
||||
r'[^>]+>[^>]+>[^>]+>(?P<title>[^<]+)<[^<]+>(?:.*?IMDB:\s(\2[^<]+)<\/div>)?'
|
||||
|
||||
if not item.args:
|
||||
patronBlock = r'ULTIMI INSERITI(?P<block>.*?)<div class="sliderLastUpdate ismobile ">'
|
||||
|
||||
# nella pagina "CERCA", la voce "SUCCESSIVO" apre la maschera di inserimento dati
|
||||
patronNext = r'<a class="next page-numbers" href="([^"]+)">'
|
||||
|
||||
#debug = True
|
||||
return locals()
|
||||
|
||||
@support.scrape
|
||||
def genres(item):
|
||||
support.log('genres', item)
|
||||
#debug = True
|
||||
|
||||
action = 'peliculas'
|
||||
patron = r'<li><a href="(?P<url>[^"]+)">(?P<title>[^<]+)<'
|
||||
patronMenu = r'<li><a href="(?P<url>[^"]+)">(?P<title>[^<]+)<'
|
||||
|
||||
if item.args == 'genres':
|
||||
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>'
|
||||
patron = r'<li><a href="(?P<url>[^"]+)">(?P<title>[^<[]+)(?:\[(?P<lang>.+?)\])?<'
|
||||
action = 'findvideos'
|
||||
|
||||
item.args = 'genres'
|
||||
elif item.args == 'az':
|
||||
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()
|
||||
|
||||
|
||||
@@ -26,6 +26,8 @@ def mainlist(item):
|
||||
('Documentari {bullet bold}', ['/documentari/index.json', 'menu']),
|
||||
('Programmi TV{bullet bold}', ['/programmi/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']),
|
||||
('Musica e Teatro {bullet bold}', ['/performing-arts/index.json', 'menu'])
|
||||
]
|
||||
@@ -44,11 +46,24 @@ def menu(item):
|
||||
url = item.url, args = 'genre', action = '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)
|
||||
|
||||
|
||||
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):
|
||||
support.log()
|
||||
itemlist = []
|
||||
@@ -113,13 +128,17 @@ def search(item, text):
|
||||
support.log()
|
||||
itemlist =[]
|
||||
try:
|
||||
json = current_session.get(host + '/dl/RaiTV/RaiPlayMobile/Prod/Config/programmiAZ-elenco.json').json()
|
||||
for key in json:
|
||||
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'])))
|
||||
if item.url:
|
||||
item.search = text
|
||||
itemlist = peliculas(item)
|
||||
else:
|
||||
json = current_session.get(host + '/dl/RaiTV/RaiPlayMobile/Prod/Config/programmiAZ-elenco.json').json()
|
||||
for key in json:
|
||||
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:
|
||||
import sys
|
||||
for line in sys.exc_info():
|
||||
@@ -152,17 +171,17 @@ def dirette(item):
|
||||
|
||||
|
||||
def peliculas(item):
|
||||
support.log()
|
||||
support.log(item.url)
|
||||
itemlist = []
|
||||
keys = []
|
||||
key_list = []
|
||||
|
||||
# pagination options
|
||||
pag = item.page if item.page else 1
|
||||
pagination = 40
|
||||
pagination = 40 if not item.search else ''
|
||||
|
||||
# load json
|
||||
if item.args == 'az':
|
||||
if type(item.url) in [dict, list]:
|
||||
json = item.url
|
||||
for key in json:
|
||||
if item.search.lower() in key['name'].lower():
|
||||
@@ -216,18 +235,47 @@ def select(item):
|
||||
|
||||
|
||||
def episodios(item):
|
||||
support.log()
|
||||
support.log(len(item.url))
|
||||
itemlist = []
|
||||
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()
|
||||
support.videolibrary(itemlist, item)
|
||||
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()):
|
||||
for key in item.url:
|
||||
itemlist.append(support.Item(channel = item.channel, title = support.typo(key['name'], 'bold'), fulltitle = item.fulltitle, show = item.show, thumbnail = item.thumbnail,
|
||||
fanart = item.fanart, url = getUrl(key['path_id']), plot = item.plot, contentType = 'tvshow',
|
||||
action = 'episodios'))
|
||||
|
||||
elif type(item.url) in [list, dict]:
|
||||
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:
|
||||
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
|
||||
|
||||
|
||||
@@ -274,34 +322,40 @@ def getUrl(pathId):
|
||||
def addinfo(key, item):
|
||||
support.log()
|
||||
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'],
|
||||
thumbnail = getUrl(key['images']['portrait_logo']), fanart = getUrl(key['images']['landscape']), url = getUrl(key['path_id']), plot = info['description'])
|
||||
if key['layout'] == 'single':
|
||||
it.action = 'findvideos'
|
||||
it.contentType = 'movie'
|
||||
it.contentTitle = it.fulltitle
|
||||
else:
|
||||
it.action = 'select'
|
||||
it.contentType = 'tvshow'
|
||||
it.contentSerieName = it.fulltitle
|
||||
return it
|
||||
if not item.search or item.search.lower() in key['name'].lower():
|
||||
it = support.Item( channel = item.channel, title = support.typo(key['name'],'bold'), fulltitle = key['name'], show = key['name'],
|
||||
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'])
|
||||
if 'layout' not in key or key['layout'] == 'single':
|
||||
it.action = 'findvideos'
|
||||
it.contentType = 'movie'
|
||||
it.contentTitle = it.fulltitle
|
||||
else:
|
||||
it.action = 'select'
|
||||
it.contentType = 'tvshow'
|
||||
it.contentSerieName = it.fulltitle
|
||||
return it
|
||||
|
||||
|
||||
def load_episodes(key, item):
|
||||
support.log()
|
||||
itemlist=[]
|
||||
itemlist = []
|
||||
json = current_session.get(getUrl(key['path_id'])).json()['items']
|
||||
order = 0
|
||||
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:
|
||||
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:
|
||||
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))
|
||||
action = 'findvideos', VL=True if ep else False, order=order))
|
||||
return itemlist
|
||||
|
||||
|
||||
|
||||
@@ -385,6 +385,8 @@ def thumb(item_or_itemlist=None, genre=False, thumb=''):
|
||||
icon_dict = {'channels_movie':['film'],
|
||||
'channels_tvshow':['serie','tv','episodi','episodio','fiction'],
|
||||
'channels_documentary':['documentari','documentario', 'documentary'],
|
||||
'channels_teenager':['ragazzi','teenager', 'teen'],
|
||||
'channels_learning':['learning'],
|
||||
'channels_all':['tutti'],
|
||||
'news':['novità', "novita'", 'aggiornamenti', 'nuovi', 'nuove'],
|
||||
'now_playing':['cinema', 'in sala'],
|
||||
|
||||
@@ -221,6 +221,7 @@ def open_settings():
|
||||
|
||||
|
||||
from specials import move_videolibrary
|
||||
move_videolibrary.set_new_path(settings_pre.get('downloadpath'), settings_post.get('downloadpath'))
|
||||
|
||||
# si se ha puesto que se quiere autoconfigurar y se había creado el directorio de la videoteca
|
||||
if not settings_pre.get("videolibrary_kodi", None) and settings_post.get("videolibrary_kodi", None) \
|
||||
|
||||
@@ -283,7 +283,7 @@ def episodios(item, json ='', key='', itemlist =[]):
|
||||
ep = 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 ''
|
||||
else: Pagination = ''
|
||||
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 = '%sx%s%s' % (season_number, episode_number, title)
|
||||
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,
|
||||
title = set_title(title, extra.language, extra.quality),
|
||||
fulltitle = item.fulltitle,
|
||||
|
||||
@@ -153,6 +153,7 @@ def update_db(current_path, new_path, current_movies_folder, new_movies_folder,
|
||||
p += 5
|
||||
progress.update(90, config.get_localized_string(20000), config.get_localized_string(80013))
|
||||
|
||||
|
||||
def clear_videolibrary_db():
|
||||
log()
|
||||
progress = platformtools.dialog_progress_bg(config.get_localized_string(20000), config.get_localized_string(60601))
|
||||
@@ -224,6 +225,8 @@ def clear_videolibrary_db():
|
||||
|
||||
def set_new_path(old, new=''):
|
||||
log()
|
||||
if new == old: return
|
||||
|
||||
SOURCES_PATH = xbmc.translatePath("special://userdata/sources.xml")
|
||||
if filetools.isfile(SOURCES_PATH):
|
||||
xmldoc = minidom.parse(SOURCES_PATH)
|
||||
|
||||
Reference in New Issue
Block a user