Rai Play: Ordine corretto
This commit is contained in:
@@ -7,7 +7,7 @@ from core.item import Item
|
|||||||
import datetime, xbmc
|
import datetime, xbmc
|
||||||
import requests, sys
|
import requests, sys
|
||||||
|
|
||||||
from core import jsontools, support
|
from core import jsontools, scrapertools, support
|
||||||
from platformcode import logger
|
from platformcode import logger
|
||||||
|
|
||||||
if sys.version_info[0] >= 3:
|
if sys.version_info[0] >= 3:
|
||||||
@@ -114,7 +114,7 @@ def episodios(item):
|
|||||||
|
|
||||||
if not itemlist:
|
if not itemlist:
|
||||||
itemlist = addinfo(items, item)
|
itemlist = addinfo(items, item)
|
||||||
|
# itemlist.sort(key=lambda it: (it.season, it.episode))
|
||||||
return itemlist
|
return itemlist
|
||||||
|
|
||||||
|
|
||||||
@@ -126,6 +126,7 @@ def epMenu(item):
|
|||||||
itemlist.append(item.clone(title=support.typo(it['name'], 'bold'), data=[it]))
|
itemlist.append(item.clone(title=support.typo(it['name'], 'bold'), data=[it]))
|
||||||
else:
|
else:
|
||||||
itemlist.append(item.clone(title=support.typo(it['name'], 'bold'), season_url=getUrl(it['path_id']), data=''))
|
itemlist.append(item.clone(title=support.typo(it['name'], 'bold'), season_url=getUrl(it['path_id']), data=''))
|
||||||
|
# itemlist.sort(key=lambda it: it.title)
|
||||||
return itemlist
|
return itemlist
|
||||||
|
|
||||||
|
|
||||||
@@ -195,6 +196,7 @@ def replayChannels(item):
|
|||||||
support.thumb(itemlist, live=True)
|
support.thumb(itemlist, live=True)
|
||||||
return itemlist
|
return itemlist
|
||||||
|
|
||||||
|
|
||||||
def replay(item):
|
def replay(item):
|
||||||
logger.debug()
|
logger.debug()
|
||||||
|
|
||||||
@@ -226,6 +228,7 @@ def replay(item):
|
|||||||
itemlist.sort(key=lambda it: it.title)
|
itemlist.sort(key=lambda it: it.title)
|
||||||
return itemlist
|
return itemlist
|
||||||
|
|
||||||
|
|
||||||
def play(item):
|
def play(item):
|
||||||
logger.debug()
|
logger.debug()
|
||||||
|
|
||||||
@@ -258,20 +261,36 @@ def getUrl(url):
|
|||||||
|
|
||||||
|
|
||||||
def addinfo(items, item):
|
def addinfo(items, item):
|
||||||
def itInfo(key, item):
|
def itInfo(n, key, item):
|
||||||
logger.debug(jsontools.dump(key))
|
logger.debug()
|
||||||
item.forcethumb = True
|
item.forcethumb = True
|
||||||
|
episode = 0
|
||||||
|
season = 0
|
||||||
if key.get('titolo', ''):
|
if key.get('titolo', ''):
|
||||||
key = requests.get(getUrl(key['path_id'])).json()['program_info']
|
key = requests.get(getUrl(key['path_id'])).json()['program_info']
|
||||||
|
|
||||||
|
|
||||||
info = requests.get(getUrl(key['info_url'])).json() if 'info_url' in key else {}
|
info = requests.get(getUrl(key['info_url'])).json() if 'info_url' in key else {}
|
||||||
|
details = info.get('details',{})
|
||||||
|
for detail in details:
|
||||||
|
if detail['key'] == 'season':
|
||||||
|
s = scrapertools.find_single_match(detail['value'], '(\d+)')
|
||||||
|
if s: season = int(s)
|
||||||
|
if detail['key'] == 'episode':
|
||||||
|
e = scrapertools.find_single_match(detail['value'], '(\d+)')
|
||||||
|
if e: episode = int(e)
|
||||||
|
|
||||||
images = info.get('images', {})
|
images = info.get('images', {})
|
||||||
fanart = images.get('landscape', '')
|
fanart = images.get('landscape', '')
|
||||||
thumb = images.get('portrait_logo', '')
|
thumb = images.get('portrait_logo', '')
|
||||||
if not thumb: thumb = fanart
|
if not thumb: thumb = fanart
|
||||||
title = key.get('name', '')
|
title = key.get('name', '')
|
||||||
|
if key.get('episode_title'):
|
||||||
|
title = key.get('episode_title')
|
||||||
|
if episode:
|
||||||
|
title = '{:02d}. {}'.format(episode, title)
|
||||||
|
if season:
|
||||||
|
title = '{}x{}'.format(season, title)
|
||||||
|
|
||||||
it = item.clone(title=support.typo(title, 'bold'),
|
it = item.clone(title=support.typo(title, 'bold'),
|
||||||
data='',
|
data='',
|
||||||
@@ -281,7 +300,10 @@ def addinfo(items, item):
|
|||||||
fanart=getUrl(fanart),
|
fanart=getUrl(fanart),
|
||||||
url=getUrl(key.get('weblink', '')),
|
url=getUrl(key.get('weblink', '')),
|
||||||
video_url=getUrl(key['path_id']),
|
video_url=getUrl(key['path_id']),
|
||||||
plot=info.get('description', ''))
|
season=season,
|
||||||
|
episode=episode,
|
||||||
|
plot=info.get('description', ''),
|
||||||
|
order=n)
|
||||||
|
|
||||||
if 'Genere' not in key.get('sub_type', '') and ('layout' not in key or key['layout'] == 'single'):
|
if 'Genere' not in key.get('sub_type', '') and ('layout' not in key or key['layout'] == 'single'):
|
||||||
it.action = 'play'
|
it.action = 'play'
|
||||||
@@ -293,8 +315,9 @@ def addinfo(items, item):
|
|||||||
|
|
||||||
itemlist = []
|
itemlist = []
|
||||||
with futures.ThreadPoolExecutor() as executor:
|
with futures.ThreadPoolExecutor() as executor:
|
||||||
itlist = [executor.submit(itInfo, it, item) for it in items]
|
itlist = [executor.submit(itInfo, n, it, item) for n, it in enumerate(items)]
|
||||||
for res in futures.as_completed(itlist):
|
for res in futures.as_completed(itlist):
|
||||||
if res.result():
|
if res.result():
|
||||||
itemlist.append(res.result())
|
itemlist.append(res.result())
|
||||||
|
itemlist.sort(key=lambda it: it.order)
|
||||||
return itemlist
|
return itemlist
|
||||||
Reference in New Issue
Block a user