Riscritto News e fix vari
This commit is contained in:
+1
-1
@@ -6,7 +6,7 @@
|
|||||||
"animeforce": "https://www.animeforce.it",
|
"animeforce": "https://www.animeforce.it",
|
||||||
"animeleggendari": "https://animezeus.com",
|
"animeleggendari": "https://animezeus.com",
|
||||||
"animesaturn": "https://www.animesaturn.it",
|
"animesaturn": "https://www.animesaturn.it",
|
||||||
"animeunity": "https://www.animeunity.it",
|
"animeunity": "https://www.animeunity.tv",
|
||||||
"animeuniverse": "https://www.animeuniverse.it",
|
"animeuniverse": "https://www.animeuniverse.it",
|
||||||
"animeworld": "https://www.animeworld.tv",
|
"animeworld": "https://www.animeworld.tv",
|
||||||
"aniplay": "https://aniplay.it",
|
"aniplay": "https://aniplay.it",
|
||||||
|
|||||||
@@ -2,47 +2,190 @@
|
|||||||
# ------------------------------------------------------------
|
# ------------------------------------------------------------
|
||||||
# Canale per Altadefinizione Community
|
# Canale per Altadefinizione Community
|
||||||
|
|
||||||
from core import jsontools, support
|
from core import support
|
||||||
from lib.fakeMail import Gmailnator
|
from lib.fakeMail import Gmailnator
|
||||||
from platformcode import config, platformtools, logger
|
from platformcode import config, platformtools, logger
|
||||||
from core import scrapertools, httptools
|
from core import scrapertools, httptools
|
||||||
|
|
||||||
|
|
||||||
def findhost(url):
|
def findhost(url):
|
||||||
global register_url
|
|
||||||
register_url = url
|
|
||||||
return support.match(url, patron=r'<a href="([^"]+)/\w+">Accedi').match
|
return support.match(url, patron=r'<a href="([^"]+)/\w+">Accedi').match
|
||||||
|
|
||||||
|
|
||||||
host = config.get_channel_url(findhost)
|
host = config.get_channel_url(findhost)
|
||||||
# register_url = 'https://altaregistrazione.com'
|
register_url = 'https://altaregistrazione.net'
|
||||||
headers = {'Referer': host, 'x-requested-with': 'XMLHttpRequest'}
|
|
||||||
|
if 'altadefinizionecommunity' not in host:
|
||||||
|
config.get_channel_url(findhost, forceFindhost=True)
|
||||||
|
|
||||||
|
if host.endswith('/'):
|
||||||
|
host = host[:-1]
|
||||||
|
|
||||||
|
headers = {'Referer': host}
|
||||||
|
order = ['', 'i_piu_visti', 'i_piu_votati', 'i_piu_votati_dellultimo_mese', 'titolo_az', 'voto_imdb_piu_alto'][config.get_setting('order', 'altadefinizionecommunity')]
|
||||||
|
|
||||||
|
|
||||||
@support.menu
|
@support.menu
|
||||||
def mainlist(item):
|
def mainlist(item):
|
||||||
logger.debug(item)
|
logger.debug(item)
|
||||||
|
|
||||||
film = ['/load-more-film?anno=&order=&support_webp=1&type=movie&page=1',
|
film = ['/type/movie',
|
||||||
# Voce Menu,['url','action','args',contentType]
|
('Generi', ['/type/movie', 'genres', 'genres']),
|
||||||
('Generi Film', ['', 'genres', 'genres']),
|
('Anni', ['/type/movie', 'genres', 'year']),]
|
||||||
]
|
|
||||||
|
|
||||||
tvshow = ['/load-more-film?type=tvshow&anno=&order=&support_webp=1&page=1',
|
tvshow = ['/serie-tv/tvshow',
|
||||||
# Voce Menu,['url','action','args',contentType]
|
('Generi', ['/serie-tv/tvshow', 'genres', 'genres']),
|
||||||
('Generi Serie TV', ['', 'genres', 'genres']),
|
('Anni', ['/serie-tv/tvshow', 'genres', 'year'])]
|
||||||
]
|
|
||||||
|
|
||||||
altri = [
|
|
||||||
# ('A-Z', ['/lista-film', 'genres', 'letters']),
|
|
||||||
('Qualità', ['', 'genres', 'quality']),
|
|
||||||
('Anni', ['/anno', 'genres', 'years'])
|
|
||||||
]
|
|
||||||
search = ''
|
|
||||||
|
|
||||||
return locals()
|
return locals()
|
||||||
|
|
||||||
|
|
||||||
|
def search(item, text):
|
||||||
|
logger.debug("search ", text)
|
||||||
|
# per evitare fastidi da ricerca globale
|
||||||
|
if not item.globalsearch:
|
||||||
|
registerOrLogin()
|
||||||
|
|
||||||
|
item.args = 'search'
|
||||||
|
item.url = host + "/search?s={}&f={}".format(text.replace(' ', '+'), item.contentType)
|
||||||
|
try:
|
||||||
|
return movies(item)
|
||||||
|
|
||||||
|
# Continua la ricerca in caso di errore
|
||||||
|
except:
|
||||||
|
import sys
|
||||||
|
for line in sys.exc_info():
|
||||||
|
support.logger.error("%s" % line)
|
||||||
|
return []
|
||||||
|
|
||||||
|
|
||||||
|
@support.scrape
|
||||||
|
def genres(item):
|
||||||
|
registerOrLogin()
|
||||||
|
logger.debug(item)
|
||||||
|
data = support.httptools.downloadpage(item.url).data
|
||||||
|
blacklist= ['Film', 'Serie TV']
|
||||||
|
|
||||||
|
if item.args == 'genres':
|
||||||
|
categories ={}
|
||||||
|
res = support.match(host + '/cerca', patron=r'for="cat-(\d+)[^>]+>([^<]+)').matches
|
||||||
|
for _id, name in res:
|
||||||
|
categories[name] = _id
|
||||||
|
|
||||||
|
patronBlock = r'{}<span></span>(?P<block>.*?)</ul>\s*</li'.format('Film' if item.contentType == 'movie' else 'Serie TV')
|
||||||
|
patronMenu = r'<a href="[^"]+">(?P<title>[^<]+)'
|
||||||
|
|
||||||
|
def itemHook(it):
|
||||||
|
it.cat_id = categories[it.fulltitle]
|
||||||
|
return it
|
||||||
|
|
||||||
|
if item.args == 'year':
|
||||||
|
patronMenu = r'value="(?P<year_id>[^"]+)"[^>]*>(?P<title>\d+)'
|
||||||
|
patronBlock = r'Anno</option>(?P<block>.*?</select>)'
|
||||||
|
|
||||||
|
elif item.args == 'quality':
|
||||||
|
patronMenu = r'quality/(?P<quality_id>[^"]+)">(?P<title>[^<]+)'
|
||||||
|
patronBlock = r'Risoluzione(?P<block>.*?)</ul>'
|
||||||
|
|
||||||
|
action = 'movies'
|
||||||
|
return locals()
|
||||||
|
|
||||||
|
|
||||||
|
@support.scrape
|
||||||
|
def movies(item):
|
||||||
|
item.quality = 'HD'
|
||||||
|
json = {}
|
||||||
|
if not item.page: item.page = 1
|
||||||
|
params ={'type':item.contentType, 'anno':item.year_id, 'quality':item.quality_id, 'cat':item.cat_id, 'order':order, 'page':item.page}
|
||||||
|
# debug = True
|
||||||
|
|
||||||
|
action = 'findvideos' if item.contentType == 'movie' else 'episodes'
|
||||||
|
|
||||||
|
try:
|
||||||
|
# support.dbg()
|
||||||
|
if item.args in ['search']:
|
||||||
|
page = support.httptools.downloadpage(item.url, headers=headers)
|
||||||
|
if page.json:
|
||||||
|
data = "\n".join(page.json['data'])
|
||||||
|
else:
|
||||||
|
data = page.data
|
||||||
|
else:
|
||||||
|
params['page'] = item.page
|
||||||
|
|
||||||
|
url = '{}/load-more-film?{}'.format(host, support.urlencode(params))
|
||||||
|
json = support.httptools.downloadpage(url, headers=headers).json
|
||||||
|
data = "\n".join(json['data'])
|
||||||
|
except:
|
||||||
|
data = ' '
|
||||||
|
|
||||||
|
patron = r'wrapFilm"[^>]*>\s*<a href="(?P<url>[^"]+)">[^>]+>(?P<year>\d+)(?:[^>]+>){2}(?P<rating>[^<]+)(?:[^>]+>){4}\s*<img src="(?P<thumb>[^"]+)(?:[^>]+>){2,6}\s+<h3>(?P<title>[^<[]+)(?:\[(?P<lang>[sSuUbBiItTaA -]+))?'
|
||||||
|
# patron = r'wrapFilm">\s*<a href="(?P<url>[^"]+)">[^>]+>(?P<year>\d+)(?:[^>]+>){2}(?P<rating>[^<]+)(?:[^>]+>){4}\s*<img src="(?P<thumb>[^"]+)(?:[^>]+>){3}(?P<title>[^<[]+)(?:\[(?P<lang>[sSuUbBiItTaA-]+))?'
|
||||||
|
|
||||||
|
def itemHook(item):
|
||||||
|
item.quality = item.quality.replace('2K', 'HD').replace('4K', 'HD')
|
||||||
|
item.title = item.title.replace('2K', 'HD').replace('4K', 'HD')
|
||||||
|
return item
|
||||||
|
|
||||||
|
# paginazione
|
||||||
|
if json.get('have_next') or support.match(data, patron=r'have_next_film\s*=\s*true').match:
|
||||||
|
def fullItemlistHook(itemlist):
|
||||||
|
cat_id = support.match(data, patron=r''''cat':"(\d+)"''').match
|
||||||
|
if cat_id: item.cat_id = cat_id
|
||||||
|
item.page += 1
|
||||||
|
support.nextPage(itemlist, item, function_or_level='movies')
|
||||||
|
return itemlist
|
||||||
|
|
||||||
|
return locals()
|
||||||
|
|
||||||
|
|
||||||
|
@support.scrape
|
||||||
|
def episodes(item):
|
||||||
|
logger.debug(item)
|
||||||
|
# debug = True
|
||||||
|
data = item.data
|
||||||
|
patron = r'class="playtvshow "\s+data-href="(?P<url>[^"]+)'
|
||||||
|
|
||||||
|
def itemHook(it):
|
||||||
|
spl = it.url.split('/')[-2:]
|
||||||
|
it.infoLabels['season'] = int(spl[0])+1
|
||||||
|
it.infoLabels['episode'] = int(spl[1])+1
|
||||||
|
it.url = it.url.replace('/watch-unsubscribed', '/watch-external')
|
||||||
|
it.title = '{}x{:02d} - {}'.format(it.contentSeason, it.contentEpisodeNumber, it.fulltitle)
|
||||||
|
return it
|
||||||
|
|
||||||
|
return locals()
|
||||||
|
|
||||||
|
|
||||||
|
def findvideos(item):
|
||||||
|
itemlist = []
|
||||||
|
resolve_url(item)
|
||||||
|
|
||||||
|
itemlist.append(item.clone(action='play', url=support.match(item.url, patron='allowfullscreen[^<]+src="([^"]+)"', cloudscraper=True).match, quality=''))
|
||||||
|
|
||||||
|
return support.server(item, itemlist=itemlist)
|
||||||
|
|
||||||
|
|
||||||
|
def play(item):
|
||||||
|
if host in item.url: # intercetto il server proprietario
|
||||||
|
# if registerOrLogin():
|
||||||
|
return support.get_jwplayer_mediaurl(support.httptools.downloadpage(item.url, cloudscraper=True).data, 'Diretto')
|
||||||
|
# else:
|
||||||
|
# platformtools.play_canceled = True
|
||||||
|
# return []
|
||||||
|
else:
|
||||||
|
return [item]
|
||||||
|
|
||||||
|
|
||||||
|
def resolve_url(item):
|
||||||
|
registerOrLogin()
|
||||||
|
if '/watch-unsubscribed' not in item.url and '/watch-external' not in item.url:
|
||||||
|
playWindow = support.match(support.httptools.downloadpage(item.url, cloudscraper=True).data, patron='playWindow" href="([^"]+)')
|
||||||
|
video_url = playWindow.match
|
||||||
|
item.data = playWindow.data
|
||||||
|
item.url = video_url.replace('/watch-unsubscribed', '/watch-external')
|
||||||
|
return item
|
||||||
|
|
||||||
|
|
||||||
def login():
|
def login():
|
||||||
r = support.httptools.downloadpage(host, cloudscraper=True)
|
r = support.httptools.downloadpage(host, cloudscraper=True)
|
||||||
Token = support.match(r.data, patron=r'name=\s*"_token"\s*value=\s*"([^"]+)', cloudscraper=True).match
|
Token = support.match(r.data, patron=r'name=\s*"_token"\s*value=\s*"([^"]+)', cloudscraper=True).match
|
||||||
@@ -51,12 +194,12 @@ def login():
|
|||||||
else:
|
else:
|
||||||
logger.info('Login in corso')
|
logger.info('Login in corso')
|
||||||
post = {'_token': '',
|
post = {'_token': '',
|
||||||
'form_action':'login',
|
'form_action':'login',
|
||||||
'email': config.get_setting('username', channel='altadefinizionecommunity'),
|
'email': config.get_setting('username', channel='altadefinizionecommunity'),
|
||||||
'password':config.get_setting('password', channel='altadefinizionecommunity')}
|
'password':config.get_setting('password', channel='altadefinizionecommunity')}
|
||||||
|
|
||||||
r = support.httptools.downloadpage(host + '/login', post=post, headers={'referer': host}, cloudscraper=True)
|
r = support.httptools.downloadpage(host + '/login', post=post, headers={'referer': host}, cloudscraper=True)
|
||||||
if not r.status_code in [200, 302] or 'Email o Password non validi' in r.data:
|
if r.code not in [200, 302] or 'Email o Password non validi' in r.data:
|
||||||
platformtools.dialog_ok('AltadefinizioneCommunity', 'Username/password non validi')
|
platformtools.dialog_ok('AltadefinizioneCommunity', 'Username/password non validi')
|
||||||
return False
|
return False
|
||||||
|
|
||||||
@@ -127,143 +270,3 @@ def registerOrLogin():
|
|||||||
return False
|
return False
|
||||||
|
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
|
||||||
@support.scrape
|
|
||||||
def movies(item):
|
|
||||||
json = {}
|
|
||||||
# debug=True
|
|
||||||
|
|
||||||
if item.contentType == 'undefined':
|
|
||||||
# tmdbEnabled = False
|
|
||||||
action = 'check'
|
|
||||||
elif item.contentType == 'movie':
|
|
||||||
action = 'findvideos'
|
|
||||||
else:
|
|
||||||
action = 'episodes'
|
|
||||||
try:
|
|
||||||
if '/load-more-film' not in item.url and '/search' not in item.url: # generi o altri menu, converto
|
|
||||||
import ast
|
|
||||||
ajax = support.match(item.url, patron='ajax_data\s*=\s*"?\s*([^;]+)', cloudscraper=True).match
|
|
||||||
item.url = host + '/load-more-film?' + support.urlencode(ast.literal_eval(ajax)) + '&page=1'
|
|
||||||
if not '/search' in item.url:
|
|
||||||
json = support.httptools.downloadpage(item.url, headers=headers, cloudscraper=True).json
|
|
||||||
data = "\n".join(json['data'])
|
|
||||||
else:
|
|
||||||
json = support.httptools.downloadpage(item.url, headers=headers, cloudscraper=True).json
|
|
||||||
data = "\n".join(json['data'])
|
|
||||||
except:
|
|
||||||
data = ' '
|
|
||||||
|
|
||||||
patron = r'wrapFilm">\s*<a href="(?P<url>[^"]+)">\s*<span class="year">(?P<year>[0-9]{4})</span>\s*<span[^>]+>(?P<rating>[^<]+)</span>\s*<span class="qual">(?P<quality>[^<]+)(?:[^>]+>){2}\s*<img src="(?P<thumbnail>[^"]+)(?:[^>]+>){1,6}\s*<h3>(?P<title>[^<[]+)(?:\[(?P<lang>[sSuUbBiItTaA-]+))?'
|
|
||||||
|
|
||||||
# paginazione
|
|
||||||
logger.debug('JSON FIND',jsontools.load(json))
|
|
||||||
if json.get('have_next'):
|
|
||||||
def fullItemlistHook(itemlist):
|
|
||||||
spl = item.url.split('=')
|
|
||||||
url = '='.join(spl[:-1])
|
|
||||||
page = str(int(spl[-1])+1)
|
|
||||||
total_pages = json.get('lastPage', 0)
|
|
||||||
support.nextPage(itemlist, item, 'movies', next_page='='.join((url, page)), total_pages=total_pages)
|
|
||||||
return itemlist
|
|
||||||
|
|
||||||
return locals()
|
|
||||||
|
|
||||||
|
|
||||||
def search(item, texto):
|
|
||||||
logger.debug("search ", texto)
|
|
||||||
|
|
||||||
item.args = 'search'
|
|
||||||
item.url = host + "/search?s={}&page=1".format(texto)
|
|
||||||
try:
|
|
||||||
return movies(item)
|
|
||||||
# Continua la ricerca in caso di errore
|
|
||||||
except:
|
|
||||||
import sys
|
|
||||||
for line in sys.exc_info():
|
|
||||||
logger.error('{}'.format(line))
|
|
||||||
return []
|
|
||||||
|
|
||||||
|
|
||||||
@support.scrape
|
|
||||||
def genres(item):
|
|
||||||
logger.debug(item)
|
|
||||||
data = support.httptools.downloadpage(item.url, cloudscraper=True).data
|
|
||||||
blacklist = ['Film', 'Serie TV', 'Trovatore', 'Lista A-Z']
|
|
||||||
patronGenreMenu = r'<a href="(?P<url>[^"]+)">(?P<title>[^<]+)'
|
|
||||||
if item.args == 'quality':
|
|
||||||
item.contentType = 'undefined'
|
|
||||||
patronBlock = r'Risoluzione(?P<block>.*?)</ul>'
|
|
||||||
def itemlistHook(itemlist):
|
|
||||||
support.thumb(itemlist, mode='quality')
|
|
||||||
quality_list = ['4k','2k','hd','sd', '2k.md', 'hd.md', 'ts.md', 'cam']
|
|
||||||
itemlist.sort(key=lambda it: quality_list.index(it.title.lower()) if it.title.lower() in quality_list else 99)
|
|
||||||
return itemlist
|
|
||||||
elif item.args == 'years':
|
|
||||||
item.contentType = 'undefined'
|
|
||||||
patronBlock = r'ANNO(?P<block>.*?</section>)'
|
|
||||||
else:
|
|
||||||
patronBlock = ('Film' if item.contentType == 'movie' else 'Serie TV') + r'<span></span></a>\s+<ul class="dropdown-menu(?P<block>.*?)active-parent-menu'
|
|
||||||
action = 'movies'
|
|
||||||
|
|
||||||
return locals()
|
|
||||||
|
|
||||||
|
|
||||||
@support.scrape
|
|
||||||
def episodes(item):
|
|
||||||
logger.debug()
|
|
||||||
data = item.data
|
|
||||||
patron = r'class="playtvshow "\s*data-href="(?P<url>[^"]+)'
|
|
||||||
|
|
||||||
def itemHook(it):
|
|
||||||
spl = it.url.split('/')[-2:]
|
|
||||||
it.contentSeason = int(spl[0])+1
|
|
||||||
it.contentEpisodeNumber = int(spl[1])+1
|
|
||||||
it.url = it.url.replace('/watch-unsubscribed', '/watch-external')
|
|
||||||
return it
|
|
||||||
|
|
||||||
return locals()
|
|
||||||
|
|
||||||
|
|
||||||
def check(item):
|
|
||||||
resolve_url(item)
|
|
||||||
if '/tvshow' in item.url:
|
|
||||||
item.contentType = 'tvshow'
|
|
||||||
return episodes(item)
|
|
||||||
else:
|
|
||||||
item.contentType = 'movie'
|
|
||||||
return findvideos(item)
|
|
||||||
|
|
||||||
|
|
||||||
def findvideos(item):
|
|
||||||
itemlist = []
|
|
||||||
# logger.dbg()
|
|
||||||
resolve_url(item)
|
|
||||||
|
|
||||||
itemlist.append(item.clone(action='play', url=support.match(item.url, patron='allowfullscreen[^<]+src="([^"]+)"', cloudscraper=True).match, quality=''))
|
|
||||||
|
|
||||||
return support.server(item, itemlist=itemlist)
|
|
||||||
|
|
||||||
|
|
||||||
def play(item):
|
|
||||||
if host in item.url: # intercetto il server proprietario
|
|
||||||
if registerOrLogin():
|
|
||||||
return support.get_jwplayer_mediaurl(support.httptools.downloadpage(item.url, cloudscraper=True).data, 'Diretto')
|
|
||||||
else:
|
|
||||||
platformtools.play_canceled = True
|
|
||||||
return []
|
|
||||||
else:
|
|
||||||
return [item]
|
|
||||||
|
|
||||||
|
|
||||||
def resolve_url(item):
|
|
||||||
registerOrLogin()
|
|
||||||
if '/watch-unsubscribed' not in item.url and '/watch-external' not in item.url:
|
|
||||||
data = support.httptools.downloadpage(item.url, headers=headers, cloudscraper=True).data
|
|
||||||
logger.debug()
|
|
||||||
playWindow = support.match(data, patron='playWindow" href="([^"]+)')
|
|
||||||
video_url = playWindow.match
|
|
||||||
item.data = playWindow.data
|
|
||||||
item.url = video_url.replace('/watch-unsubscribed', '/watch-external')
|
|
||||||
return item
|
|
||||||
|
|||||||
+56
-57
@@ -4,7 +4,8 @@
|
|||||||
# ------------------------------------------------------------
|
# ------------------------------------------------------------
|
||||||
|
|
||||||
import cloudscraper, json, copy, inspect
|
import cloudscraper, json, copy, inspect
|
||||||
from core import jsontools, support
|
from core import jsontools, support, config
|
||||||
|
from core.httptools import downloadpage
|
||||||
from platformcode import autorenumber, logger
|
from platformcode import autorenumber, logger
|
||||||
|
|
||||||
session = cloudscraper.create_scraper()
|
session = cloudscraper.create_scraper()
|
||||||
@@ -13,10 +14,10 @@ host = support.config.get_channel_url()
|
|||||||
response = session.get(host + '/archivio')
|
response = session.get(host + '/archivio')
|
||||||
csrf_token = support.match(response.text, patron='name="csrf-token" content="([^"]+)"').match
|
csrf_token = support.match(response.text, patron='name="csrf-token" content="([^"]+)"').match
|
||||||
headers = {'content-type': 'application/json;charset=UTF-8',
|
headers = {'content-type': 'application/json;charset=UTF-8',
|
||||||
|
'Referer': host,
|
||||||
'x-csrf-token': csrf_token,
|
'x-csrf-token': csrf_token,
|
||||||
'Cookie' : '; '.join([x.name + '=' + x.value for x in response.cookies])}
|
'Cookie' : '; '.join([x.name + '=' + x.value for x in response.cookies])}
|
||||||
|
|
||||||
|
|
||||||
@support.menu
|
@support.menu
|
||||||
def mainlist(item):
|
def mainlist(item):
|
||||||
top = [('Ultimi Episodi', ['', 'news'])]
|
top = [('Ultimi Episodi', ['', 'news'])]
|
||||||
@@ -40,13 +41,13 @@ def menu(item):
|
|||||||
Terminato = copy.copy(item.args)
|
Terminato = copy.copy(item.args)
|
||||||
Terminato['status'] = 'Terminato'
|
Terminato['status'] = 'Terminato'
|
||||||
itemlist = [item.clone(title=support.typo('Tutti','bold')),
|
itemlist = [item.clone(title=support.typo('Tutti','bold')),
|
||||||
item.clone(title=support.typo('ITA','bold'), args=ITA),
|
item.clone(title='ITA', args=ITA),
|
||||||
item.clone(title=support.typo('Genere','bold'), action='genres'),
|
item.clone(title='Genere', action='genres'),
|
||||||
item.clone(title=support.typo('Anno','bold'), action='years')]
|
item.clone(title='Anno', action='years')]
|
||||||
if item.contentType == 'tvshow':
|
if item.contentType == 'tvshow':
|
||||||
itemlist += [item.clone(title=support.typo('In Corso','bold'), args=InCorso),
|
itemlist += [item.clone(title='In Corso', args=InCorso),
|
||||||
item.clone(title=support.typo('Terminato','bold'), args=Terminato)]
|
item.clone(title='Terminato', args=Terminato)]
|
||||||
itemlist +=[item.clone(title=support.typo('Cerca...','bold'), action='search', thumbnail=support.thumb('search'))]
|
itemlist +=[item.clone(title=support.typo(config.get_localized_string(70741).replace(' %s', '…'),'bold'), action='search', thumbnail=support.thumb('search'))]
|
||||||
return itemlist
|
return itemlist
|
||||||
|
|
||||||
|
|
||||||
@@ -58,7 +59,7 @@ def genres(item):
|
|||||||
|
|
||||||
for genre in genres:
|
for genre in genres:
|
||||||
item.args['genres'] = [genre]
|
item.args['genres'] = [genre]
|
||||||
itemlist.append(item.clone(title=support.typo(genre['name'],'bold'), action='movies'))
|
itemlist.append(item.clone(title=genre['name'], action='movies'))
|
||||||
return support.thumb(itemlist)
|
return support.thumb(itemlist)
|
||||||
|
|
||||||
def years(item):
|
def years(item):
|
||||||
@@ -71,7 +72,7 @@ def years(item):
|
|||||||
|
|
||||||
for year in list(reversed(range(oldest_year, current_year + 1))):
|
for year in list(reversed(range(oldest_year, current_year + 1))):
|
||||||
item.args['year']=year
|
item.args['year']=year
|
||||||
itemlist.append(item.clone(title=support.typo(year,'bold'), action='movies'))
|
itemlist.append(item.clone(title=year, action='movies'))
|
||||||
return itemlist
|
return itemlist
|
||||||
|
|
||||||
|
|
||||||
@@ -121,11 +122,14 @@ def news(item):
|
|||||||
session = cloudscraper.create_scraper()
|
session = cloudscraper.create_scraper()
|
||||||
|
|
||||||
fullJs = json.loads(support.match(session.get(item.url).text, headers=headers, patron=r'items-json="([^"]+)"').match.replace('"','"'))
|
fullJs = json.loads(support.match(session.get(item.url).text, headers=headers, patron=r'items-json="([^"]+)"').match.replace('"','"'))
|
||||||
|
# logger.debug(jsontools.dump(fullJs))
|
||||||
js = fullJs['data']
|
js = fullJs['data']
|
||||||
|
|
||||||
for it in js:
|
for it in js:
|
||||||
itemlist.append(
|
itemlist.append(
|
||||||
item.clone(title= support.typo(it['anime']['title'] + ' - EP. ' + it['number'], 'bold'),
|
item.clone(title=it['anime']['title'],
|
||||||
|
contentTitle = it['anime']['title'],
|
||||||
|
contentEpisodeNumber = int(it['number']),
|
||||||
fulltitle=it['anime']['title'],
|
fulltitle=it['anime']['title'],
|
||||||
thumbnail=it['anime']['imageurl'],
|
thumbnail=it['anime']['imageurl'],
|
||||||
forcethumb = True,
|
forcethumb = True,
|
||||||
@@ -133,8 +137,8 @@ def news(item):
|
|||||||
plot=it['anime']['plot'],
|
plot=it['anime']['plot'],
|
||||||
action='findvideos')
|
action='findvideos')
|
||||||
)
|
)
|
||||||
if 'next_page_url' in fullJs:
|
if fullJs.get('next_page_url'):
|
||||||
itemlist.append(item.clone(title=support.typo(support.config.get_localized_string(30992), 'color kod bold'),thumbnail=support.thumb(), url=fullJs['next_page_url']))
|
support.nextPage(itemlist, item, 'news', next_page=fullJs['next_page_url'], total_pages=int(fullJs['last_page_url'].split('=')[-1]))
|
||||||
return itemlist
|
return itemlist
|
||||||
|
|
||||||
|
|
||||||
@@ -151,7 +155,9 @@ def movies(item):
|
|||||||
item.args['order'] = order_list[order]
|
item.args['order'] = order_list[order]
|
||||||
|
|
||||||
payload = json.dumps(item.args)
|
payload = json.dumps(item.args)
|
||||||
records = session.post(host + '/archivio/get-animes', headers=headers, data=payload).json()['records']
|
js = session.post(host + '/archivio/get-animes', headers=headers, data=payload).json()
|
||||||
|
records = js['records']
|
||||||
|
total_pages = int(js['tot'] / 30)
|
||||||
|
|
||||||
for it in records:
|
for it in records:
|
||||||
logger.debug(jsontools.dump(it))
|
logger.debug(jsontools.dump(it))
|
||||||
@@ -161,18 +167,25 @@ def movies(item):
|
|||||||
if 'ita' in lang.lower(): language = 'ITA'
|
if 'ita' in lang.lower(): language = 'ITA'
|
||||||
else: language = 'Sub-ITA'
|
else: language = 'Sub-ITA'
|
||||||
|
|
||||||
itm = item.clone(title=support.typo(title,'bold') + support.typo(language,'_ [] color kod') + (support.typo(it['title_eng'],'_ ()') if it['title_eng'] else ''))
|
itm = item.clone(title=title,
|
||||||
itm.contentLanguage = language
|
contentLanguage = language,
|
||||||
itm.type = it['type']
|
type = it['type'],
|
||||||
itm.thumbnail = it['imageurl']
|
thumbnail = it['imageurl'],
|
||||||
itm.plot = it['plot']
|
plot = it['plot'],
|
||||||
itm.url = item.url
|
url = '{}/{}-{}'.format(item.url, it['id'], it['slug'])
|
||||||
|
)
|
||||||
|
# itm.contentLanguage = language
|
||||||
|
# itm.type = it['type']
|
||||||
|
# itm.thumbnail = it['imageurl']
|
||||||
|
# itm.plot = it['plot']
|
||||||
|
# itm.url = item.url
|
||||||
|
|
||||||
if it['episodes_count'] == 1:
|
if it['episodes_count'] == 1:
|
||||||
itm.contentType = 'movie'
|
itm.contentType = 'movie'
|
||||||
itm.fulltitle = itm.show = itm.contentTitle = title
|
itm.fulltitle = itm.show = itm.contentTitle = title
|
||||||
itm.contentSerieName = ''
|
itm.contentSerieName = ''
|
||||||
itm.action = 'findvideos'
|
itm.action = 'play'
|
||||||
|
item.forcethumb=True
|
||||||
itm.video_url = it['episodes'][0]['scws_id']
|
itm.video_url = it['episodes'][0]['scws_id']
|
||||||
|
|
||||||
else:
|
else:
|
||||||
@@ -181,33 +194,31 @@ def movies(item):
|
|||||||
itm.fulltitle = itm.show = itm.contentSerieName = title
|
itm.fulltitle = itm.show = itm.contentSerieName = title
|
||||||
itm.action = 'episodes'
|
itm.action = 'episodes'
|
||||||
itm.episodes = it['episodes'] if 'episodes' in it else it['scws_id']
|
itm.episodes = it['episodes'] if 'episodes' in it else it['scws_id']
|
||||||
itm.video_url = item.url
|
# itm.video_url = item.url
|
||||||
|
|
||||||
itemlist.append(itm)
|
itemlist.append(itm)
|
||||||
|
|
||||||
autorenumber.start(itemlist)
|
autorenumber.start(itemlist)
|
||||||
if len(itemlist) >= 30:
|
if len(itemlist) == 30:
|
||||||
itemlist.append(item.clone(title=support.typo(support.config.get_localized_string(30992), 'color kod bold'), thumbnail=support.thumb(), page=page + 1))
|
support.nextPage(itemlist, item, 'movies', page=page + 1, total_pages=total_pages)
|
||||||
|
|
||||||
return itemlist
|
return itemlist
|
||||||
|
|
||||||
def episodes(item):
|
def episodes(item):
|
||||||
logger.debug()
|
logger.debug()
|
||||||
itemlist = []
|
itemlist = []
|
||||||
title = 'Parte ' if item.type.lower() == 'movie' else 'Episodio '
|
# title = 'Parte ' if item.type.lower() == 'movie' else 'Episodio '
|
||||||
for it in item.episodes:
|
for it in item.episodes:
|
||||||
|
|
||||||
|
episode2 = it['number'].split('.')[-1]
|
||||||
|
episode = it['number'].split('.')[0]
|
||||||
itemlist.append(
|
itemlist.append(
|
||||||
item.clone(title=title,
|
item.clone(episodes = [],
|
||||||
episode = it['number'],
|
contentEpisodeNumber=int(float(it['number'])),
|
||||||
fulltitle=item.title,
|
episodeExtra = '.' + it['number'].split('.')[-1] if '.' in it['number'] else '',
|
||||||
show=item.title,
|
action='play',
|
||||||
contentTitle='',
|
|
||||||
contentEpisodeNumber=it['number'],
|
|
||||||
contentSerieName=item.contentSerieName,
|
|
||||||
thumbnail=item.thumbnail,
|
|
||||||
plot=item.plot,
|
|
||||||
action='findvideos',
|
|
||||||
contentType='episode',
|
contentType='episode',
|
||||||
|
forcethumb=True,
|
||||||
video_url=it['scws_id']))
|
video_url=it['scws_id']))
|
||||||
|
|
||||||
if inspect.stack()[1][3] not in ['find_episodes']:
|
if inspect.stack()[1][3] not in ['find_episodes']:
|
||||||
@@ -217,29 +228,17 @@ def episodes(item):
|
|||||||
return itemlist
|
return itemlist
|
||||||
|
|
||||||
|
|
||||||
def findvideos(item):
|
def play(item):
|
||||||
directLink = False
|
from time import time
|
||||||
if item.video_url == None:
|
from base64 import b64encode
|
||||||
if item.extra == "tvshow":
|
from hashlib import md5
|
||||||
epnum = item.episode
|
|
||||||
logger.info('it is a episode', epnum)
|
|
||||||
episode = None
|
|
||||||
for ep in item.episodes:
|
|
||||||
if ep["number"] == epnum:
|
|
||||||
episode = ep
|
|
||||||
break
|
|
||||||
if episode == None:
|
|
||||||
logger.warn('cannot found episode')
|
|
||||||
else:
|
|
||||||
item.url = episode["link"]
|
|
||||||
directLink = True
|
|
||||||
|
|
||||||
if directLink:
|
|
||||||
logger.info('try direct link')
|
|
||||||
return support.server(item, itemlist=[item.clone(title=support.config.get_localized_string(30137), url=item.url, server='directo', action='play')])
|
|
||||||
else:
|
|
||||||
return support.server(item, itemlist=[item.clone(title="StreamingCommunityWS", url=str(item.video_url), manifest = 'hls', server='streamingcommunityws', action='play')])
|
|
||||||
|
|
||||||
|
# Calculate Token
|
||||||
|
client_ip = support.httptools.downloadpage('https://scws.xyz/videos/{}'.format(item.video_url), headers=headers).json.get('client_ip')
|
||||||
|
expires = int(time() + 172800)
|
||||||
|
token = b64encode(md5('{}{} Yc8U6r8KjAKAepEA'.format(expires, client_ip).encode('utf-8')).digest()).decode('utf-8').replace('=', '').replace('+', '-').replace('/', '_')
|
||||||
|
|
||||||
|
url = 'https://scws.xyz/master/{}?token={}&expires={}&n=1'.format(item.video_url, token, expires)
|
||||||
|
|
||||||
|
return [item.clone(server='directo', url=url, manifest='hls')]
|
||||||
|
|
||||||
|
|||||||
+22
-15
@@ -1,5 +1,5 @@
|
|||||||
from platformcode import config, logger, autorenumber
|
from platformcode import config, logger, autorenumber
|
||||||
from core import httptools, scrapertools, support, tmdb
|
from core import httptools, jsontools, scrapertools, support, tmdb
|
||||||
from inspect import stack
|
from inspect import stack
|
||||||
|
|
||||||
import sys
|
import sys
|
||||||
@@ -27,7 +27,7 @@ def mainlist(item):
|
|||||||
def submenu_az(item):
|
def submenu_az(item):
|
||||||
itemlist = []
|
itemlist = []
|
||||||
for letter in ['0-9'] + list('ABCDEFGHIJKLMNOPQRSTUVWXYZ'):
|
for letter in ['0-9'] + list('ABCDEFGHIJKLMNOPQRSTUVWXYZ'):
|
||||||
itemlist.append(item.clone(title = support.typo(letter, 'bold'),
|
itemlist.append(item.clone(title = letter,
|
||||||
url= host + '/api/anime/find-by-char',
|
url= host + '/api/anime/find-by-char',
|
||||||
action= 'movies',
|
action= 'movies',
|
||||||
variable= '&character=' + letter,
|
variable= '&character=' + letter,
|
||||||
@@ -40,7 +40,7 @@ def submenu_year(item):
|
|||||||
current = date.today().year
|
current = date.today().year
|
||||||
first = int(httptools.downloadpage('{}/api/anime/advanced-search?page=0&size=1&sort=startDate,asc&sort=id'.format(host)).json[0]['startDate'].split('-')[0]) -1
|
first = int(httptools.downloadpage('{}/api/anime/advanced-search?page=0&size=1&sort=startDate,asc&sort=id'.format(host)).json[0]['startDate'].split('-')[0]) -1
|
||||||
for year in range(current, first, -1):
|
for year in range(current, first, -1):
|
||||||
itemlist.append(item.clone(title = support.typo(year, 'bold'),
|
itemlist.append(item.clone(title = year,
|
||||||
action= 'submenu_season',
|
action= 'submenu_season',
|
||||||
variable= year,
|
variable= year,
|
||||||
thumbnail=support.thumb('year')))
|
thumbnail=support.thumb('year')))
|
||||||
@@ -51,7 +51,7 @@ def submenu_top(item):
|
|||||||
links = {'Top del giorno':'daily-top', 'Top della settimana':'weekly-top', 'Top del mese':'monthly-top'}
|
links = {'Top del giorno':'daily-top', 'Top della settimana':'weekly-top', 'Top del mese':'monthly-top'}
|
||||||
for label in links:
|
for label in links:
|
||||||
link = links[label]
|
link = links[label]
|
||||||
itemlist.append(item.clone(title = support.typo(label, 'bold'),
|
itemlist.append(item.clone(title = label,
|
||||||
action= 'submenu_top_of',
|
action= 'submenu_top_of',
|
||||||
variable= link))
|
variable= link))
|
||||||
return itemlist
|
return itemlist
|
||||||
@@ -80,9 +80,9 @@ def submenu_top_of(item):
|
|||||||
title = fulltitle.split('(')[0].strip()
|
title = fulltitle.split('(')[0].strip()
|
||||||
scrapedlang = scrapertools.find_single_match(fulltitle, r'\(([^\)]+)')
|
scrapedlang = scrapertools.find_single_match(fulltitle, r'\(([^\)]+)')
|
||||||
lang = scrapedlang.upper() if scrapedlang else 'Sub-ITA'
|
lang = scrapedlang.upper() if scrapedlang else 'Sub-ITA'
|
||||||
long_title = support.typo(title, 'bold') + support.typo(lang, '_ [] color kod')
|
# long_title = support.typo(title, 'bold') + support.typo(lang, '_ [] color kod')
|
||||||
|
|
||||||
itemlist.append(item.clone(title=long_title,
|
itemlist.append(item.clone(title=title,
|
||||||
id=anime['animeId'],
|
id=anime['animeId'],
|
||||||
url = '{}/api/anime/{}'.format(host, anime['animeId']),
|
url = '{}/api/anime/{}'.format(host, anime['animeId']),
|
||||||
thumbnail = get_thumbnail(anime, 'animeHorizontalImages'),
|
thumbnail = get_thumbnail(anime, 'animeHorizontalImages'),
|
||||||
@@ -123,18 +123,21 @@ def newest(category):
|
|||||||
|
|
||||||
def latest_added(item):
|
def latest_added(item):
|
||||||
itemlist = []
|
itemlist = []
|
||||||
|
if config.get_setting("window_type") == 0:
|
||||||
|
item.window = True
|
||||||
|
item.folder = False
|
||||||
page = item.page if item.page else 0
|
page = item.page if item.page else 0
|
||||||
url= '{}/api/home/latest-episodes?page={}'.format(host, page)
|
url= '{}/api/home/latest-episodes?page={}'.format(host, page)
|
||||||
js = httptools.downloadpage(url).json
|
js = httptools.downloadpage(url).json
|
||||||
|
|
||||||
for episode in js:
|
for episode in js:
|
||||||
title = episode['title']
|
logger.debug(jsontools.dump(episode))
|
||||||
|
title = episode['title'] if episode['title'] else episode['animeTitle']
|
||||||
animeTitle, lang = get_lang(episode['animeTitle'])
|
animeTitle, lang = get_lang(episode['animeTitle'])
|
||||||
quality = 'Full HD' if episode['fullHd'] else 'HD'
|
quality = 'Full HD' if episode['fullHd'] else 'HD'
|
||||||
long_title = support.typo('{}. {}{}'.format(int(float(episode['episodeNumber'])), title + ' - ' if title else '', animeTitle), 'bold') + support.typo(lang, '_ [] color kod') + support.typo(quality, '_ [] color kod')
|
|
||||||
image = get_thumbnail(episode, 'episodeImages')
|
image = get_thumbnail(episode, 'episodeImages')
|
||||||
|
|
||||||
itemlist.append(item.clone(title=long_title,
|
itemlist.append(item.clone(title=title,
|
||||||
fulltitle=title,
|
fulltitle=title,
|
||||||
animeId = episode['animeId'],
|
animeId = episode['animeId'],
|
||||||
id=episode['id'],
|
id=episode['id'],
|
||||||
@@ -165,9 +168,7 @@ def movies(item):
|
|||||||
for it in js:
|
for it in js:
|
||||||
title, lang = get_lang(it['title'])
|
title, lang = get_lang(it['title'])
|
||||||
|
|
||||||
long_title = support.typo(title, 'bold') + support.typo(lang, '_ [] color kod')
|
itemlist.append(item.clone(title = title,
|
||||||
|
|
||||||
itemlist.append(item.clone(title = long_title,
|
|
||||||
fulltitle = title,
|
fulltitle = title,
|
||||||
show = title,
|
show = title,
|
||||||
contentLanguage = lang,
|
contentLanguage = lang,
|
||||||
@@ -193,6 +194,10 @@ def episodes(item):
|
|||||||
logger.debug()
|
logger.debug()
|
||||||
itemlist = []
|
itemlist = []
|
||||||
|
|
||||||
|
if config.get_setting("window_type") == 0:
|
||||||
|
item.window = True
|
||||||
|
item.folder = False
|
||||||
|
|
||||||
# url = '{}/api/anime/{}'.format(host, item.id)
|
# url = '{}/api/anime/{}'.format(host, item.id)
|
||||||
json = httptools.downloadpage(item.url, CF=False ).json
|
json = httptools.downloadpage(item.url, CF=False ).json
|
||||||
|
|
||||||
@@ -208,6 +213,7 @@ def episodes(item):
|
|||||||
title = it['name']
|
title = it['name']
|
||||||
|
|
||||||
itemlist.append(item.clone(title = title,
|
itemlist.append(item.clone(title = title,
|
||||||
|
contentTitle = title,
|
||||||
id= '{}/season/{}'.format(it['animeId'], it['id']),
|
id= '{}/season/{}'.format(it['animeId'], it['id']),
|
||||||
contentType = 'season',
|
contentType = 'season',
|
||||||
action = 'list_episodes',
|
action = 'list_episodes',
|
||||||
@@ -259,10 +265,11 @@ def list_episodes(item, json=None):
|
|||||||
else:
|
else:
|
||||||
episode = '{:02d}'.format(int(it['episodeNumber'].split('.')[0]))
|
episode = '{:02d}'.format(int(it['episodeNumber'].split('.')[0]))
|
||||||
|
|
||||||
title = support.typo('{}. {}'.format(episode, it['title']), 'bold')
|
# title = support.typo('{}. {}'.format(episode, it['title']), 'bold')
|
||||||
image = get_thumbnail(it, 'episodeImages')
|
image = get_thumbnail(it, 'episodeImages')
|
||||||
|
|
||||||
itemlist.append(item.clone(title = title,
|
itemlist.append(item.clone(title = it['title'],
|
||||||
|
contentTitle = it['title'],
|
||||||
id= it['id'],
|
id= it['id'],
|
||||||
url= 'api/episode/{}'.format(it['id']),
|
url= 'api/episode/{}'.format(it['id']),
|
||||||
contentType = 'episode',
|
contentType = 'episode',
|
||||||
@@ -283,7 +290,7 @@ def list_episodes(item, json=None):
|
|||||||
def findvideos(item):
|
def findvideos(item):
|
||||||
logger.debug()
|
logger.debug()
|
||||||
|
|
||||||
url = '{}/api/{}/{}'.format(host, 'episode' if item.contentType == 'episode' else 'anime', item.id)
|
url = '{}/api/{}/{}'.format(host, 'episode' if item.contentType != 'movie' else 'anime', item.id)
|
||||||
|
|
||||||
json = httptools.downloadpage(url, CF=False ).json
|
json = httptools.downloadpage(url, CF=False ).json
|
||||||
|
|
||||||
|
|||||||
@@ -6,5 +6,15 @@
|
|||||||
"thumbnail": "streamingcommunity.png",
|
"thumbnail": "streamingcommunity.png",
|
||||||
"banner": "streamingcommunity.png",
|
"banner": "streamingcommunity.png",
|
||||||
"categories": ["movie","tvshow"],
|
"categories": ["movie","tvshow"],
|
||||||
"settings": []
|
"settings": [
|
||||||
|
{
|
||||||
|
"id": "pagination",
|
||||||
|
"type": "list",
|
||||||
|
"label": "Pagination",
|
||||||
|
"default": 1,
|
||||||
|
"enabled": true,
|
||||||
|
"visible": true,
|
||||||
|
"lvalues": ["10", "20", "30", "40", "50", "60"]
|
||||||
|
}
|
||||||
|
]
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,7 +5,7 @@
|
|||||||
|
|
||||||
import json, requests, sys
|
import json, requests, sys
|
||||||
from core import support, channeltools
|
from core import support, channeltools
|
||||||
from platformcode import logger
|
from platformcode import config, logger
|
||||||
if sys.version_info[0] >= 3:
|
if sys.version_info[0] >= 3:
|
||||||
from concurrent import futures
|
from concurrent import futures
|
||||||
else:
|
else:
|
||||||
@@ -17,12 +17,17 @@ def findhost(url):
|
|||||||
host = support.config.get_channel_url(findhost)
|
host = support.config.get_channel_url(findhost)
|
||||||
session = requests.Session()
|
session = requests.Session()
|
||||||
headers = {}
|
headers = {}
|
||||||
|
perpage = config.get_setting('pagination', 'streamingcommunity', default=1) * 10 + 10
|
||||||
|
|
||||||
def getHeaders():
|
def getHeaders():
|
||||||
global headers
|
global headers
|
||||||
|
global host
|
||||||
|
# support.dbg()
|
||||||
if not headers:
|
if not headers:
|
||||||
headers = {'User-Agent': 'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-GB; rv:1.8.1.14) Gecko/20080404 Firefox/2.0.0.14'}
|
headers = {'User-Agent': 'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-GB; rv:1.8.1.14) Gecko/20080404 Firefox/2.0.0.14'}
|
||||||
response = session.get(host, headers=headers)
|
response = session.get(host, headers=headers)
|
||||||
|
if response.status_code != 200 or response.url != host:
|
||||||
|
host = support.config.get_channel_url(findhost, forceFindhost=True)
|
||||||
csrf_token = support.match(response.text, patron='name="csrf-token" content="([^"]+)"').match
|
csrf_token = support.match(response.text, patron='name="csrf-token" content="([^"]+)"').match
|
||||||
headers = {'User-Agent': 'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-GB; rv:1.8.1.14) Gecko/20080404 Firefox/2.0.0.14',
|
headers = {'User-Agent': 'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-GB; rv:1.8.1.14) Gecko/20080404 Firefox/2.0.0.14',
|
||||||
'content-type': 'application/json;charset=UTF-8',
|
'content-type': 'application/json;charset=UTF-8',
|
||||||
@@ -55,7 +60,7 @@ def genres(item):
|
|||||||
args = support.match(data, patronBlock=r'genre-options-json="([^\]]+)\]', patron=r'name"\s*:\s*"([^"]+)').matches
|
args = support.match(data, patronBlock=r'genre-options-json="([^\]]+)\]', patron=r'name"\s*:\s*"([^"]+)').matches
|
||||||
for arg in args:
|
for arg in args:
|
||||||
itemlist.append(item.clone(title=support.typo(arg, 'bold'), args=arg, action='movies'))
|
itemlist.append(item.clone(title=support.typo(arg, 'bold'), args=arg, action='movies'))
|
||||||
support.thumb(itemlist, genre=True)
|
support.thumb(itemlist, mode=True)
|
||||||
return itemlist
|
return itemlist
|
||||||
|
|
||||||
|
|
||||||
@@ -105,14 +110,12 @@ def movies(item):
|
|||||||
# getHeaders()
|
# getHeaders()
|
||||||
logger.debug()
|
logger.debug()
|
||||||
itemlist = []
|
itemlist = []
|
||||||
recordlist = []
|
|
||||||
videoType = 'movie' if item.contentType == 'movie' else 'tv'
|
videoType = 'movie' if item.contentType == 'movie' else 'tv'
|
||||||
|
|
||||||
page = item.page if item.page else 0
|
page = item.page if item.page else 0
|
||||||
offset = page * 60
|
offset = page * perpage
|
||||||
if item.records:
|
|
||||||
records = item.records
|
if type(item.args) == int:
|
||||||
elif type(item.args) == int:
|
|
||||||
data = support.scrapertools.decodeHtmlentities(support.match(item).data)
|
data = support.scrapertools.decodeHtmlentities(support.match(item).data)
|
||||||
records = json.loads(support.match(data, patron=r'slider-title titles-json="(.*?)" slider-name="').matches[item.args])
|
records = json.loads(support.match(data, patron=r'slider-title titles-json="(.*?)" slider-name="').matches[item.args])
|
||||||
elif not item.search:
|
elif not item.search:
|
||||||
@@ -129,20 +132,27 @@ def movies(item):
|
|||||||
else:
|
else:
|
||||||
js = records
|
js = records
|
||||||
|
|
||||||
for i, it in enumerate(js):
|
itemlist = makeItems(item, js)
|
||||||
if i < 20:
|
|
||||||
itemlist.append(makeItem(i, it, item))
|
|
||||||
else:
|
|
||||||
recordlist.append(it)
|
|
||||||
|
|
||||||
itemlist.sort(key=lambda item: item.n)
|
|
||||||
if recordlist:
|
|
||||||
itemlist.append(item.clone(title=support.typo(support.config.get_localized_string(30992), 'color kod bold'), thumbnail=support.thumb(), page=page, records=recordlist))
|
|
||||||
elif len(itemlist) >= 20:
|
|
||||||
itemlist.append(item.clone(title=support.typo(support.config.get_localized_string(30992), 'color kod bold'), thumbnail=support.thumb(), records=[], page=page + 1))
|
|
||||||
support.tmdb.set_infoLabels_itemlist(itemlist, seekTmdb=True)
|
support.tmdb.set_infoLabels_itemlist(itemlist, seekTmdb=True)
|
||||||
|
|
||||||
|
if len(itemlist) == perpage:
|
||||||
|
support.nextPage(itemlist, item, 'movies', page=page + 1)
|
||||||
|
|
||||||
return itemlist
|
return itemlist
|
||||||
|
|
||||||
|
|
||||||
|
def makeItems(item, items):
|
||||||
|
itemlist = []
|
||||||
|
with futures.ThreadPoolExecutor() as executor:
|
||||||
|
itlist = [executor.submit(makeItem, n, it, item) for n, it in enumerate(items) if n < perpage]
|
||||||
|
for res in futures.as_completed(itlist):
|
||||||
|
if res.result():
|
||||||
|
itemlist.append(res.result())
|
||||||
|
itemlist.sort(key=lambda item: item.n)
|
||||||
|
return itemlist
|
||||||
|
|
||||||
|
|
||||||
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, lang = support.match(info['name'], patron=r'([^\[|$]+)(?:\[([^\]]+)\])?').match
|
||||||
@@ -196,34 +206,26 @@ def episodes(item):
|
|||||||
|
|
||||||
|
|
||||||
def findvideos(item):
|
def findvideos(item):
|
||||||
video_urls = []
|
channelParams = channeltools.get_channel_parameters(item.channel)
|
||||||
data = support.match(item.url + item.episodeid, headers=headers).data.replace('"','"').replace('\\','')
|
itemlist = [item.clone(title = channelParams['title'], server='directo', thumbnail=channelParams["thumbnail"], forcethumb=True, action='play')]
|
||||||
url = support.match(data, patron=r'video_url"\s*:\s*"([^"]+)"').match
|
return support.server(item, itemlist=itemlist)
|
||||||
|
|
||||||
def calculateToken():
|
def play(item):
|
||||||
from time import time
|
from time import time
|
||||||
from base64 import b64encode as b64
|
from base64 import b64encode
|
||||||
import hashlib
|
from hashlib import md5
|
||||||
o = 48
|
|
||||||
n = support.match(host + '/client-address').data
|
|
||||||
i = 'Yc8U6r8KjAKAepEA'
|
|
||||||
t = int(time() + (3600 * o))
|
|
||||||
l = '{}{} {}'.format(t, n, i)
|
|
||||||
md5 = hashlib.md5(l.encode())
|
|
||||||
s = '?token={}&expires={}'.format(b64(md5.digest()).decode().replace('=', '').replace('+', "-").replace('\\', "_"), t)
|
|
||||||
return s
|
|
||||||
token = calculateToken()
|
|
||||||
|
|
||||||
|
data = support.httptools.downloadpage(item.url + item.episodeid, headers=headers).data.replace('"','"').replace('\\','')
|
||||||
|
scws_id = support.match(data, patron=r'scws_id"\s*:\s*(\d+)').match
|
||||||
|
|
||||||
def videourls(res):
|
if not scws_id:
|
||||||
newurl = '{}/{}{}'.format(url, res, token)
|
return []
|
||||||
if requests.head(newurl, headers=headers).status_code == 200:
|
|
||||||
video_urls.append({'type':'m3u8', 'res':res, 'url':newurl})
|
|
||||||
|
|
||||||
with futures.ThreadPoolExecutor() as executor:
|
# Calculate Token
|
||||||
for res in ['480p', '720p', '1080p']:
|
client_ip = support.httptools.downloadpage('https://scws.xyz/videos/' + scws_id, headers=headers).json.get('client_ip')
|
||||||
executor.submit(videourls, res)
|
expires = int(time() + 172800)
|
||||||
|
token = b64encode(md5('{}{} Yc8U6r8KjAKAepEA'.format(expires, client_ip).encode('utf-8')).digest()).decode('utf-8').replace('=', '').replace('+', '-').replace('/', '_')
|
||||||
|
|
||||||
if not video_urls: video_urls = [{'type':'m3u8', 'url':url + token}]
|
url = 'https://scws.xyz/master/{}?token={}&expires={}&n=1'.format(scws_id, token, expires)
|
||||||
itemlist = [item.clone(title = channeltools.get_channel_parameters(item.channel)['title'], server='directo', video_urls=video_urls, thumbnail=channeltools.get_channel_parameters(item.channel)["thumbnail"], forcethumb=True)]
|
|
||||||
return support.server(item, itemlist=itemlist)
|
return [item.clone(server='directo', url=url, manifest='hls')]
|
||||||
+11
-7
@@ -3,8 +3,8 @@
|
|||||||
# Canale per vvvvid
|
# Canale per vvvvid
|
||||||
# ----------------------------------------------------------
|
# ----------------------------------------------------------
|
||||||
import requests, sys, inspect
|
import requests, sys, inspect
|
||||||
from core import support, tmdb
|
from core import channeltools, support, tmdb
|
||||||
from platformcode import autorenumber, logger, config
|
from platformcode import autorenumber, logger, config, platformtools
|
||||||
|
|
||||||
host = support.config.get_channel_url()
|
host = support.config.get_channel_url()
|
||||||
|
|
||||||
@@ -140,6 +140,10 @@ def movies(item):
|
|||||||
|
|
||||||
def episodes(item):
|
def episodes(item):
|
||||||
itemlist = []
|
itemlist = []
|
||||||
|
if config.get_setting("window_type") == 0:
|
||||||
|
item.window = True
|
||||||
|
item.folder = False
|
||||||
|
|
||||||
if item.episodes:
|
if item.episodes:
|
||||||
episodes = item.episodes
|
episodes = item.episodes
|
||||||
show_id = item.show_id
|
show_id = item.show_id
|
||||||
@@ -164,10 +168,11 @@ def episodes(item):
|
|||||||
if type(title) == tuple: title = title[0]
|
if type(title) == tuple: title = title[0]
|
||||||
itemlist.append(
|
itemlist.append(
|
||||||
item.clone(title = title,
|
item.clone(title = title,
|
||||||
|
contentType = 'episode',
|
||||||
contentEpisodeNumber = int(episode['number']),
|
contentEpisodeNumber = int(episode['number']),
|
||||||
url= main_host + show_id + '/season/' + str(season_id),
|
url= main_host + show_id + '/season/' + str(season_id),
|
||||||
action= 'findvideos',
|
action= 'findvideos',
|
||||||
video_id= episode['video_id']))
|
video_id= episode['video_id']))
|
||||||
|
|
||||||
if inspect.stack()[1][3] not in ['find_episodes']:
|
if inspect.stack()[1][3] not in ['find_episodes']:
|
||||||
autorenumber.start(itemlist, item)
|
autorenumber.start(itemlist, item)
|
||||||
@@ -209,8 +214,7 @@ def findvideos(item):
|
|||||||
item.clone(action= 'play',
|
item.clone(action= 'play',
|
||||||
title=config.get_localized_string(30137),
|
title=config.get_localized_string(30137),
|
||||||
url= item.url + '?' + key,
|
url= item.url + '?' + key,
|
||||||
server= 'directo')
|
server= 'directo'))
|
||||||
)
|
|
||||||
|
|
||||||
return support.server(item, itemlist=itemlist, Download=False)
|
return support.server(item, itemlist=itemlist, Download=False)
|
||||||
|
|
||||||
|
|||||||
+9
-1
@@ -853,6 +853,9 @@ def nextPage(itemlist, item, function_or_level=1, **kwargs):
|
|||||||
page = kwargs.get('page', None)
|
page = kwargs.get('page', None)
|
||||||
total_pages = kwargs.get('total_pages', None)
|
total_pages = kwargs.get('total_pages', None)
|
||||||
|
|
||||||
|
if total_pages and total_pages % 1:
|
||||||
|
total_pages = int(total_pages) + 1
|
||||||
|
|
||||||
# get next_page from data
|
# get next_page from data
|
||||||
if data and patron:
|
if data and patron:
|
||||||
next_page = scrapertools.find_single_match(data, patron)
|
next_page = scrapertools.find_single_match(data, patron)
|
||||||
@@ -885,9 +888,10 @@ def nextPage(itemlist, item, function_or_level=1, **kwargs):
|
|||||||
nextPage=True,
|
nextPage=True,
|
||||||
page=page if page else item.page + 1 if item.page else 2,
|
page=page if page else item.page + 1 if item.page else 2,
|
||||||
prevthumb = item.thumbnail,
|
prevthumb = item.thumbnail,
|
||||||
|
folder=True,
|
||||||
thumbnail=thumb()))
|
thumbnail=thumb()))
|
||||||
|
|
||||||
if total_pages:
|
|
||||||
itemlist.append(item.clone(action='gotopage',
|
itemlist.append(item.clone(action='gotopage',
|
||||||
real_action = inspect.stack()[function_or_level][3] if type(function_or_level) == int else function_or_level,
|
real_action = inspect.stack()[function_or_level][3] if type(function_or_level) == int else function_or_level,
|
||||||
title=typo(config.get_localized_string(90007), 'color kod bold'),
|
title=typo(config.get_localized_string(90007), 'color kod bold'),
|
||||||
@@ -1051,7 +1055,11 @@ def server(item, data='', itemlist=[], headers='', AutoPlay=True, CheckLinks=Tru
|
|||||||
if videoitem.quality: vi.quality = videoitem.quality
|
if videoitem.quality: vi.quality = videoitem.quality
|
||||||
if not vi.referer: vi.referer = item.url
|
if not vi.referer: vi.referer = item.url
|
||||||
if videoitem.contentType == 'episode': vi.fanart=videoitem.thumbnail
|
if videoitem.contentType == 'episode': vi.fanart=videoitem.thumbnail
|
||||||
|
if videoitem.forcethumb:
|
||||||
|
vi.thumbnail = videoitem.thumbnail
|
||||||
|
vi.forcethumb = True
|
||||||
videoitem = vi
|
videoitem = vi
|
||||||
|
|
||||||
# videoitem = item.clone(serverName = videoitem.title if videoitem.title else videoitem.ser)
|
# videoitem = item.clone(serverName = videoitem.title if videoitem.title else videoitem.ser)
|
||||||
# quality = videoitem.quality if videoitem.quality else item.quality if item.quality else ''
|
# quality = videoitem.quality if videoitem.quality else item.quality if item.quality else ''
|
||||||
# videoitem.contentLanguage = videoitem.contentLanguage if videoitem.contentLanguage else item.contentLanguage if item.contentLanguage else 'ITA'
|
# videoitem.contentLanguage = videoitem.contentLanguage if videoitem.contentLanguage else item.contentLanguage if item.contentLanguage else 'ITA'
|
||||||
|
|||||||
@@ -168,7 +168,7 @@ def run(item=None):
|
|||||||
if page and int(page) > -1:
|
if page and int(page) > -1:
|
||||||
import xbmc
|
import xbmc
|
||||||
item.action = item.real_action
|
item.action = item.real_action
|
||||||
item.page = page
|
item.page = int(page)
|
||||||
import re
|
import re
|
||||||
item.url = re.sub('([=/])[0-9]+(/?)$', '\g<1>{}\g<2>'.format(page), item.url)
|
item.url = re.sub('([=/])[0-9]+(/?)$', '\g<1>{}\g<2>'.format(page), item.url)
|
||||||
xbmc.executebuiltin("Container.Update(%s?%s)" % (sys.argv[0], item.tourl()))
|
xbmc.executebuiltin("Container.Update(%s?%s)" % (sys.argv[0], item.tourl()))
|
||||||
@@ -228,6 +228,7 @@ def run(item=None):
|
|||||||
|
|
||||||
# Special action for findvideos, where the plugin looks for known urls
|
# Special action for findvideos, where the plugin looks for known urls
|
||||||
elif item.action == "findvideos":
|
elif item.action == "findvideos":
|
||||||
|
# logger.dbg()
|
||||||
from core import servertools
|
from core import servertools
|
||||||
p_dialog = None
|
p_dialog = None
|
||||||
if item.window:
|
if item.window:
|
||||||
|
|||||||
@@ -336,8 +336,6 @@ def render_items(itemlist, parent_item):
|
|||||||
logger.debug('START render_items')
|
logger.debug('START render_items')
|
||||||
thumb_type = config.get_setting('video_thumbnail_type')
|
thumb_type = config.get_setting('video_thumbnail_type')
|
||||||
from platformcode import shortcuts
|
from platformcode import shortcuts
|
||||||
from core.support import typo
|
|
||||||
from core import servertools
|
|
||||||
_handle = int(sys.argv[1])
|
_handle = int(sys.argv[1])
|
||||||
default_fanart = config.get_fanart()
|
default_fanart = config.get_fanart()
|
||||||
def_context_commands = shortcuts.context()
|
def_context_commands = shortcuts.context()
|
||||||
@@ -365,31 +363,7 @@ def render_items(itemlist, parent_item):
|
|||||||
|
|
||||||
icon_image = "DefaultFolder.png" if item.folder else "DefaultVideo.png"
|
icon_image = "DefaultFolder.png" if item.folder else "DefaultVideo.png"
|
||||||
|
|
||||||
title = item.title if item.title else item.contentTitle
|
title = setTitle(item)
|
||||||
episode = ''
|
|
||||||
|
|
||||||
if title[:1] not in ['[', '•']:
|
|
||||||
# if item.contentTitle: title = item.contentTitle
|
|
||||||
# elif item.contentSerieName: title = item.contentSerieName
|
|
||||||
if type(item.contentSeason) == int and type(item.contentEpisodeNumber) == int and not item.onlyep:
|
|
||||||
episode = '{}x{:02d}'.format(item.contentSeason, item.contentEpisodeNumber)
|
|
||||||
elif type(item.contentEpisodeNumber) == int:
|
|
||||||
episode = '{:02d}'.format(item.contentEpisodeNumber)
|
|
||||||
if episode and item.episode2:
|
|
||||||
if len(item.episode2) < 4: episode = '{}-{}'.format(episode, '-'.join('{:02d}'.format(int(e)) for e in item.episode2))
|
|
||||||
else: episode = '{} -> {:02d}'.format(episode, item.episode2[-1])
|
|
||||||
if episode: title = '{}. {}'.format(episode, title)
|
|
||||||
if item.title2: title = '{} - {}'.format(title, item.title2)
|
|
||||||
|
|
||||||
if config.get_setting('format_title') or item.server:
|
|
||||||
server = typo(item.serverName, '__ [] bold') if item.server else ''
|
|
||||||
quality = typo(item.quality, '_ [] color kod') if item.quality else ''
|
|
||||||
lang = typo(item.contentLanguage, '_ [] color kod') if item.contentLanguage else ''
|
|
||||||
extra = typo(item.extraInfo, '_ [] color kod') if item.extraInfo else ''
|
|
||||||
size = typo(item.size, '_ [] color kod') if item.size else ''
|
|
||||||
seed = typo('Seed: ' + item.seed, '_ [] color kod') if item.seed else ''
|
|
||||||
|
|
||||||
title = '{}{}{}{}{}{}{}'.format(server, title, quality, lang, extra, size, seed)
|
|
||||||
|
|
||||||
|
|
||||||
listitem = xbmcgui.ListItem(title)
|
listitem = xbmcgui.ListItem(title)
|
||||||
@@ -463,7 +437,7 @@ def render_items(itemlist, parent_item):
|
|||||||
xbmcplugin.setPluginCategory(handle=_handle, category=breadcrumb)
|
xbmcplugin.setPluginCategory(handle=_handle, category=breadcrumb)
|
||||||
set_view_mode(itemlist[0], parent_item)
|
set_view_mode(itemlist[0], parent_item)
|
||||||
|
|
||||||
xbmcplugin.endOfDirectory(_handle, succeeded=True, updateListing=False, cacheToDisc=False)
|
xbmcplugin.endOfDirectory(_handle, succeeded=True, updateListing=False, cacheToDisc=True)
|
||||||
|
|
||||||
|
|
||||||
logger.debug('END render_items')
|
logger.debug('END render_items')
|
||||||
@@ -479,39 +453,79 @@ def render_items(itemlist, parent_item):
|
|||||||
pos = position + (1 if xbmc.getInfoLabel('Container(10138).HasParent') else 0)
|
pos = position + (1 if xbmc.getInfoLabel('Container(10138).HasParent') else 0)
|
||||||
ctrl.selectItem(pos)
|
ctrl.selectItem(pos)
|
||||||
|
|
||||||
|
def setTitle(item):
|
||||||
|
from core.support import typo
|
||||||
|
title = item.title if item.title else item.contentTitle
|
||||||
|
episode = ''
|
||||||
|
|
||||||
|
if title[:1] not in ['[', '•']:
|
||||||
|
# if item.contentTitle: title = item.contentTitle
|
||||||
|
# elif item.contentSerieName: title = item.contentSerieName
|
||||||
|
if type(item.contentSeason) == int and type(item.contentEpisodeNumber) == int and not item.onlyep:
|
||||||
|
episode = '{}x{:02d}'.format(item.contentSeason, item.contentEpisodeNumber)
|
||||||
|
elif type(item.contentEpisodeNumber) == int:
|
||||||
|
episode = '{:02d}'.format(item.contentEpisodeNumber)
|
||||||
|
if item.episodeExtra: episode += item.episodeExtra
|
||||||
|
if episode and item.episode2:
|
||||||
|
if len(item.episode2) < 4: episode = '{}-{}'.format(episode, '-'.join('{:02d}'.format(int(e)) for e in item.episode2))
|
||||||
|
else: episode = '{} -> {:02d}'.format(episode, item.episode2[-1])
|
||||||
|
if episode: title = '{}. {}'.format(episode, title)
|
||||||
|
if item.title2: title = '{} - {}'.format(title, item.title2)
|
||||||
|
|
||||||
|
if config.get_setting('format_title') or item.server:
|
||||||
|
server = typo(item.serverName, '__ [] bold') if item.server else ''
|
||||||
|
quality = typo(item.quality, '_ [] color kod') if item.quality else ''
|
||||||
|
lang = typo(item.contentLanguage, '_ [] color kod') if item.contentLanguage else ''
|
||||||
|
extra = typo(item.extraInfo, '_ [] color kod') if item.extraInfo else ''
|
||||||
|
size = typo(item.size, '_ [] color kod') if item.size else ''
|
||||||
|
seed = typo('Seed: ' + item.seed, '_ [] color kod') if item.seed else ''
|
||||||
|
|
||||||
|
title = '{}{}{}{}{}{}{}'.format(server, title, quality, lang, extra, size, seed)
|
||||||
|
return title
|
||||||
|
|
||||||
|
|
||||||
def viewmodeMonitor():
|
def viewmodeMonitor():
|
||||||
if get_window() == 'WINDOW_VIDEO_NAV':
|
if get_window() == 'WINDOW_VIDEO_NAV':
|
||||||
try:
|
try:
|
||||||
currentModeName = xbmc.getInfoLabel('Container.Viewmode')
|
currentModeName = xbmc.getInfoLabel('Container.Viewmode')
|
||||||
win = xbmcgui.Window(xbmcgui.getCurrentWindowId())
|
parent_info = xbmc.getInfoLabel('Container.FolderPath')
|
||||||
|
item_info = xbmc.getInfoLabel('Container.ListItemPosition(2).FileNameAndPath')
|
||||||
|
parent_item = Item().fromurl(parent_info)
|
||||||
|
win = xbmcgui.Window(10025)
|
||||||
currentMode = int(win.getFocusId())
|
currentMode = int(win.getFocusId())
|
||||||
if currentModeName and 'plugin.video.kod' in xbmc.getInfoLabel('Container.FolderPath') and currentMode < 1000 and currentMode >= 50: # inside addon and in itemlist view
|
if currentModeName and 'plugin.video.kod' in parent_info and 50 <= currentMode < 1000: # inside addon and in itemlist view
|
||||||
content, Type = getCurrentView()
|
content, Type = getCurrentView(Item().fromurl(item_info) if item_info else Item(), Item().fromurl(parent_info))
|
||||||
if content:
|
if content:
|
||||||
defaultMode = int(config.get_setting('view_mode_{}'.format(content)).split(',')[-1])
|
defaultMode = int(config.get_setting('view_mode_%s' % content).split(',')[-1])
|
||||||
if currentMode != defaultMode:
|
if currentMode != defaultMode:
|
||||||
logger.debug('viewmode changed: ' + currentModeName + '-' + str(currentMode) + ' - content: ' + content)
|
config.set_setting('view_mode_%s' % content, currentModeName + ', ' + str(currentMode))
|
||||||
config.set_setting('view_mode_{}'.format(content), currentModeName + ', ' + str(currentMode))
|
# dialog_notification(config.get_localized_string(70153),
|
||||||
dialog_notification(config.get_localized_string(70153),
|
# config.get_localized_string(70187) % (content, currentModeName),
|
||||||
config.get_localized_string(70187) % (content, currentModeName),
|
# sound=False)
|
||||||
sound=False)
|
|
||||||
except:
|
except:
|
||||||
import traceback
|
import traceback
|
||||||
logger.error(traceback.print_exc())
|
logger.error(traceback.print_exc())
|
||||||
|
|
||||||
|
|
||||||
def getCurrentView(item=None, parent_item=None):
|
def getCurrentView(item=None, parent_item=None):
|
||||||
if not parent_item:
|
|
||||||
info = xbmc.getInfoLabel('Container.FolderPath')
|
|
||||||
if not info:
|
|
||||||
return None, None
|
|
||||||
parent_item = Item().fromurl(info)
|
|
||||||
if not item:
|
if not item:
|
||||||
info = xbmc.getInfoLabel('Container.ListItemPosition(2).FileNameAndPath') # first addon listitem (consider "..")
|
item = Item()
|
||||||
if not info:
|
if not parent_item:
|
||||||
return None, None
|
logger.debug('ESCO')
|
||||||
item = Item().fromurl(info) if info else Item()
|
return None, None
|
||||||
|
|
||||||
|
# if not parent_item:
|
||||||
|
# info = xbmc.getInfoLabel('Container.FolderPath')
|
||||||
|
# if not info:
|
||||||
|
# return None, None
|
||||||
|
# parent_item = Item().fromurl(info)
|
||||||
|
# if not item:
|
||||||
|
# info = xbmc.getInfoLabel('Container.ListItemPosition(2).FileNameAndPath') # first addon listitem (consider "..")
|
||||||
|
# if not info:
|
||||||
|
# item = Item()
|
||||||
|
# else:
|
||||||
|
# item = Item().fromurl(info) if info else Item()
|
||||||
parent_actions = ['movies', 'news', 'search', 'get_from_temp', 'newest', 'discover_list', 'new_search', 'channel_search']
|
parent_actions = ['movies', 'news', 'search', 'get_from_temp', 'newest', 'discover_list', 'new_search', 'channel_search']
|
||||||
|
|
||||||
addons = 'addons' if config.get_setting('touch_view') else ''
|
addons = 'addons' if config.get_setting('touch_view') else ''
|
||||||
@@ -532,21 +546,25 @@ def getCurrentView(item=None, parent_item=None):
|
|||||||
or (item.channel in ['videolibrary'] and parent_item.action in ['list_tvshows']):
|
or (item.channel in ['videolibrary'] and parent_item.action in ['list_tvshows']):
|
||||||
return 'tvshow', 'tvshows'
|
return 'tvshow', 'tvshows'
|
||||||
|
|
||||||
elif parent_item.action in ['get_seasons'] or item.contentType == 'season':
|
elif parent_item.action in ['episode', 'get_episodes'] or item.contentType == 'episode':
|
||||||
|
return 'episode', 'tvshows'
|
||||||
|
|
||||||
|
elif parent_item.action in ['get_seasons']:
|
||||||
|
logger.debug('CONTENTTYPE:',item.contentType)
|
||||||
return 'season', 'tvshows'
|
return 'season', 'tvshows'
|
||||||
|
|
||||||
elif parent_item.action in ['episodes', 'get_episodes'] or item.contentType == 'episode':
|
elif parent_item.action in ['getmainlist', '', 'getchanneltypes']:
|
||||||
return 'episode', 'episodes'
|
|
||||||
|
|
||||||
elif not parent_item.action or parent_item.action in ['getmainlist']:
|
|
||||||
return 'home', addons
|
return 'home', addons
|
||||||
|
|
||||||
elif parent_item.action in ['filterchannels']:
|
elif parent_item.action in ['filterchannels']:
|
||||||
return 'channels', addons
|
return 'channels', addons
|
||||||
|
|
||||||
else:
|
elif item.action:
|
||||||
return 'menu', addons
|
return 'menu', addons
|
||||||
|
|
||||||
|
else:
|
||||||
|
return None, None
|
||||||
|
|
||||||
|
|
||||||
def set_view_mode(item, parent_item):
|
def set_view_mode(item, parent_item):
|
||||||
def reset_view_mode():
|
def reset_view_mode():
|
||||||
@@ -1082,6 +1100,8 @@ def play_video(item, strm=False, force_direct=False, autoplay=False):
|
|||||||
xlistitem.setProperty('inputstream' if PY3 else 'inputstreamaddon', 'inputstream.adaptive')
|
xlistitem.setProperty('inputstream' if PY3 else 'inputstreamaddon', 'inputstream.adaptive')
|
||||||
xlistitem.setProperty('inputstream.adaptive.manifest_type', 'hls')
|
xlistitem.setProperty('inputstream.adaptive.manifest_type', 'hls')
|
||||||
xlistitem.setMimeType('application/x-mpegURL')
|
xlistitem.setMimeType('application/x-mpegURL')
|
||||||
|
xlistitem.setProperty("inputstream.adaptive.license_type", item.drm)
|
||||||
|
xlistitem.setProperty("inputstream.adaptive.license_key", item.license)
|
||||||
|
|
||||||
if force_direct: item.window = True
|
if force_direct: item.window = True
|
||||||
|
|
||||||
@@ -1850,6 +1870,7 @@ def serverwindow(item, itemlist):
|
|||||||
self.itemlist = itemlist
|
self.itemlist = itemlist
|
||||||
self.item = item
|
self.item = item
|
||||||
self.servers = []
|
self.servers = []
|
||||||
|
items = []
|
||||||
self.selection = -1
|
self.selection = -1
|
||||||
|
|
||||||
for videoitem in self.itemlist:
|
for videoitem in self.itemlist:
|
||||||
@@ -1870,6 +1891,8 @@ def serverwindow(item, itemlist):
|
|||||||
it.setProperties({'name': title, 'channel': videoitem.ch_name, 'color': color if color else 'FF0082C2'})
|
it.setProperties({'name': title, 'channel': videoitem.ch_name, 'color': color if color else 'FF0082C2'})
|
||||||
it.setArt({'poster':self.item.contentThumbnail if self.item.contentThumbnail else self.item.thumbnail, 'thumb':videoitem.thumbnail, 'fanart':videoitem.fanart})
|
it.setArt({'poster':self.item.contentThumbnail if self.item.contentThumbnail else self.item.thumbnail, 'thumb':videoitem.thumbnail, 'fanart':videoitem.fanart})
|
||||||
self.servers.append(it)
|
self.servers.append(it)
|
||||||
|
items.append(videoitem)
|
||||||
|
self.itemlist = items
|
||||||
self.doModal()
|
self.doModal()
|
||||||
return self.selection
|
return self.selection
|
||||||
|
|
||||||
|
|||||||
+36
-15
@@ -14,6 +14,7 @@ else:
|
|||||||
from concurrent_py2 import futures
|
from concurrent_py2 import futures
|
||||||
|
|
||||||
mode = config.get_setting('result_mode', 'news')
|
mode = config.get_setting('result_mode', 'news')
|
||||||
|
cacheTime = 10
|
||||||
|
|
||||||
def mainlist(item):
|
def mainlist(item):
|
||||||
logger.debug()
|
logger.debug()
|
||||||
@@ -76,6 +77,7 @@ def news(item):
|
|||||||
|
|
||||||
else:
|
else:
|
||||||
itemlist = []
|
itemlist = []
|
||||||
|
itlist = []
|
||||||
results = cache(item.extra)
|
results = cache(item.extra)
|
||||||
if not results:
|
if not results:
|
||||||
progress = platformtools.dialog_progress(item.category, config.get_localized_string(60519))
|
progress = platformtools.dialog_progress(item.category, config.get_localized_string(60519))
|
||||||
@@ -83,17 +85,24 @@ def news(item):
|
|||||||
|
|
||||||
channelNames = [c[0] for c in channels]
|
channelNames = [c[0] for c in channels]
|
||||||
count = 0
|
count = 0
|
||||||
progress.update(int(count / len(channels)), ', '.join(c for c in channelNames))
|
# progress.update(int(count / len(channels)), ', '.join(c for c in channelNames))
|
||||||
|
|
||||||
|
# logger.dbg()
|
||||||
with futures.ThreadPoolExecutor() as executor:
|
with futures.ThreadPoolExecutor() as executor:
|
||||||
itlist = [executor.submit(get_newest, channel, item.extra, channels) for channel in channels]
|
for channel in channels:
|
||||||
|
if progress.iscanceled(): return
|
||||||
|
itlist.append(executor.submit(get_newest, channel, item.extra, channels))
|
||||||
for res in futures.as_completed(itlist):
|
for res in futures.as_completed(itlist):
|
||||||
if res.result():
|
if res.result():
|
||||||
name = res.result()[0]
|
name = res.result()[0]
|
||||||
channelNames.remove(name)
|
channelNames.remove(name)
|
||||||
progress.update(int(count + 1 / len(channels)), ', '.join(c for c in channelNames))
|
count += 1
|
||||||
|
percent = int((float(count) / len(channels)) * 100)
|
||||||
|
progress.update(percent, ', '.join(c for c in channelNames))
|
||||||
results.append(res.result())
|
results.append(res.result())
|
||||||
|
|
||||||
if progress:
|
if progress:
|
||||||
|
# progress.update(100, '')
|
||||||
progress.close()
|
progress.close()
|
||||||
|
|
||||||
cache(item.extra, results)
|
cache(item.extra, results)
|
||||||
@@ -110,7 +119,7 @@ def news(item):
|
|||||||
plot = ''
|
plot = ''
|
||||||
items = []
|
items = []
|
||||||
for it in res[2]:
|
for it in res[2]:
|
||||||
plot += '\n{}'.format(it.title)
|
plot += '\n{}'.format(platformtools.setTitle(it))
|
||||||
items.append(it.tourl())
|
items.append(it.tourl())
|
||||||
if items:
|
if items:
|
||||||
itemlist.append(Item(title='{} [{}]'.format(res[0], len(items)),
|
itemlist.append(Item(title='{} [{}]'.format(res[0], len(items)),
|
||||||
@@ -120,8 +129,8 @@ def news(item):
|
|||||||
thumbnail=channeltools.get_channel_parameters(res[1])["thumbnail"],
|
thumbnail=channeltools.get_channel_parameters(res[1])["thumbnail"],
|
||||||
items=items))
|
items=items))
|
||||||
itemlist.sort(key=lambda it: it.title)
|
itemlist.sort(key=lambda it: it.title)
|
||||||
elif mode in [0]:
|
|
||||||
|
|
||||||
|
elif mode in [0]:
|
||||||
items = {}
|
items = {}
|
||||||
for res in results:
|
for res in results:
|
||||||
_name, _id, _list = res
|
_name, _id, _list = res
|
||||||
@@ -129,9 +138,10 @@ def news(item):
|
|||||||
if it.fulltitle not in items:
|
if it.fulltitle not in items:
|
||||||
items[it.fulltitle] = []
|
items[it.fulltitle] = []
|
||||||
|
|
||||||
|
it.channelName = _name
|
||||||
items[it.fulltitle].append(it.tourl())
|
items[it.fulltitle].append(it.tourl())
|
||||||
|
|
||||||
itemlist = [Item(title='{} [{}]'.format(k, len(items)), infoLabels=Item().fromurl(v[0]).infoLabels, channel='news', action='movies', items = v) for k, v in items.items()]
|
itemlist = [Item(title='{} [{}]'.format(v, len(v) if len(v) > 1 else Item().fromurl(v[0]).channelName), infoLabels=Item().fromurl(v[0]).infoLabels, channel='news', action='movies', items = v) for v in items.values()]
|
||||||
|
|
||||||
if mode in [0, 2]:
|
if mode in [0, 2]:
|
||||||
itemlist = support.pagination(itemlist, item, 'news')
|
itemlist = support.pagination(itemlist, item, 'news')
|
||||||
@@ -167,27 +177,38 @@ def get_newest(channel, category, channels):
|
|||||||
|
|
||||||
|
|
||||||
def movies(item):
|
def movies(item):
|
||||||
itemlist = [Item().fromurl(url=it) for it in item.items]
|
if item.itemlist:
|
||||||
if mode == 1: tmdb.set_infoLabels_itemlist(itemlist, seekTmdb=True)
|
itemlist = support.itemlistdb()
|
||||||
|
else:
|
||||||
|
itemlist = [Item().fromurl(url=it) for it in item.items]
|
||||||
|
if len(itemlist) == 1:
|
||||||
|
from platformcode.launcher import run
|
||||||
|
run(itemlist[0])
|
||||||
|
if mode == 0:
|
||||||
|
for it in itemlist:
|
||||||
|
it.title = '{} [{}]'.format(it.title, it.channelName)
|
||||||
|
itemlist = support.pagination(itemlist, item, 'movies')
|
||||||
|
tmdb.set_infoLabels_itemlist(itemlist, seekTmdb=True)
|
||||||
return itemlist
|
return itemlist
|
||||||
|
|
||||||
|
|
||||||
def cache(_type, results=None):
|
def cache(_type, results=None):
|
||||||
from core import db
|
from core import db
|
||||||
from time import time
|
from time import time
|
||||||
news = db['news']
|
|
||||||
# logger.dbg()
|
# logger.dbg()
|
||||||
|
news = dict(db['news'][_type])
|
||||||
|
|
||||||
|
|
||||||
if results != None:
|
if results != None:
|
||||||
news[_type] = {}
|
news = {}
|
||||||
news[_type]['time'] = time()
|
news['time'] = time()
|
||||||
news[_type]['results'] = results
|
news['results'] = results
|
||||||
db['news'] = news
|
db['news'][_type] = news
|
||||||
|
|
||||||
elif news.get(_type, {}).get('time', 0) + 60 < time() :
|
elif news.get('time', 0) + 60 * cacheTime < time() :
|
||||||
results = []
|
results = []
|
||||||
else:
|
else:
|
||||||
results = news.get(_type, {}).get('results', [])
|
results = news.get('results', [])
|
||||||
db.close()
|
db.close()
|
||||||
return results
|
return results
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user