Fix Streaming Community
This commit is contained in:
@@ -3,11 +3,14 @@
|
|||||||
# Canale per StreamingCommunity
|
# Canale per StreamingCommunity
|
||||||
# ------------------------------------------------------------
|
# ------------------------------------------------------------
|
||||||
import functools
|
import functools
|
||||||
import json, requests, sys
|
import json, requests, re, sys
|
||||||
from channels.mediasetplay import Token
|
|
||||||
from core import support, channeltools, httptools, jsontools, filetools
|
from core import support, channeltools, httptools, jsontools, filetools
|
||||||
from platformcode import logger, config, platformtools
|
from platformcode import logger, config, platformtools
|
||||||
|
|
||||||
|
if sys.version_info[0] >= 3:
|
||||||
|
from concurrent import futures
|
||||||
|
else:
|
||||||
|
from concurrent_py2 import futures
|
||||||
|
|
||||||
# def findhost(url):
|
# def findhost(url):
|
||||||
# return 'https://' + support.match(url, patron='var domain\s*=\s*"([^"]+)').match
|
# return 'https://' + support.match(url, patron='var domain\s*=\s*"([^"]+)').match
|
||||||
@@ -115,6 +118,7 @@ def peliculas(item):
|
|||||||
|
|
||||||
global host
|
global host
|
||||||
itemlist = []
|
itemlist = []
|
||||||
|
items = []
|
||||||
recordlist = []
|
recordlist = []
|
||||||
videoType = 'movie' if item.contentType == 'movie' else 'tv'
|
videoType = 'movie' if item.contentType == 'movie' else 'tv'
|
||||||
|
|
||||||
@@ -143,10 +147,16 @@ def peliculas(item):
|
|||||||
|
|
||||||
for i, it in enumerate(js):
|
for i, it in enumerate(js):
|
||||||
if i < 20:
|
if i < 20:
|
||||||
itemlist.append(makeItem(i, it, item))
|
items.append(it)
|
||||||
else:
|
else:
|
||||||
recordlist.append(it)
|
recordlist.append(it)
|
||||||
|
|
||||||
|
with futures.ThreadPoolExecutor() as executor:
|
||||||
|
itlist = [executor.submit(makeItem, i, it, item) for i, it in enumerate(items)]
|
||||||
|
for res in futures.as_completed(itlist):
|
||||||
|
if res.result():
|
||||||
|
itemlist.append(res.result())
|
||||||
|
|
||||||
itemlist.sort(key=lambda item: item.n)
|
itemlist.sort(key=lambda item: item.n)
|
||||||
if not item.newest:
|
if not item.newest:
|
||||||
if recordlist:
|
if recordlist:
|
||||||
@@ -160,10 +170,9 @@ def peliculas(item):
|
|||||||
|
|
||||||
def makeItem(n, it, item):
|
def makeItem(n, it, item):
|
||||||
info = session.post(host + '/api/titles/preview/{}'.format(it['id']), headers=headers).json()
|
info = session.post(host + '/api/titles/preview/{}'.format(it['id']), headers=headers).json()
|
||||||
title, lang = support.match(info['name'], patron=r'([^\[|$]+)(?:\[([^\]]+)\])?').match
|
title = info['name']
|
||||||
title = support.cleantitle(title)
|
lang = 'Sub-ITA' if 'sub-ita' in title.lower() else 'ITA'
|
||||||
if not lang:
|
title = support.cleantitle(re.sub('\[|\]|[Ss][Uu]Bb]-[Ii][Tt][Aa]', '', title))
|
||||||
lang = 'ITA'
|
|
||||||
itm = item.clone(title=support.typo(title,'bold') + support.typo(lang,'_ [] color kod bold'))
|
itm = item.clone(title=support.typo(title,'bold') + support.typo(lang,'_ [] color kod bold'))
|
||||||
itm.contentType = info['type'].replace('tv', 'tvshow')
|
itm.contentType = info['type'].replace('tv', 'tvshow')
|
||||||
itm.language = lang
|
itm.language = lang
|
||||||
|
|||||||
Reference in New Issue
Block a user