Fix TMDB, VVVVID, AccuRadio, Mediaset Play
This commit is contained in:
@@ -4,30 +4,33 @@
|
||||
# ------------------------------------------------------------
|
||||
|
||||
import random
|
||||
from core import httptools,support
|
||||
from core import httptools, support
|
||||
from platformcode import logger
|
||||
|
||||
host = 'https://www.accuradio.com'
|
||||
api_url = host + '/c/m/json/{}/'
|
||||
headers = [['Referer', host]]
|
||||
|
||||
@support.scrape
|
||||
|
||||
|
||||
def mainlist(item):
|
||||
if item.data: data = item.data
|
||||
else: item.url = host
|
||||
action = 'peliculas'
|
||||
patronBlock = r'Genres(?P<block>.*?)</ul'
|
||||
patron = r'listOptionBrand">\s*<a href="(?P<url>[^"]+)"(?:[^>]+>){2}(?P<title>[^<]+)'
|
||||
|
||||
def itemHook(item):
|
||||
item.thumbnail = support.thumb('music')
|
||||
return item
|
||||
|
||||
def itemlistHook(itemlist):
|
||||
itemlist = []
|
||||
item.action = 'peliculas'
|
||||
js = httptools.downloadpage(api_url.format('brands')).json
|
||||
for it in js.get('features',[]):
|
||||
itemlist.append(
|
||||
item.clone(title=support.typo('Cerca...', 'bold color kod'), action='search', thumbnail=support.thumb('search')))
|
||||
support.channel_config(item, itemlist)
|
||||
return itemlist
|
||||
return locals()
|
||||
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
|
||||
|
||||
|
||||
@support.scrape
|
||||
@@ -50,7 +53,7 @@ def playradio(item):
|
||||
album = i['album']['title']
|
||||
year = i['album']['year']
|
||||
thumb = 'https://www.accuradio.com/static/images/covers300' + i['album']['cdcover']
|
||||
duration = i['duration']
|
||||
duration = i.get('duration',0)
|
||||
info = {'duration':duration,
|
||||
'album':album,
|
||||
'artist':artist,
|
||||
|
||||
@@ -129,11 +129,11 @@ def liveDict():
|
||||
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']
|
||||
if 'restartUrl' in guide['currentListing']:
|
||||
urls = [guide['currentListing']['restartUrl']]
|
||||
else:
|
||||
for key in it['tuningInstruction']['urn:theplatform:tv:location:any']:
|
||||
urls += key['publicUrls']
|
||||
# if 'restartUrl' in guide['currentListing']:
|
||||
# urls = [guide['currentListing']['restartUrl']]
|
||||
# else:
|
||||
for key in it['tuningInstruction']['urn:theplatform:tv:location:any']:
|
||||
urls += key['publicUrls']
|
||||
title = it['title']
|
||||
livedict[title] = {}
|
||||
livedict[title]['urls'] = urls
|
||||
@@ -221,6 +221,7 @@ def peliculas(item):
|
||||
def epmenu(item):
|
||||
logger.debug()
|
||||
itemlist = []
|
||||
# support.dbg()
|
||||
if item.seriesid:
|
||||
seasons = current_session.get('https://feed.entertainment.tv.theplatform.eu/f/PR1GhC/mediaset-prod-tv-seasons?bySeriesId=' + item.seriesid).json()['entries']
|
||||
for season in seasons:
|
||||
@@ -284,33 +285,26 @@ def episodios(item):
|
||||
|
||||
def findvideos(item):
|
||||
logger.debug()
|
||||
itemlist = [support.Item(server='directo', title='Mediaset Play', url=item.urls, action='play')]
|
||||
itemlist = [item.clone(server='directo', title='Mediaset Play', urls=item.urls, action='play')]
|
||||
return support.server(item, itemlist=itemlist, Download=False)
|
||||
|
||||
|
||||
def play(item):
|
||||
logger.debug()
|
||||
if item.livefilter:
|
||||
d = liveDict()[item.livefilter]
|
||||
item = item.clone(title=support.typo(item.livefilter, 'bold'), fulltitle=item.livefilter, urls=d['urls'], plot=d['plot'], action='play', forcethumb=True, no_return=True)
|
||||
support.thumb(item, live=True)
|
||||
if not item.urls: urls = item.url
|
||||
else: urls = item.urls
|
||||
data = ''
|
||||
for url in urls:
|
||||
for url in item.urls:
|
||||
new_url = support.httptools.downloadpage(url, allow_redirects=True).url
|
||||
if '.mpd' in new_url:
|
||||
data = new_url
|
||||
sec_data = support.match(url + post_url).data
|
||||
item.url = support.match(sec_data, patron=r'<video src="([^"]+)').match
|
||||
item.manifest = 'mpd'
|
||||
if support.match(sec_data, patron=r'(security)').match:
|
||||
item.drm = DRM
|
||||
item.license = lic_url % support.match(sec_data, patron=r'pid=([^|]+)').match
|
||||
data = support.match(sec_data, patron=r'<video src="([^"]+)').match
|
||||
break
|
||||
break
|
||||
else:
|
||||
data = url
|
||||
item.url = new_url
|
||||
|
||||
return support.servertools.find_video_items(item, data=data)
|
||||
return [item]
|
||||
|
||||
|
||||
def subBrand(json):
|
||||
|
||||
@@ -150,7 +150,6 @@ def episodios(item):
|
||||
show_id = str(json_file[0]['show_id'])
|
||||
season_id = str(json_file[0]['season_id'])
|
||||
|
||||
|
||||
for episode in episodes:
|
||||
try:
|
||||
title = 'Episodio ' + episode['number'] + ' - ' + episode['title'].encode('utf8')
|
||||
@@ -166,9 +165,8 @@ def episodios(item):
|
||||
|
||||
if inspect.stack()[1][3] not in ['find_episodes']:
|
||||
autorenumber.start(itemlist, item)
|
||||
if autorenumber.check(item) == True \
|
||||
or support.match(itemlist[0].title, patron=r"(\d+x\d+)").match:
|
||||
support.videolibrary(itemlist,item)
|
||||
|
||||
support.videolibrary(itemlist,item)
|
||||
return itemlist
|
||||
|
||||
def findvideos(item):
|
||||
@@ -213,20 +211,22 @@ def make_itemlist(itemlist, item, data):
|
||||
infoLabels = {}
|
||||
for key in data['data']:
|
||||
if search.lower() in encode(key['title']).lower():
|
||||
infoLabels['year'] = key['date_published']
|
||||
infoLabels['title'] = key['title']
|
||||
if item.contentType != 'movie': infoLabels['tvshowtitle'] = key['title']
|
||||
title = encode(key['title'])
|
||||
fulltitle=title.split('-')[0].strip()
|
||||
infoLabels['year'] = key['date_published']
|
||||
infoLabels['title'] = fulltitle
|
||||
if item.contentType != 'movie': infoLabels['tvshowtitle'] = fulltitle
|
||||
itemlist.append(
|
||||
item.clone(title = support.typo(title, 'bold'),
|
||||
fulltitle= title,
|
||||
show= title,
|
||||
fulltitle= fulltitle,
|
||||
show= fulltitle,
|
||||
url= host + str(key['show_id']) + '/seasons/',
|
||||
action= 'findvideos' if item.contentType == 'movie' else 'episodios',
|
||||
contentType = item.contentType,
|
||||
contentSerieName= key['title'] if item.contentType != 'movie' else '',
|
||||
contentTitle= title if item.contentType == 'movie' else '',
|
||||
infoLabels=infoLabels))
|
||||
contentSerieName= fulltitle if item.contentType != 'movie' else '',
|
||||
contentTitle= fulltitle if item.contentType == 'movie' else '',
|
||||
infoLabels=infoLabels,
|
||||
videolibrary=False))
|
||||
return itemlist
|
||||
|
||||
def loadjs(url):
|
||||
|
||||
@@ -994,10 +994,7 @@ class Tmdb(object):
|
||||
'&include_adult=%s&page=%s' % (self.busqueda_tipo, text_quote, self.busqueda_idioma, True, page))
|
||||
|
||||
if self.busqueda_year:
|
||||
if self.busqueda_tipo == 'tv':
|
||||
url += '&first_air_date_year=%s' % self.busqueda_year
|
||||
else:
|
||||
url += '&year=%s' % self.busqueda_year
|
||||
url += '&year=%s' % self.busqueda_year
|
||||
|
||||
buscando = self.busqueda_texto.capitalize()
|
||||
logger.debug("[Tmdb.py] Searching %s on page %s:\n%s" % (buscando, page, url))
|
||||
|
||||
@@ -613,7 +613,7 @@ def set_context_commands(item, item_url, parent_item, **kwargs):
|
||||
|
||||
context_commands.append( (config.get_localized_string(70561), "Container.Update (%s?%s&%s)" % (sys.argv[0], item_url, 'channel=search&action=from_context&search_type=list&page=1&list_type=%s/%s/similar' % (mediatype, item.infoLabels['tmdb_id']))))
|
||||
|
||||
if item.channel != "videolibrary":
|
||||
if item.channel != "videolibrary" and item.videolibrary != False:
|
||||
# Add Series to the video library
|
||||
if item.action in ["episodios", "get_episodios", "get_seasons"] and item.contentSerieName:
|
||||
context_commands.append((config.get_localized_string(60352), "RunPlugin(%s?%s&%s)" % (sys.argv[0], item_url, 'action=add_serie_to_library&from_action=' + item.action)))
|
||||
|
||||
Reference in New Issue
Block a user