Playback Monitor as a service,
Global search fix other minimal fix
This commit is contained in:
@@ -59,8 +59,7 @@ def movies(item):
|
||||
def itemlistHook(itemlist):
|
||||
args = item.args
|
||||
args[0] += 1
|
||||
support.nextPage(itemlist, item, next_page=item.url, "movies")
|
||||
# itemlist.append(item.clone(title=support.typo(support.config.getLocalizedString(30992), 'color kod bold'), args=args, thumbnail=support.thumb()))
|
||||
support.nextPage(itemlist, item, 'movies', next_page=item.url, total_pages=15)
|
||||
return itemlist
|
||||
return locals()
|
||||
|
||||
@@ -73,7 +72,7 @@ def search(item, text):
|
||||
item.url += text + '.html'
|
||||
try:
|
||||
return movies(item)
|
||||
# Cattura la eccezione così non interrompe la ricerca globle se il canale si rompe!
|
||||
# Cattura l' eccezione così non interrompe la ricerca globle se il canale si rompe!
|
||||
except:
|
||||
import sys
|
||||
for line in sys.exc_info():
|
||||
|
||||
+37
-16
@@ -2,12 +2,14 @@
|
||||
# ------------------------------------------------------------
|
||||
# Canale per Mediaset Play
|
||||
# ------------------------------------------------------------
|
||||
import functools
|
||||
|
||||
from platformcode import logger, config
|
||||
import uuid, datetime, xbmc
|
||||
|
||||
import requests, sys
|
||||
from core import support
|
||||
from core import jsontools, support, httptools
|
||||
|
||||
if sys.version_info[0] >= 3:
|
||||
from urllib.parse import urlencode, quote
|
||||
else:
|
||||
@@ -23,6 +25,7 @@ loginData = {"client_id": clientid, "platform": "pc", "appName": "web//mediasetp
|
||||
sessionUrl = "https://api.one.accedo.tv/session?appKey=59ad346f1de1c4000dfd09c5&uuid={uuid}&gid=default"
|
||||
|
||||
session = requests.Session()
|
||||
session.request = functools.partial(session.request, timeout=httptools.HTTPTOOLS_DEFAULT_DOWNLOAD_TIMEOUT)
|
||||
session.headers.update({'Content-Type': 'application/json', 'User-Agent': support.httptools.get_user_agent(), 'Referer': host})
|
||||
|
||||
entry = 'https://api.one.accedo.tv/content/entry/{id}?locale=it'
|
||||
@@ -75,19 +78,26 @@ def live(item):
|
||||
stations = res['stations']
|
||||
|
||||
for it in stations.values():
|
||||
logger.debug(jsontools.dump(it))
|
||||
plot = ''
|
||||
title = it['title']
|
||||
url = 'https:' + it['mediasetstation$pageUrl']
|
||||
if 'plus' in title.lower() or 'premium' in title.lower(): continue
|
||||
if 'SVOD' in it['mediasetstation$channelsRights']: continue
|
||||
thumb = it.get('thumbnails',{}).get('channel_logo-100x100',{}).get('url','')
|
||||
if it['callSign'] in allguide:
|
||||
|
||||
guide = allguide[it['callSign']]
|
||||
plot = '[B]{}[/B]\n{}\n\nA Seguire:\n[B]{}[/B]\n{}'.format(guide['currentListing']['mediasetlisting$epgTitle'],
|
||||
guide['currentListing']['description'],
|
||||
guide['nextListing']['mediasetlisting$epgTitle'],
|
||||
guide['nextListing']['description'],)
|
||||
|
||||
itemlist.append(item.clone(title=support.typo(title, 'bold'), fulltitle=title, callSign=it['callSign'], urls=guide['tuningInstruction']['urn:theplatform:tv:location:any'], plot=plot, url=url, action='play', forcethumb=True))
|
||||
plot = '[B]{}[/B]\n{}'.format(guide.get('currentListing', {}).get('mediasetlisting$epgTitle', ''),guide.get('currentListing', {}).get('description', ''))
|
||||
if 'nextListing' in guide.keys():
|
||||
plot += '\n\nA Seguire:\n[B]{}[/B]\n{}'.format(guide.get('nextListing', {}).get('mediasetlisting$epgTitle', ''),guide.get('nextListing', {}).get('description', ''))
|
||||
itemlist.append(item.clone(title=title,
|
||||
fulltitle=title, callSign=it['callSign'],
|
||||
urls=guide['tuningInstruction']['urn:theplatform:tv:location:any'],
|
||||
plot=plot,
|
||||
url=url,
|
||||
action='findvideos',
|
||||
thumbnail=thumb,
|
||||
forcethumb=True))
|
||||
|
||||
itemlist.sort(key=lambda it: support.channels_order.get(it.fulltitle, 999))
|
||||
support.thumb(itemlist, mode='live')
|
||||
@@ -103,7 +113,7 @@ def search(item, text):
|
||||
except:
|
||||
import sys
|
||||
for line in sys.exc_info():
|
||||
logger.error("%s" % line)
|
||||
support.logger.error("%s" % line)
|
||||
return []
|
||||
|
||||
|
||||
@@ -131,7 +141,7 @@ def movies(item):
|
||||
else:
|
||||
contentType = 'movie'
|
||||
video_id = it['guid']
|
||||
action = 'play'
|
||||
action = 'findvideos'
|
||||
for k, v in it['thumbnails'].items():
|
||||
if 'image_vertical' in k and not thumb:
|
||||
thumb = v['url'].replace('.jpg', '@3.jpg')
|
||||
@@ -140,7 +150,7 @@ def movies(item):
|
||||
if thumb and fanart:
|
||||
break
|
||||
|
||||
itemlist.append(item.clone(title=support.typo(title, 'bold'),
|
||||
itemlist.append(item.clone(title=title,
|
||||
fulltitle=title,
|
||||
contentTitle=title,
|
||||
contentSerieName=contentSerieName,
|
||||
@@ -172,14 +182,14 @@ def epmenu(item):
|
||||
for s in item.seriesid:
|
||||
itemlist.append(
|
||||
item.clone(seriesid = s['id'],
|
||||
title=support.typo(s['title'], 'bold')))
|
||||
title=s['title']))
|
||||
if len(itemlist) == 1: return epmenu(itemlist[0])
|
||||
else:
|
||||
res = requests.get(epUrl.format(item.seriesid)).json()['entries']
|
||||
for it in res:
|
||||
itemlist.append(
|
||||
item.clone(seriesid = '',
|
||||
title=support.typo(it['description'], 'bold'),
|
||||
title=it['description'],
|
||||
subbrand=it['mediasetprogram$subBrandId'],
|
||||
action='episodes'))
|
||||
itemlist = sorted(itemlist, key=lambda it: it.title, reverse=True)
|
||||
@@ -195,15 +205,18 @@ def episodes(item):
|
||||
except: # per i test, xbmc.getLocalizedString non è supportato
|
||||
for month in range(21, 33): months.append('dummy')
|
||||
|
||||
# i programmi tv vanno ordinati per data decrescente, gli episodi delle serie per data crescente
|
||||
order = 'desc' if '/programmi-tv/' in item.url else 'asc'
|
||||
|
||||
itemlist = []
|
||||
res = requests.get('https://feed.entertainment.tv.theplatform.eu/f/PR1GhC/mediaset-prod-all-programs-v2?byCustomValue={subBrandId}{' + item.subbrand +'}&sort=:publishInfo_lastPublished|asc,tvSeasonEpisodeNumber').json()['entries']
|
||||
res = requests.get('https://feed.entertainment.tv.theplatform.eu/f/PR1GhC/mediaset-prod-all-programs-v2?byCustomValue={subBrandId}{' + item.subbrand +'}&sort=:publishInfo_lastPublished|' + order + ',tvSeasonEpisodeNumber').json()['entries']
|
||||
|
||||
for it in res:
|
||||
thumb = ''
|
||||
titleDate = ''
|
||||
if 'mediasetprogram$publishInfo_lastPublished' in it:
|
||||
date = datetime.date.fromtimestamp(it['mediasetprogram$publishInfo_lastPublished'] / 1000)
|
||||
titleDate =' [{} {}]'.format(date.day, months[date.month])
|
||||
titleDate =' [{} {}]'.format(date.day, months[date.month-1])
|
||||
title = '[B]{}[/B]{}'.format(it['title'], titleDate)
|
||||
for k, v in it['thumbnails'].items():
|
||||
if 'image_keyframe' in k and not thumb:
|
||||
@@ -215,15 +228,21 @@ def episodes(item):
|
||||
thumbnail=thumb,
|
||||
forcethumb=True,
|
||||
contentType='episode',
|
||||
action='play',
|
||||
action='findvideos',
|
||||
video_id=it['guid']))
|
||||
|
||||
return itemlist
|
||||
|
||||
|
||||
def findvideos(item):
|
||||
logger.debug()
|
||||
return support.server(item, itemlist=[item.clone(server='directo', action='play')])
|
||||
|
||||
|
||||
def play(item):
|
||||
logger.debug()
|
||||
item.no_return=True
|
||||
# support.dbg()
|
||||
mpd = config.getSetting('mpd', item.channel)
|
||||
|
||||
|
||||
@@ -238,6 +257,8 @@ def play(item):
|
||||
if Format in it['format']:
|
||||
item.url = requests.head(it['publicUrls'][0]).headers['Location']
|
||||
pid = it['releasePids'][0]
|
||||
if mpd and 'widevine' in it['assetTypes']:
|
||||
break
|
||||
|
||||
if mpd:
|
||||
item.manifest = 'mpd'
|
||||
|
||||
@@ -64,7 +64,7 @@ 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))
|
||||
itemlist.append(item.clone(title=key, contentTitle=key, fulltitle=key, show=key, url=value['url'], plot=value['plot'], action='findvideos', forcethumb=True, no_return=True))
|
||||
return support.thumb(itemlist, mode='live')
|
||||
|
||||
|
||||
@@ -92,7 +92,7 @@ def movies(item):
|
||||
continue
|
||||
if item.text.lower() in title.lower():
|
||||
itemlist.append(
|
||||
item.clone(title=support.typo(title,'bold'),
|
||||
item.clone(title=title,
|
||||
fulltitle = title,
|
||||
show = title,
|
||||
contentTitle = title if item.contentType == 'movie' else '',
|
||||
@@ -137,10 +137,10 @@ def episodes(item):
|
||||
s = support.match(se, patron=r'S\s*(?P<season>\d+)').match
|
||||
e = support.match(se, patron=r'E\s*(?P<episode>\d+)').match
|
||||
if not e: e = support.match(it['meta']['subHeader'], patron=r'(\d+)').match
|
||||
title = support.typo((s + 'x' if s else 'Episodio ') + e.zfill(2) + ' - ' + it['meta']['subHeader'],'bold')
|
||||
title = (s + 'x' if s else 'Episodio ') + e.zfill(2) + ' - ' + it['meta']['subHeader']
|
||||
else:
|
||||
s = e = '0'
|
||||
title = support.typo(it['meta']['header']['title'],'bold')
|
||||
title = it['meta']['header']['title']
|
||||
itemlist.append(
|
||||
item.clone(title=title,
|
||||
season=int(s) if s else '',
|
||||
@@ -170,9 +170,4 @@ def play(item):
|
||||
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, mode='live')
|
||||
return [item]
|
||||
+7
-7
@@ -19,8 +19,8 @@ host = support.config.get_channel_url()
|
||||
|
||||
@support.menu
|
||||
def mainlist(item):
|
||||
top = [('Dirette {bold}', ['/dirette', 'live', '/palinsesto/onAir.json']),
|
||||
('Replay {bold}', ['/guidatv', 'replayMenu', '/guidatv.json'])]
|
||||
top = [('Dirette {bullet bold}', ['/dirette', 'live', '/palinsesto/onAir.json']),
|
||||
('Replay {bullet bold}', ['/guidatv', 'replayMenu', '/guidatv.json'])]
|
||||
|
||||
menu = [('Film {bullet bold}', ['/film', 'menu', '/tipologia/film/index.json']),
|
||||
('Serie TV {bullet bold}', ['/serietv', 'menu', '/tipologia/serietv/index.json']),
|
||||
@@ -58,7 +58,7 @@ def menu(item):
|
||||
thumb = item.thumbnail
|
||||
if 'RaiPlay Slider Generi Block' in it['type']:
|
||||
action = 'menu'
|
||||
thumb = support.thumb('genres')
|
||||
thumb = support.thumb('genre')
|
||||
itemlist.append(item.clone(title=support.typo(it['name'], 'bold'), data=it.get('contents', item.data), thumbnail=thumb, action=action))
|
||||
|
||||
return itemlist
|
||||
@@ -141,7 +141,7 @@ def live(item):
|
||||
current = it['currentItem']
|
||||
next = it['nextItem']
|
||||
plot = '[B]{}[/B]\n{}\n\nA Seguire: [B]{}[/B]\n{}'.format(current['name'], current['description'], next['name'], next['description'])
|
||||
itemlist.append(item.clone(title=title, fulltitle=title, fanart=fanart, plot=plot, url=url, videoUrl=url + '.json', action='play'))
|
||||
itemlist.append(item.clone(title=title, fulltitle=title, fanart=fanart, plot=plot, url=url, videoUrl=url + '.json', action='findvideos'))
|
||||
itemlist.sort(key=lambda it: support.channels_order.get(it.fulltitle, 999))
|
||||
support.thumb(itemlist, mode='live')
|
||||
return itemlist
|
||||
@@ -207,7 +207,7 @@ def replay(item):
|
||||
plot = info['description'],
|
||||
url = getUrl(it['weblink']),
|
||||
videoUrl = getUrl(it['path_id']),
|
||||
action = 'play',
|
||||
action = 'findvideos',
|
||||
forcethumb = True)
|
||||
|
||||
|
||||
@@ -225,7 +225,7 @@ def replay(item):
|
||||
return [Item(title='Non ci sono Replay per questo Canale')]
|
||||
return itemlist
|
||||
|
||||
def play(item):
|
||||
def findvideos(item):
|
||||
logger.debug()
|
||||
|
||||
res = requests.get(item.videoUrl).json()
|
||||
@@ -283,7 +283,7 @@ def addinfo(items, item):
|
||||
plot=info.get('description', ''))
|
||||
|
||||
if 'Genere' not in key.get('sub_type', '') and ('layout' not in key or key['layout'] == 'single'):
|
||||
it.action = 'play'
|
||||
it.action = 'findvideos'
|
||||
it.contentTitle = it.fulltitle
|
||||
else:
|
||||
it.action = 'episodes'
|
||||
|
||||
Reference in New Issue
Block a user