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
+42 -24
View File
@@ -5,7 +5,8 @@
import requests, sys, inspect import requests, sys, inspect
from core import support 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: if sys.version_info[0] >= 3:
from concurrent import futures from concurrent import futures
else: else:
@@ -17,19 +18,19 @@ onair = host + '/palinsesto/onAir.json'
@support.menu @support.menu
def mainlist(item): 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'])] ('Replay {bold}', ['/dl/RaiPlay/2016/PublishingBlock-9a2ff311-fcf0-4539-8f8f-c4fee2a71d58.html?json', 'replay_menu'])]
menu = [('Film {bullet bold}', ['/film/index.json', 'menu']), menu = [('Film {bullet bold}', ['/tipologia/film/index.json', 'menu']),
('Serie TV {bullet bold}', ['/serietv/index.json', 'menu']), ('Serie TV {bullet bold}', ['/tipologia/serietv/index.json', 'menu']),
('Fiction {bullet bold}', ['/fiction/index.json', 'menu']), ('Fiction {bullet bold}', ['/tipologia/fiction/index.json', 'menu']),
('Documentari {bullet bold}', ['/documentari/index.json', 'menu']), ('Documentari {bullet bold}', ['/tipologia/documentari/index.json', 'menu']),
('Programmi TV{bullet bold}', ['/programmi/index.json', 'menu']), ('Programmi TV{bullet bold}', ['/tipologia/programmi/index.json', 'menu']),
('Programmi per Bambini {bullet bold}', ['/bambini/index.json', 'menu']), ('Programmi per Bambini {bullet bold}', ['/tipologia/bambini/index.json', 'menu']),
('Teen {bullet bold}', ['/teen/index.json', 'learning']), ('Teen {bullet bold}', ['/tipologia/teen/index.json', 'learning']),
('Learning {bullet bold}', ['/learning/index.json', 'learning']), ('Learning {bullet bold}', ['/tipologia/learning/index.json', 'learning']),
('Teche Rai {bullet bold storia}', ['/techerai/index.json', 'menu']), ('Teche Rai {bullet bold storia}', ['/tipologia/techerai/index.json', 'menu']),
('Musica e Teatro {bullet bold}', ['/performing-arts/index.json', 'menu']) ('Musica e Teatro {bullet bold}', ['/tipologia/musica-e-teatro/index.json', 'menu'])
] ]
search = '' search = ''
@@ -157,24 +158,33 @@ def Type(item):
return select(item) return select(item)
def live(item): def liveDict():
support.info() livedict = OrderedDict({})
itemlist =[] info = {}
info={} url = host + '/dl/RaiPlay/2016/PublishingBlock-9a2ff311-fcf0-4539-8f8f-c4fee2a71d58.html?json'
json = current_session.get(item.url).json()['dirette'] json = current_session.get(url).json()['dirette']
onAir = current_session.get(onair).json()['on_air'] onAir = current_session.get(onair).json()['on_air']
support.info(onAir)
for key in onAir: for key in onAir:
channel = key['channel'] channel = key['channel']
info[channel] = {} info[channel] = {}
info[channel]['fanart'] = getUrl(key['currentItem']['image']) info[channel]['fanart'] = getUrl(key['currentItem']['image'])
info[channel]['plot'] = support.typo(key['currentItem']['name'],'bold')+ '\n\n' + key['currentItem']['description'] info[channel]['plot'] = support.typo(key['currentItem']['name'],'bold')+ '\n\n' + key['currentItem']['description']
for key in json:
for i, key in enumerate(json):
channel = key['channel'] channel = key['channel']
itemlist.append(item.clone(title = support.typo(channel, 'bold'), fulltitle = channel, show = channel, url = key['video']['contentUrl'], livedict[channel] = {}
thumbnail = key['transparent-icon'].replace("[RESOLUTION]", "256x-"), forcethumb = True , fanart = info[channel]['fanart'], livedict[channel]['url'] = key['video']['contentUrl']
plot = info[channel]['plot'], action = 'play', no_return=True)) 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) return support.thumb(itemlist, live=True)
@@ -350,7 +360,7 @@ def getUrl(pathId):
if url.endswith(".html?json"): if url.endswith(".html?json"):
url = url.replace(".html?json", ".json") url = url.replace(".html?json", ".json")
elif url.endswith("/?json"): elif url.endswith("/?json"):
url = url.replace("/?json","/index.json") url = url.replace("/?json",".json")
elif url.endswith("?json"): elif url.endswith("?json"):
url = url.replace("?json",".json") url = url.replace("?json",".json")
@@ -407,3 +417,11 @@ def load_episodes(key, item):
return itemlist 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)
+1 -1
View File
@@ -1367,7 +1367,7 @@ def thumb(item_itemlist_string=None, genre=False, live=False):
for item in item_itemlist_string: for item in item_itemlist_string:
item.thumbnail = "https://raw.githubusercontent.com/kodiondemand/media/master/live/" + item.fulltitle.lower().replace(' ','_') + '.png' item.thumbnail = "https://raw.githubusercontent.com/kodiondemand/media/master/live/" + item.fulltitle.lower().replace(' ','_') + '.png'
else: 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 return item_itemlist_string
icon_dict = {'movie':['film', 'movie'], icon_dict = {'movie':['film', 'movie'],
+1 -1
View File
@@ -500,7 +500,7 @@ def save_tvshow(item, episodelist, silent=False):
if not filetools.exists(tvshow_path): 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 # 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) 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: if not head_nfo:
return 0, 0, 0, '' return 0, 0, 0, ''
item.infoLabels['mediatype'] = "tvshow" item.infoLabels['mediatype'] = "tvshow"
+1
View File
@@ -200,6 +200,7 @@ def run(item=None):
if hasattr(channel, 'play'): if hasattr(channel, 'play'):
logger.debug("Executing channel 'play' method") logger.debug("Executing channel 'play' method")
itemlist = channel.play(item) itemlist = channel.play(item)
if not itemlist: return
b_favourite = item.isFavourite b_favourite = item.isFavourite
# Play should return a list of playable URLS # Play should return a list of playable URLS
if len(itemlist) > 0 and isinstance(itemlist[0], Item): if len(itemlist) > 0 and isinstance(itemlist[0], Item):
+1 -1
View File
@@ -1462,7 +1462,7 @@ def prevent_busy(item):
if not item.autoplay and not item.window: if not item.autoplay and not item.window:
if item.globalsearch: xbmc.Player().play(os.path.join(config.get_runtime_path(), "resources", "kod.mp4")) 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"))) 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.Player().stop()
# xbmc.executebuiltin('Action(Stop)') # xbmc.executebuiltin('Action(Stop)')
# xbmc.sleep(500) # xbmc.sleep(500)
+2
View File
@@ -559,6 +559,8 @@ def play(item):
else: else:
itemlist = [item.clone(url=item.url, server="local")] itemlist = [item.clone(url=item.url, server="local")]
if not itemlist:
return []
# For direct links in list format # For direct links in list format
if isinstance(itemlist[0], list): if isinstance(itemlist[0], list):
item.video_urls = itemlist item.video_urls = itemlist