Fix Rai Play e altri piccoli fix

This commit is contained in:
Alhaziel01
2021-02-05 12:27:49 +01:00
parent 213a573d10
commit 709cb616e7
6 changed files with 48 additions and 27 deletions

View File

@@ -5,7 +5,8 @@
import requests, sys, inspect
from core import support
from platformcode import autorenumber, logger
from platformcode import autorenumber, logger, platformtools
from collections import OrderedDict
if sys.version_info[0] >= 3:
from concurrent import futures
else:
@@ -17,19 +18,19 @@ onair = host + '/palinsesto/onAir.json'
@support.menu
def mainlist(item):
top = [('Dirette {bold}', ['/dl/RaiPlay/2016/PublishingBlock-9a2ff311-fcf0-4539-8f8f-c4fee2a71d58.html?json', 'live']),
top = [('Dirette {bold}', ['', 'live']),
('Replay {bold}', ['/dl/RaiPlay/2016/PublishingBlock-9a2ff311-fcf0-4539-8f8f-c4fee2a71d58.html?json', 'replay_menu'])]
menu = [('Film {bullet bold}', ['/film/index.json', 'menu']),
('Serie TV {bullet bold}', ['/serietv/index.json', 'menu']),
('Fiction {bullet bold}', ['/fiction/index.json', 'menu']),
('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'])
menu = [('Film {bullet bold}', ['/tipologia/film/index.json', 'menu']),
('Serie TV {bullet bold}', ['/tipologia/serietv/index.json', 'menu']),
('Fiction {bullet bold}', ['/tipologia/fiction/index.json', 'menu']),
('Documentari {bullet bold}', ['/tipologia/documentari/index.json', 'menu']),
('Programmi TV{bullet bold}', ['/tipologia/programmi/index.json', 'menu']),
('Programmi per Bambini {bullet bold}', ['/tipologia/bambini/index.json', 'menu']),
('Teen {bullet bold}', ['/tipologia/teen/index.json', 'learning']),
('Learning {bullet bold}', ['/tipologia/learning/index.json', 'learning']),
('Teche Rai {bullet bold storia}', ['/tipologia/techerai/index.json', 'menu']),
('Musica e Teatro {bullet bold}', ['/tipologia/musica-e-teatro/index.json', 'menu'])
]
search = ''
@@ -157,24 +158,33 @@ def Type(item):
return select(item)
def live(item):
support.info()
itemlist =[]
info={}
json = current_session.get(item.url).json()['dirette']
def liveDict():
livedict = OrderedDict({})
info = {}
url = host + '/dl/RaiPlay/2016/PublishingBlock-9a2ff311-fcf0-4539-8f8f-c4fee2a71d58.html?json'
json = current_session.get(url).json()['dirette']
onAir = current_session.get(onair).json()['on_air']
support.info(onAir)
for key in onAir:
channel = key['channel']
info[channel] = {}
info[channel]['fanart'] = getUrl(key['currentItem']['image'])
info[channel]['plot'] = support.typo(key['currentItem']['name'],'bold')+ '\n\n' + key['currentItem']['description']
for i, key in enumerate(json):
for key in json:
channel = key['channel']
itemlist.append(item.clone(title = support.typo(channel, 'bold'), fulltitle = channel, show = channel, url = key['video']['contentUrl'],
thumbnail = key['transparent-icon'].replace("[RESOLUTION]", "256x-"), forcethumb = True , fanart = info[channel]['fanart'],
plot = info[channel]['plot'], action = 'play', no_return=True))
livedict[channel] = {}
livedict[channel]['url'] = key['video']['contentUrl']
livedict[channel]['plot'] = info[channel]['plot']
livedict[channel]['fanart'] = info[channel]['fanart']
return livedict
def live(item):
support.info()
itemlist =[]
for channel, value in liveDict().items():
itemlist.append(item.clone(title = support.typo(channel, 'bold'), fulltitle = channel, show = channel, url = value['url'],
plot = value['plot'], action = 'play', fanart = value['fanart'], no_return=True))
return support.thumb(itemlist, live=True)
@@ -350,7 +360,7 @@ def getUrl(pathId):
if url.endswith(".html?json"):
url = url.replace(".html?json", ".json")
elif url.endswith("/?json"):
url = url.replace("/?json","/index.json")
url = url.replace("/?json",".json")
elif url.endswith("?json"):
url = url.replace("?json",".json")
@@ -407,3 +417,11 @@ def load_episodes(key, item):
return itemlist
def play(item):
item.forcethumb=True
item.no_return=True
if item.filter:
d = liveDict()
item.clone(fulltitle = item.filter, url = d[item.filter]['url'], plot = d[item.filter]['plot'], forcethumb=True, no_return=True)
support.thumb(item, live=True)
return platformtools.play_video(item)

View File

@@ -1367,7 +1367,7 @@ def thumb(item_itemlist_string=None, genre=False, live=False):
for item in item_itemlist_string:
item.thumbnail = "https://raw.githubusercontent.com/kodiondemand/media/master/live/" + item.fulltitle.lower().replace(' ','_') + '.png'
else:
item_itemlist_string.thumbnail = "https://raw.githubusercontent.com/kodiondemand/media/master/live/" + item.fulltitle.lower().replace(' ','_') + '.png'
item_itemlist_string.thumbnail = "https://raw.githubusercontent.com/kodiondemand/media/master/live/" + item_itemlist_string.fulltitle.lower().replace(' ','_') + '.png'
return item_itemlist_string
icon_dict = {'movie':['film', 'movie'],

View File

@@ -500,7 +500,7 @@ def save_tvshow(item, episodelist, silent=False):
if not filetools.exists(tvshow_path):
# We create tvshow.nfo, if it does not exist, with the head_nfo, series info and watched episode marks
logger.debug("Creating tvshow.nfo: " + tvshow_path)
head_nfo = scraper.get_nfo(item, search_groups=True, episodelist=episodelist)
head_nfo = scraper.get_nfo(item, search_groups=True)
if not head_nfo:
return 0, 0, 0, ''
item.infoLabels['mediatype'] = "tvshow"

View File

@@ -200,6 +200,7 @@ def run(item=None):
if hasattr(channel, 'play'):
logger.debug("Executing channel 'play' method")
itemlist = channel.play(item)
if not itemlist: return
b_favourite = item.isFavourite
# Play should return a list of playable URLS
if len(itemlist) > 0 and isinstance(itemlist[0], Item):

View File

@@ -1462,7 +1462,7 @@ def prevent_busy(item):
if not item.autoplay and not item.window:
if item.globalsearch: xbmc.Player().play(os.path.join(config.get_runtime_path(), "resources", "kod.mp4"))
else: xbmcplugin.setResolvedUrl(int(sys.argv[1]), True, xbmcgui.ListItem(path=os.path.join(config.get_runtime_path(), "resources", "kod.mp4")))
xbmc.sleep(100)
xbmc.sleep(200)
xbmc.Player().stop()
# xbmc.executebuiltin('Action(Stop)')
# xbmc.sleep(500)

View File

@@ -559,6 +559,8 @@ def play(item):
else:
itemlist = [item.clone(url=item.url, server="local")]
if not itemlist:
return []
# For direct links in list format
if isinstance(itemlist[0], list):
item.video_urls = itemlist