- Aggiunto Mediaset Play
- Fix Ricerca Rai Play - Installazione automatica inputstreamAdaprive
This commit is contained in:
13
channels/mediasetplay.json
Normal file
13
channels/mediasetplay.json
Normal file
@@ -0,0 +1,13 @@
|
||||
{
|
||||
"id": "mediasetplay",
|
||||
"name": "Mediaset Play",
|
||||
"active": true,
|
||||
"language": ["ita"],
|
||||
"thumbnail": "mediasetplay.png",
|
||||
"banner": "mediasetplay.png",
|
||||
"categories": ["movie", "tvshow", "documentary", "live"],
|
||||
"not_active": ["include_in_newest"],
|
||||
"default_off": ["include_in_global_search"],
|
||||
"settings": [],
|
||||
"cloudflare": true
|
||||
}
|
||||
230
channels/mediasetplay.py
Normal file
230
channels/mediasetplay.py
Normal file
@@ -0,0 +1,230 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# ------------------------------------------------------------
|
||||
# Canale per Mediaset Play
|
||||
# ------------------------------------------------------------
|
||||
|
||||
import requests
|
||||
from core import support, httptools
|
||||
import sys
|
||||
if sys.version_info[0] >= 3:
|
||||
from concurrent import futures
|
||||
from urllib.parse import urlencode, quote
|
||||
else:
|
||||
from concurrent_py2 import futures
|
||||
from urllib import urlencode, quote
|
||||
|
||||
current_session = requests.Session()
|
||||
data = {"cid": "dc4e7d82-89a5-4a96-acac-d3c7f2ca6d67", "platform": "pc", "appName": "web/mediasetplay-web/576ea90"}
|
||||
res = current_session.post("https://api-ott-prod-fe.mediaset.net/PROD/play/idm/anonymous/login/v1.0", json=data, verify=False)
|
||||
current_session.headers.update({'t-apigw': res.headers['t-apigw']})
|
||||
current_session.headers.update({'t-cts': res.headers['t-cts']})
|
||||
tracecid=res.json()['response']['traceCid']
|
||||
cwid=res.json()['response']['cwId']
|
||||
res = current_session.get("https://api.one.accedo.tv/session?appKey=59ad346f1de1c4000dfd09c5&uuid=sdd",verify=False)
|
||||
current_session.headers.update({'x-session': res.json()['sessionKey']})
|
||||
host = ''
|
||||
entry = 'https://api.one.accedo.tv/content/entry/{id}?locale=it'
|
||||
entries = 'https://api.one.accedo.tv/content/entries?id={id}&locale=it'
|
||||
|
||||
|
||||
@support.menu
|
||||
def mainlist(item):
|
||||
top = [('Dirette {bold}', ['https://feed.entertainment.tv.theplatform.eu/f/PR1GhC/mediaset-prod-all-stations?sort=ShortTitle', 'dirette'])]
|
||||
|
||||
menu = [('Film {bullet bold}', ['5acfcbc423eec6000d64a6bb', 'menu', ['Tutti','all','Cinema']]),
|
||||
('Fiction / Serie TV {bullet bold}', ['5acfcb3c23eec6000d64a6a4', 'menu', ['Tutte','all','Fiction'], 'tvshow']),
|
||||
('Programmi TV{ bullet bold}', ['', 'menu', ['Tutti','all','Programmi Tv'], 'tvshow']),
|
||||
('Documentari {bullet bold}', ['5bfd17c423eec6001aec49f9', 'menu', ['Tutti','all','Documentari'], 'undefined']),
|
||||
('Kids {bullet bold}', ['5acfcb8323eec6000d64a6b3', 'menu',['Tutti','all','Kids'], 'undefined']),
|
||||
]
|
||||
|
||||
search = ''
|
||||
return locals()
|
||||
|
||||
|
||||
|
||||
def search(item, text):
|
||||
support.log(text)
|
||||
item.search = text
|
||||
if not item.args:
|
||||
item.contentType = 'undefined'
|
||||
item.args=['','all','']
|
||||
itemlist = []
|
||||
try:
|
||||
itemlist += peliculas(item)
|
||||
except:
|
||||
import sys
|
||||
for line in sys.exc_info():
|
||||
support.logger.error("%s" % line)
|
||||
return itemlist
|
||||
|
||||
def menu(item):
|
||||
support.log()
|
||||
itemlist = [item.clone(title=support.typo(item.args[0],'bullet bold'), url='', action='peliculas')]
|
||||
if item.url:
|
||||
json = get_from_id(item)
|
||||
for it in json:
|
||||
if 'uxReference' in it: itemlist.append(item.clone(title=support.typo(it['title'], 'submenu'), url=it['uxReference'], args = '', action='peliculas'))
|
||||
itemlist.append(item.clone(title=support.typo('Cerca...','submenu bold'), url='', action ='search'))
|
||||
return itemlist
|
||||
|
||||
def dirette(item):
|
||||
support.log()
|
||||
itemlist = []
|
||||
json = current_session.get(item.url).json()['entries']
|
||||
for it in json:
|
||||
urls = []
|
||||
if it['tuningInstruction'] and not it['mediasetstation$digitalOnly']:
|
||||
guide=current_session.get('https://static3.mediasetplay.mediaset.it/apigw/nownext/' + it['callSign'] + '.json').json()['response']
|
||||
plot = support.typo(guide['currentListing']['mediasetlisting$epgTitle'],'bold') + '\n' + guide['currentListing']['mediasetlisting$shortDescription'] + '\n' + guide['currentListing']['description'] + '\n\n' + support.typo('A Seguire:' + guide['nextListing']['mediasetlisting$epgTitle'], 'bold')
|
||||
for key in it['tuningInstruction']['urn:theplatform:tv:location:any']: urls += key['publicUrls']
|
||||
itemlist.append(item.clone(title=support.typo(it['title'], 'bold'),
|
||||
fulltitle=it['title'],
|
||||
show=it['title'],
|
||||
contentTitle=it['title'],
|
||||
thumbnail=it['thumbnails']['channel_logo-100x100']['url'],
|
||||
forcethumb = True,
|
||||
url=urls,
|
||||
plot=plot,
|
||||
action='play'))
|
||||
return itemlist
|
||||
|
||||
def peliculas(item):
|
||||
support.log()
|
||||
itemlist = []
|
||||
contentType = ''
|
||||
json = get_programs(item)
|
||||
for it in json:
|
||||
if item.search.lower() in it['title'].lower():
|
||||
if item.contentType == 'movie':
|
||||
action = 'findvideos'
|
||||
urls = []
|
||||
if 'media' not in it: it = subBrand(it['mediasetprogram$brandId'])[-1]
|
||||
if 'media' in it:
|
||||
for key in it['media']:
|
||||
urls.append(key['publicUrl'])
|
||||
elif item.contentType == 'tvshow':
|
||||
action = 'episodios'
|
||||
urls = it['mediasetprogram$brandId']
|
||||
else:
|
||||
if 'media' in it:
|
||||
action = 'findvideos'
|
||||
contentType = 'movie'
|
||||
urls = []
|
||||
for key in it['media']:
|
||||
urls.append(key['publicUrl'])
|
||||
else:
|
||||
action = 'episodios'
|
||||
contentType = 'tvshow'
|
||||
urls = it['mediasetprogram$brandId']
|
||||
if urls:
|
||||
itemlist.append(
|
||||
item.clone(channel=item.channel,
|
||||
action=action,
|
||||
title=support.typo(it['title'], 'bold'),
|
||||
fulltitle=it['title'],
|
||||
show=it['title'],
|
||||
contentType=contentType if contentType else item.contentType,
|
||||
contentTitle=it['title'] if 'movie' in [contentType, item.contentType] else '',
|
||||
contentSerieName=it['title'] if 'tvshow' in [contentType, item.contentType] else '',
|
||||
thumbnail=it['thumbnails']['image_vertical-264x396']['url'],
|
||||
fanart=it['thumbnails']['image_keyframe_poster-1280x720']['url'] if 'image_keyframe_poster-1280x720' in it['thumbnails'] else '',
|
||||
plot=it['longDescription'] if 'longDescription' in it else it['description'] if 'description' in it else '',
|
||||
url=urls))
|
||||
return itemlist
|
||||
|
||||
def episodios(item):
|
||||
support.log()
|
||||
itemlist = []
|
||||
subBrandId = current_session.get('https://feed.entertainment.tv.theplatform.eu/f/PR1GhC/mediaset-prod-all-brands?byCustomValue={brandId}{' + item.url + '}').json()['entries'][-1]['mediasetprogram$subBrandId']
|
||||
json = current_session.get('https://feed.entertainment.tv.theplatform.eu/f/PR1GhC/mediaset-prod-all-programs?byCustomValue={subBrandId}{' + subBrandId + '}').json()['entries']
|
||||
for it in json:
|
||||
urls = []
|
||||
if 'media' in it:
|
||||
for key in it['media']:
|
||||
urls.append(key['publicUrl'])
|
||||
if urls:
|
||||
title = it['title'].split('-')[-1].strip()
|
||||
if it['tvSeasonNumber'] and it['tvSeasonEpisodeNumber']:
|
||||
item.infoLabels['season'] = it['tvSeasonNumber']
|
||||
item.infoLabels['episode'] = it['tvSeasonEpisodeNumber']
|
||||
episode = '%dx%02d - ' % (it['tvSeasonNumber'], it['tvSeasonEpisodeNumber'])
|
||||
else: episode = ''
|
||||
itemlist.append(
|
||||
item.clone(action='findvideos',
|
||||
title=support.typo(episode + title, 'bold'),
|
||||
fulltitle=title,
|
||||
show=title,
|
||||
contentType='episode',
|
||||
contentSerieName = title,
|
||||
thumbnail=it['thumbnails']['image_vertical-264x396']['url'],
|
||||
fanart=it['thumbnails']['image_keyframe_poster-1280x720']['url'] if 'image_keyframe_poster-1280x720' in it['thumbnails'] else '',
|
||||
plot=it['longDescription'] if 'longDescription' in it else it['description'],
|
||||
url=urls))
|
||||
support.videolibrary(itemlist, item)
|
||||
return sorted(itemlist, key=lambda it: it.title)
|
||||
|
||||
def findvideos(item):
|
||||
support.log()
|
||||
itemlist = []
|
||||
itemlist.append(support.Item(server = 'directo', title = 'Direct', url = item.url, action = 'play'))
|
||||
return support.server(item, itemlist=itemlist, Download=False)
|
||||
|
||||
def play(item):
|
||||
support.log()
|
||||
for url in item.url:
|
||||
url = httptools.downloadpage(url, allow_redirects=True).url
|
||||
if '.mpd' in url: data = url
|
||||
return support.servertools.find_video_items(item, data=data)
|
||||
|
||||
def subBrand(json):
|
||||
support.log()
|
||||
subBrandId = current_session.get('https://feed.entertainment.tv.theplatform.eu/f/PR1GhC/mediaset-prod-all-brands?byCustomValue={brandId}{' + json + '}').json()['entries'][-1]['mediasetprogram$subBrandId']
|
||||
json = current_session.get('https://feed.entertainment.tv.theplatform.eu/f/PR1GhC/mediaset-prod-all-programs?byCustomValue={subBrandId}{' + subBrandId + '}').json()['entries']
|
||||
return json
|
||||
|
||||
def get_from_id(item):
|
||||
support.log()
|
||||
json = current_session.get(entry.format(id=item.url)).json()
|
||||
if 'components' in json:
|
||||
id = quote(",".join(json["components"]))
|
||||
json = current_session.get(entries.format(id=id)).json()
|
||||
if 'entries' in json:
|
||||
support.log(json['entries'])
|
||||
return json['entries']
|
||||
return {}
|
||||
|
||||
def get_programs(item, ret=[], args={}):
|
||||
support.log()
|
||||
hasMore = False
|
||||
if not args:
|
||||
if item.url:
|
||||
args['uxReference'] = item.url
|
||||
args['platform'] = 'pc'
|
||||
else:
|
||||
args = {"query": "*:*"}
|
||||
if item.args[2]:
|
||||
args['categories'] = item.args[2]
|
||||
|
||||
args['cwId'] = cwid
|
||||
args['traceCid'] = tracecid
|
||||
args['hitsPerPage'] = 500
|
||||
args['page'] = '0'
|
||||
|
||||
if 'all' in item.args: url = 'https://api-ott-prod-fe.mediaset.net/PROD/play/rec/azlisting/v1.0?' + urlencode(args)
|
||||
else: url="https://api-ott-prod-fe.mediaset.net/PROD/play/rec/cataloguelisting/v1.0?" + urlencode(args)
|
||||
json = current_session.get(url).json()
|
||||
if 'response' in json:
|
||||
json = json['response']
|
||||
if 'hasMore' in json:
|
||||
hasMore = json['hasMore']
|
||||
if 'components' in json:
|
||||
id = quote(",".join(json["components"]))
|
||||
json = current_session.get(entries.format(id=id)).json()
|
||||
if 'entries' in json:
|
||||
ret += json['entries']
|
||||
if hasMore:
|
||||
args['page'] = str(int(args['page']) + 1)
|
||||
return get_programs(item, ret, args)
|
||||
else:
|
||||
return ret
|
||||
@@ -7,6 +7,7 @@
|
||||
"banner": "raiplay.png",
|
||||
"categories": ["movie", "tvshow", "documentary", "live"],
|
||||
"not_active": ["include_in_newest"],
|
||||
"default_off": ["include_in_global_search"],
|
||||
"settings": [],
|
||||
"cloudflare": true
|
||||
}
|
||||
|
||||
@@ -118,10 +118,11 @@ def replay(item):
|
||||
return itemlist
|
||||
|
||||
def search(item, text):
|
||||
# support.dbg()
|
||||
support.log()
|
||||
itemlist =[]
|
||||
try:
|
||||
if item.url:
|
||||
if item.url != host:
|
||||
item.search = text
|
||||
itemlist = peliculas(item)
|
||||
else:
|
||||
@@ -158,7 +159,7 @@ def dirette(item):
|
||||
onAir = current_session.get(onair).json()['on_air']
|
||||
for i, key in enumerate(json):
|
||||
itemlist.append(item.clone(title = support.typo(key['channel'], 'bold'), fulltitle = key['channel'], show = key['channel'], url = key['video']['contentUrl'],
|
||||
thumbnail = key['transparent-icon'].replace("[RESOLUTION]", "256x-"),forcethumb=True , fanart = getUrl(onAir[i]['currentItem']['image']),
|
||||
thumbnail = key['transparent-icon'].replace("[RESOLUTION]", "256x-"), forcethumb = True , fanart = getUrl(onAir[i]['currentItem']['image']),
|
||||
plot = support.typo(onAir[i]['currentItem']['name'],'bold')+ '\n\n' + onAir[i]['currentItem']['description'], action = 'play'))
|
||||
return itemlist
|
||||
|
||||
|
||||
@@ -248,7 +248,7 @@ def getCurrentView(item=None, parent_item=None):
|
||||
elif (item.contentType in ['movie'] and parent_item.action in parent_actions) \
|
||||
or (item.channel in ['videolibrary'] and parent_item.action in ['list_movies']) \
|
||||
or (parent_item.channel in ['favorites'] and parent_item.action in ['mainlist']) \
|
||||
or parent_item.action in ['now_on_tv', 'now_on_misc', 'now_on_misc_film', 'mostrar_perfil']:
|
||||
or parent_item.action in ['now_on_tv', 'now_on_misc', 'now_on_misc_film', 'mostrar_perfil', 'dirette']:
|
||||
return 'movie', 'movies'
|
||||
|
||||
elif (item.contentType in ['tvshow'] and parent_item.action in parent_actions) \
|
||||
@@ -543,7 +543,9 @@ def play_video(item, strm=False, force_direct=False, autoplay=False):
|
||||
set_infolabels(xlistitem, item, True)
|
||||
|
||||
# if it is a video in mpd format, the listitem is configured to play it ith the inpustreamaddon addon implemented in Kodi 17
|
||||
# from core.support import dbg;dbg()
|
||||
if mpd:
|
||||
if not os.path.exists(os.path.join(xbmc.translatePath('special://home/addons/'),'inputstream.adaptive')): install_inputstream()
|
||||
xlistitem.setProperty('inputstreamaddon', 'inputstream.adaptive')
|
||||
xlistitem.setProperty('inputstream.adaptive.manifest_type', 'mpd')
|
||||
|
||||
@@ -862,6 +864,9 @@ def get_video_seleccionado(item, seleccion, video_urls):
|
||||
wait_time = video_urls[seleccion][2]
|
||||
view = True
|
||||
|
||||
if 'mpd' in video_urls[seleccion][0]:
|
||||
mpd = True
|
||||
|
||||
# If there is no mediaurl it is because the video is not there :)
|
||||
logger.info("mediaurl=" + mediaurl)
|
||||
if mediaurl == "":
|
||||
@@ -1060,4 +1065,19 @@ def resume_playback(item, return_played_time=False):
|
||||
return item, nfo_path, head_nfo, item_nfo
|
||||
else:
|
||||
item.nfo = item.strm_path = ""
|
||||
return item, None, None, None
|
||||
return item, None, None, None
|
||||
|
||||
def install_inputstream():
|
||||
from xbmcaddon import Addon
|
||||
try:
|
||||
# See if there's an installed repo that has it
|
||||
xbmc.executebuiltin('InstallAddon(inputstream.adaptive)', wait=True)
|
||||
|
||||
# Check if InputStream add-on exists!
|
||||
Addon('inputstream.adaptive')
|
||||
|
||||
logger.info('InputStream add-on installed from repo.')
|
||||
return True
|
||||
except RuntimeError:
|
||||
logger.info('InputStream add-on not installed.')
|
||||
return False
|
||||
@@ -4,10 +4,14 @@
|
||||
"ignore_urls": [],
|
||||
"patterns": [
|
||||
{
|
||||
"pattern": "((?:http://|https://).*?m3u8[^\"'\n]+)",
|
||||
"pattern": "((?:http://|https://).*?m3u8[^\"'\n]*)",
|
||||
"url": "\\1"
|
||||
|
||||
},
|
||||
{
|
||||
"pattern": "((?:http://|https://).*?.mpd[^\"'\n]*)",
|
||||
"url": "\\1"
|
||||
},
|
||||
{
|
||||
"pattern": "(http://[a-zA-Z0-9]+\\.mysites\\.com\\/get_file\\/.*?\\.mp4)",
|
||||
"url": "\\1"
|
||||
|
||||
@@ -18,7 +18,7 @@ def mainlist(item):
|
||||
itemlist = [Item(title=support.typo('Film in onda oggi', 'bold'), channel=item.channel, action='category', contentType='movie', thumbnail=support.thumb(thumb='movie.png')),
|
||||
Item(title=support.typo('Serie Tv in onda oggi', 'bold'), channel=item.channel, action='peliculas', contentType='tvshow', thumbnail=support.thumb(thumb='tvshow.png')),
|
||||
Item(title=support.typo('Guida tv per canale', 'bold'), channel=item.channel, action='listaCanali', thumbnail=support.thumb(thumb='on_the_air.png')),
|
||||
Item(title=support.typo('Canali live (Rai Play)', 'bold'), channel=item.channel, action='live', thumbnail=support.thumb(thumb='tvshow_on_the_air.png'))]
|
||||
Item(title=support.typo('Canali live', 'bold'), channel=item.channel, action='live', thumbnail=support.thumb(thumb='tvshow_on_the_air.png'))]
|
||||
|
||||
return itemlist
|
||||
|
||||
@@ -308,5 +308,8 @@ def new_search(item):
|
||||
|
||||
|
||||
def live(item):
|
||||
from channels import raiplay
|
||||
return raiplay.dirette(raiplay.mainlist(Item())[0])
|
||||
itemlist = []
|
||||
from channels import raiplay, mediasetplay
|
||||
itemlist += raiplay.dirette(raiplay.mainlist(Item())[0])
|
||||
itemlist += mediasetplay.dirette(mediasetplay.mainlist(Item())[0])
|
||||
return itemlist
|
||||
|
||||
Reference in New Issue
Block a user