KoD 1.7.1
This commit is contained in:
32
.github/workflows/updateDomainsStable.yml
vendored
Normal file
32
.github/workflows/updateDomainsStable.yml
vendored
Normal file
@@ -0,0 +1,32 @@
|
||||
name: Update channel domains
|
||||
on:
|
||||
workflow_dispatch:
|
||||
schedule:
|
||||
- cron: '30 17 * * *'
|
||||
|
||||
jobs:
|
||||
update:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
|
||||
- uses: actions/checkout@v2
|
||||
with:
|
||||
ref: stable
|
||||
|
||||
- name: Set up Python ${{ matrix.python-version }}
|
||||
uses: actions/setup-python@v1
|
||||
with:
|
||||
python-version: 3.7
|
||||
|
||||
- name: Install dependencies
|
||||
run: pip install requests
|
||||
|
||||
- name: Update domains
|
||||
run: python tools/updateDomains.py
|
||||
|
||||
- name: Commit & Push changes
|
||||
uses: actions-js/push@master
|
||||
with:
|
||||
message: "Aggiornamento domini"
|
||||
branch: "stable"
|
||||
github_token: ${{ secrets.API_TOKEN_GITHUB }}
|
||||
@@ -1,4 +1,4 @@
|
||||
<addon id="plugin.video.kod" name="Kodi on Demand" version="1.7" provider-name="KoD Team">
|
||||
<addon id="plugin.video.kod" name="Kodi on Demand" version="1.7.1" provider-name="KoD Team">
|
||||
<requires>
|
||||
<!-- <import addon="script.module.libtorrent" optional="true"/> -->
|
||||
<import addon="metadata.themoviedb.org"/>
|
||||
@@ -27,9 +27,9 @@
|
||||
<screenshot>resources/media/screenshot-2.png</screenshot>
|
||||
<screenshot>resources/media/screenshot-3.png</screenshot>
|
||||
</assets>
|
||||
<news>- Aggiunto menu globale "opzioni di KoD"
|
||||
- Aggiunto canale tapmovie e server annessi
|
||||
- Notifica quando il tipo di vista viene salvata (con indicazione del tipo di contenuto)
|
||||
<news>- aggiunta opzione "vai a pagina" nel menu contestuale dell'item "successivo>"
|
||||
- riscritti canali mediaset e raiplay
|
||||
- migliorie varie, in particolare nell'ordinamento dei server
|
||||
</news>
|
||||
<description lang="it">Naviga velocemente sul web e guarda i contenuti presenti</description>
|
||||
<disclaimer>[COLOR red]The owners and submitters to this addon do not host or distribute any of the content displayed by these addons nor do they have any affiliation with the content providers.[/COLOR]
|
||||
|
||||
@@ -138,6 +138,7 @@ def newest(categoria):
|
||||
|
||||
|
||||
def check(item):
|
||||
item.contentType = 'tvshow'
|
||||
def get_season(pageData, seas_url, season):
|
||||
data = ''
|
||||
episodes = support.match(pageData if pageData else seas_url, patronBlock=patron_episode, patron=patron_option).matches
|
||||
@@ -155,7 +156,7 @@ def check(item):
|
||||
url = support.match(item, patron=r'<iframe id="iframeVid" width="[^"]+" height="[^"]+" src="([^"]+)" allowfullscreen').match
|
||||
seasons = support.match(url, patronBlock=patron_season, patron=patron_option)
|
||||
if not seasons.match:
|
||||
item.contentType = 'tvshow'
|
||||
item.contentType = 'movie'
|
||||
return findvideos(item)
|
||||
|
||||
data = ''
|
||||
|
||||
@@ -35,7 +35,9 @@ def mainlist(item):
|
||||
|
||||
def liveDict():
|
||||
livedict = {}
|
||||
for key in session.get(api + '/cms/routes/home?decorators=viewingHistory&include=default', headers=headers).json()['included']:
|
||||
|
||||
for key in session.get(api + '/cms/routes/canali?decorators=viewingHistory&include=default', headers=headers).json()['included']:
|
||||
|
||||
if key['type'] == 'channel' and key.get('attributes',{}).get('hasLiveStream', '') and 'Free' in key.get('attributes',{}).get('packages', []):
|
||||
title = key['attributes']['name']
|
||||
livedict[title] = {}
|
||||
|
||||
@@ -68,7 +68,7 @@ def episodios(item):
|
||||
data = support.match(item.url, headers=headers).data
|
||||
if 'accordion-item' in data:
|
||||
patronBlock = r'<span class="season[^>]*>\d+[^>]+>[^>]+>[^>]+>[^>]+>\D*(?:STAGIONE|Stagione)[ -]+(?P<lang>[a-zA-Z\- ]+)[^<]*</span>(?P<block>.*?)<div id="(?:season|disqus)'
|
||||
patron = r'<img src="(?P<thumb>[^"]+)">.*?<li class="season-no">(?P<season>\d+)(?:×|×|x)(?P<episode>\d+)[^<0-9]*<\/li>(?P<data>.*?javascript:;">(?P<title>[^<]+).*?</tbody>)'
|
||||
patron = r'<img src="(?P<thumb>[^"]+)"(?:[^>]*>){4}\s*<li class="season-no">(?P<season>\d+)(?:×|×|x)(?P<episode>\d+)[^<0-9]*<\/li>(?P<data>.*?javascript:;">(?P<title>[^<]+).*?</tbody>)'
|
||||
else:
|
||||
patronBlock = r'(?:STAGIONE|Stagione)(?:<[^>]+>)?\s*(?:(?P<lang>[A-Za-z- ]+))?(?P<block>.*?)(?: |<strong>|<div class="addtoany)'
|
||||
patron = r'(?:/>|p>)\s*(?P<season>\d+)(?:×|×|x)(?P<episode>\d+)[^<]+(?P<data>.*?)(?:<br|</p)'
|
||||
|
||||
@@ -84,6 +84,8 @@ def search(item, text):
|
||||
def peliculas(item):
|
||||
search = item.search
|
||||
disabletmdb = True
|
||||
addVideolibrary = False
|
||||
downloadEnabled = False
|
||||
action = 'episodios'
|
||||
patron = r'<a href="(?P<url>[^"]+)"[^>]+><div class="[^"]+" data-background-image="(?P<t>[^"]+)"></div><div class="titolo">\s*(?P<title>[^<]+)<'
|
||||
def itemHook(item):
|
||||
@@ -96,7 +98,7 @@ def peliculas(item):
|
||||
@support.scrape
|
||||
def episodios(item):
|
||||
data = support.match(item).data
|
||||
debug = True
|
||||
# debug = True
|
||||
action = 'play'
|
||||
if '>puntate<' in data:
|
||||
patronBlock = r'>puntate<(?P<block>.*?)home-block-outbrain'
|
||||
@@ -109,6 +111,7 @@ def episodios(item):
|
||||
patron = r'(?:<a href="(?P<url>[^"]+)">[^>]+><div class="[^"]+" data-background-image="(?P<t>[^"]*)">[^>]+>[^>]+>[^>]+>(?:[^>]+>)?(?:[^>]+>){6}?)\s*(?P<title>[^<]+)<(?:[^>]+>[^>]+>[^>]+><div class="data">(?P<date>[^<]+))?|class="heading">[^>]+>(?P<Title>[^<]+).*?window.shareUrl = "(?P<Url>[^"]+)".*?poster:\s*"(?P<Thumb>[^"]+)", title: "(?P<desc>[^"]+)"'
|
||||
patronNext = r'<a href="([^"]+)">›'
|
||||
addVideolibrary = False
|
||||
downloadEnabled = False
|
||||
|
||||
def itemHook(item):
|
||||
if item.Thumb: item.t = item.Thumb
|
||||
|
||||
@@ -8,6 +8,23 @@
|
||||
"categories": ["movie", "tvshow", "documentary", "live"],
|
||||
"not_active": ["include_in_newest"],
|
||||
"default_off": ["include_in_global_search"],
|
||||
"settings": [],
|
||||
"cloudflare": true
|
||||
"settings": [
|
||||
{
|
||||
"id": "mpd",
|
||||
"type": "bool",
|
||||
"label": "Preferisci mpd",
|
||||
"default": true,
|
||||
"enabled": true,
|
||||
"visible": true
|
||||
},
|
||||
{
|
||||
"id": "pagination",
|
||||
"type": "list",
|
||||
"label": "Pagination",
|
||||
"default": 1,
|
||||
"enabled": true,
|
||||
"visible": true,
|
||||
"lvalues": ["10", "20", "30", "40", "50", "60", "70", "80", "90", "100"]
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
@@ -2,359 +2,332 @@
|
||||
# ------------------------------------------------------------
|
||||
# Canale per Mediaset Play
|
||||
# ------------------------------------------------------------
|
||||
from platformcode import logger
|
||||
import uuid
|
||||
|
||||
from platformcode import logger, config
|
||||
import uuid, datetime, xbmc
|
||||
|
||||
import requests, sys
|
||||
from core import support
|
||||
if sys.version_info[0] >= 3: from urllib.parse import urlencode, quote
|
||||
else: from urllib import urlencode, quote
|
||||
if sys.version_info[0] >= 3: from concurrent import futures
|
||||
else: from concurrent_py2 import futures
|
||||
from collections import OrderedDict
|
||||
if sys.version_info[0] >= 3:
|
||||
from urllib.parse import urlencode, quote
|
||||
else:
|
||||
from urllib import urlencode, quote
|
||||
|
||||
PAGINATION = 4
|
||||
host = 'https://www.mediasetplay.mediaset.it'
|
||||
loginUrl = 'https://api-ott-prod-fe.mediaset.net/PROD/play/idm/anonymous/login/v2.0'
|
||||
|
||||
host = ''
|
||||
post_url = '?assetTypes=HD,browser,widevine,geoIT|geoNo:HD,browser,geoIT|geoNo:HD,geoIT|geoNo:SD,browser,widevine,geoIT|geoNo:SD,browser,geoIT|geoNo:SD,geoIT|geoNo&auto=true&balance=true&format=smil&formats=MPEG-DASH,MPEG4,M3U&tracking=true'
|
||||
deviceid = '61d27df7-5cbf-4419-ba06-cfd27ecd4588'
|
||||
loginUrl = 'https://api-ott-prod-fe.mediaset.net/PROD/play/idm/anonymous/login/v1.0'
|
||||
loginData = {"cid": deviceid, "platform": "pc", "appName": "web/mediasetplay-web/d667681"}
|
||||
lic_url = 'https://widevine.entitlement.theplatform.eu/wv/web/ModularDrm/getRawWidevineLicense?releasePid=%s&account=http://access.auth.theplatform.com/data/Account/2702976343&schema=1.0&token={token}|Accept=*/*&Content-Type=&User-Agent=' + support.httptools.get_user_agent() + '|R{{SSM}}|'
|
||||
entry = 'https://api.one.accedo.tv/content/entry/{id}?locale=it'
|
||||
entries = 'https://api.one.accedo.tv/content/entries?id={id}&locale=it'
|
||||
clientid = 'f66e2a01-c619-4e53-8e7c-4761449dd8ee'
|
||||
|
||||
|
||||
loginData = {"client_id": clientid, "platform": "pc", "appName": "web//mediasetplay-web/5.1.493-plus-da8885b"}
|
||||
sessionUrl = "https://api.one.accedo.tv/session?appKey=59ad346f1de1c4000dfd09c5&uuid={uuid}&gid=default"
|
||||
|
||||
current_session = requests.Session()
|
||||
current_session.headers.update({'Content-Type': 'application/json', 'User-Agent': support.httptools.get_user_agent(), 'Referer': support.config.get_channel_url()})
|
||||
session = requests.Session()
|
||||
session.headers.update({'Content-Type': 'application/json', 'User-Agent': support.httptools.get_user_agent(), 'Referer': host})
|
||||
|
||||
entry = 'https://api.one.accedo.tv/content/entry/{id}?locale=it'
|
||||
entries = 'https://api.one.accedo.tv/content/entries?id={id}&locale=it'
|
||||
|
||||
# login anonimo
|
||||
res = current_session.post(loginUrl, json=loginData, verify=False)
|
||||
Token = res.headers['t-cts']
|
||||
current_session.headers.update({'t-apigw': res.headers['t-apigw'], 't-cts': Token})
|
||||
lic_url = lic_url.format(token=Token)
|
||||
tracecid = res.json()['response']['traceCid']
|
||||
cwid = res.json()['response']['cwId']
|
||||
res = session.post(loginUrl, json=loginData, verify=False)
|
||||
Token = res.json()['response']['beToken']
|
||||
sid = res.json()['response']['sid']
|
||||
session.headers.update({'authorization': 'Bearer ' + Token})
|
||||
|
||||
# sessione
|
||||
res = current_session.get(sessionUrl.format(uuid=str(uuid.uuid4())), verify=False)
|
||||
current_session.headers.update({'x-session': res.json()['sessionKey']})
|
||||
sessionKey = session.get(sessionUrl.format(uuid=str(uuid.uuid4())), verify=False).json()['sessionKey']
|
||||
session.headers.update({'x-session': sessionKey})
|
||||
|
||||
cdict = {'CWFILMTOPVIEWED':'filmPiuVisti24H',
|
||||
'CWFILMCOMEDY':'filmCommedia',
|
||||
'CWFILMACTION':'filmAzioneThrillerAvventura',
|
||||
'CWFILMDRAMATIC':'filmDrammatico',
|
||||
'CWFILMSENTIMENTAL':'filmSentimentale',
|
||||
'CWFILMCLASSIC':'filmClassici',
|
||||
'personToContentFilm':'personToContentFilm',
|
||||
'CWHOMEFICTIONNOWELITE':'stagioniFictionSerieTvSezione',
|
||||
'CWFICTIONSOAP':'mostRecentSoapOpera',
|
||||
'CWFICTIONDRAMATIC':'stagioniFictionDrammatico',
|
||||
'CWFICTIONPOLICE':'stagioniFictionPoliziesco',
|
||||
'CWFICTIONCOMEDY':'stagioniFictionCommedia',
|
||||
'CWFICTIONSITCOM':'stagioniFictionSitCom',
|
||||
'CWFICTIONSENTIMENTAL':'stagioniFictionSentimentale',
|
||||
'CWFICTIONBIOGRAPHICAL':'stagioniFictionBiografico',
|
||||
'CWPROGTVPRIME':'stagioniPrimaSerata',
|
||||
'CWPROGTVDAY':'stagioniDaytime',
|
||||
'CWPROGTVTOPVIEWED':'programmiTvClip24H',
|
||||
'CWPROGTVTALENT':'stagioniReality',
|
||||
'CWPROGTVVARIETY':'stagioniVarieta',
|
||||
'CWPROGTVTALK':'stagioniTalk',
|
||||
'CWPROGTVTG':'mostRecentTg',
|
||||
'CWPROGTVSPORT':'mostRecentSport',
|
||||
'CWPROGTVMAGAZINE':'stagioniCucinaLifestyle',
|
||||
'CWDOCUMOSTRECENT':'mostRecentDocumentariFep',
|
||||
'CWDOCUTOPVIEWED':'stagioniDocumentari',
|
||||
'CWDOCUSPAZIO':'documentariSpazio',
|
||||
'CWDOCUNATURANIMALI':'documentariNatura',
|
||||
'CWDOCUSCIENZATECH':'documentariScienza',
|
||||
'CWDOCUBIOSTORIE':'documentariBioStoria',
|
||||
'CWDOCUINCHIESTE':'documentariInchiesta',
|
||||
'CWFILMDOCU':'filmDocumentario',
|
||||
'CWKIDSBOINGFORYOU':'kidsBoing',
|
||||
'CWKIDSCARTOONITO':'kidsCartoonito',
|
||||
'CWKIDSMEDIASETBRAND':'kidsMediaset',
|
||||
'CWENABLERKIDS':'stagioniKids'}
|
||||
pagination = [10, 20, 30, 40, 50, 60, 70, 80, 90, 100][config.get_setting('pagination', 'mediasetplay')]
|
||||
|
||||
|
||||
@support.menu
|
||||
def mainlist(item):
|
||||
top = [('Dirette {bold}', ['https://feed.entertainment.tv.theplatform.eu/f/PR1GhC/mediaset-prod-all-stations?sort=ShortTitle', 'live'])]
|
||||
top = [('Dirette {bold}', ['', 'live'])]
|
||||
|
||||
menu = [('Film {bullet bold}', ['5acfcbc423eec6000d64a6bb', 'menu', ['Tutti','all','searchMovie']]),
|
||||
('Fiction / Serie TV {bullet bold}', ['5acfcb3c23eec6000d64a6a4', 'menu', ['Tutte','all','searchStagioni'], 'tvshow']),
|
||||
('Programmi TV{ bullet bold}', ['5acfc8011de1c4000b6ec953', 'menu', ['Tutti','all','searchStagioni'], 'tvshow']),
|
||||
('Documentari {bullet bold}', ['5bfd17c423eec6001aec49f9', 'menu', ['Tutti','all',''], 'undefined']),
|
||||
('Kids {bullet bold}', ['5acfcb8323eec6000d64a6b3', 'menu',['Tutti','all',''], 'undefined']),
|
||||
('Family {bullet bold}', ['5e662d01a0e845001d56875b', 'menu',['Tutti','all',''], 'undefined']),
|
||||
]
|
||||
menu = [('Film {bullet bold}', ['/cinema', 'peliculas', {'uxReference':'filmUltimiArrivi'}, 'movie']),
|
||||
('Fiction / Serie TV {bullet bold}', ['/fiction', 'menu', '5acfcb3c23eec6000d64a6a4', 'tvshow']),
|
||||
('Programmi TV{ bullet bold}', ['/programmitv', 'menu', '5acfc8011de1c4000b6ec953', 'tvshow']),
|
||||
('Documentari {bullet bold}', ['/documentari', 'menu', '5bfd17c423eec6001aec49f9', 'undefined']),
|
||||
('Kids {bullet bold}', ['/kids', 'menu', '5acfcb8323eec6000d64a6b3', 'undefined'])]
|
||||
|
||||
search = ''
|
||||
return locals()
|
||||
|
||||
def menu(item):
|
||||
logger.debug()
|
||||
itemlist = []
|
||||
res = get_from_id(item)
|
||||
for it in res:
|
||||
if 'uxReference' in it:
|
||||
itemlist.append(item.clone(title=support.typo(it['title'], 'bullet bold'),
|
||||
url= it['landingUrl'],
|
||||
args={'uxReference':it.get('uxReferenceV2', ''), 'params':it.get('uxReferenceV2Params', ''), 'feed':it.get('feedurlV2','')},
|
||||
action='peliculas'))
|
||||
return itemlist
|
||||
|
||||
|
||||
def live(item):
|
||||
itemlist = []
|
||||
|
||||
res = session.get('https://static3.mediasetplay.mediaset.it/apigw/nownext/nownext.json').json()['response']
|
||||
allguide = res['listings']
|
||||
stations = res['stations']
|
||||
|
||||
for it in stations.values():
|
||||
plot = ''
|
||||
title = it['title']
|
||||
url = 'https:' + it['mediasetstation$pageUrl']
|
||||
if 'plus' in title.lower() or 'premium' in title.lower(): continue
|
||||
if it['callSign'] in allguide:
|
||||
|
||||
guide = allguide[it['callSign']]
|
||||
plot = '[B]{}[/B]\n{}\n\nA Seguire:\n[B]{}[/B]\n{}'.format(guide['currentListing']['mediasetlisting$epgTitle'],
|
||||
guide['currentListing']['description'],
|
||||
guide['nextListing']['mediasetlisting$epgTitle'],
|
||||
guide['nextListing']['description'],)
|
||||
|
||||
itemlist.append(item.clone(title=support.typo(title, 'bold'), fulltitle=title, callSign=it['callSign'], urls=guide['tuningInstruction']['urn:theplatform:tv:location:any'], plot=plot, url=url, action='play', forcethumb=True))
|
||||
|
||||
itemlist.sort(key=lambda it: support.channels_order.get(it.fulltitle, 999))
|
||||
support.thumb(itemlist, live=True)
|
||||
return itemlist
|
||||
|
||||
|
||||
def search(item, text):
|
||||
itemlist = []
|
||||
logger.debug(text)
|
||||
item.search = text
|
||||
item.args = {'uxReference':'main', 'params':'channel≈', 'query':text}
|
||||
|
||||
try:
|
||||
itemlist = peliculas(item)
|
||||
return peliculas(item)
|
||||
# Continua la ricerca in caso di errore
|
||||
except:
|
||||
import sys
|
||||
for line in sys.exc_info():
|
||||
support.logger.error("%s" % line)
|
||||
|
||||
return itemlist
|
||||
|
||||
|
||||
def menu(item):
|
||||
logger.debug()
|
||||
itemlist = []
|
||||
if item.url:
|
||||
json = get_from_id(item)
|
||||
for it in json:
|
||||
if 'uxReference' in it: itemlist.append(
|
||||
item.clone(title=support.typo(it['title'], 'bullet bold'), url= it['landingUrl'], ref=it['uxReference'], args='', action='peliculas'))
|
||||
return itemlist
|
||||
|
||||
|
||||
def liveDict():
|
||||
livedict = OrderedDict({})
|
||||
json = current_session.get('https://feed.entertainment.tv.theplatform.eu/f/PR1GhC/mediaset-prod-all-stations?sort=ShortTitle').json()['entries']
|
||||
for it in json:
|
||||
urls = []
|
||||
if it.get('tuningInstruction') and not it.get('mediasetstation$digitalOnly'):
|
||||
guide=current_session.get('https://static3.mediasetplay.mediaset.it/apigw/nownext/' + it['callSign'] + '.json').json()['response']
|
||||
for key in it['tuningInstruction']['urn:theplatform:tv:location:any']:
|
||||
urls += key['publicUrls']
|
||||
title = it['title']
|
||||
livedict[title] = {}
|
||||
livedict[title]['urls'] = urls
|
||||
livedict[title]['plot'] = support.typo(guide['currentListing']['mediasetlisting$epgTitle'],'bold') + '\n' + guide['currentListing']['mediasetlisting$shortDescription'] + '\n' + guide['currentListing']['description'] + '\n\n' + support.typo('A Seguire:' + guide['nextListing']['mediasetlisting$epgTitle'], 'bold')
|
||||
return livedict
|
||||
|
||||
|
||||
def live(item):
|
||||
logger.debug()
|
||||
itemlist = []
|
||||
for key, value in liveDict().items():
|
||||
itemlist.append(item.clone(title=support.typo(key, 'bold'),
|
||||
fulltitle=key,
|
||||
show=key,
|
||||
contentTitle=key,
|
||||
forcethumb=True,
|
||||
urls=value['urls'],
|
||||
plot=value['plot'],
|
||||
action='play',
|
||||
no_return=True))
|
||||
return support.thumb(itemlist, live=True)
|
||||
return []
|
||||
|
||||
|
||||
def peliculas(item):
|
||||
logger.debug()
|
||||
itemlist = []
|
||||
titlelist = []
|
||||
contentType = ''
|
||||
if item.text:
|
||||
json = []
|
||||
itlist = []
|
||||
with futures.ThreadPoolExecutor() as executor:
|
||||
for arg in ['searchMovie', 'searchStagioni', 'searchClip']:
|
||||
item.args = ['', 'search', arg]
|
||||
itlist += [executor.submit(get_programs, item)]
|
||||
for res in futures.as_completed(itlist):
|
||||
json += res.result()
|
||||
else:
|
||||
json = get_programs(item)
|
||||
for it in json:
|
||||
if item.search.lower() in it['title'].lower() and it['title'] not in titlelist:
|
||||
titlelist.append(it['title'])
|
||||
if 'media' in it:
|
||||
action = 'findvideos'
|
||||
contentType = 'movie'
|
||||
urls = []
|
||||
for key in it['media']:
|
||||
urls.append(key['publicUrl'])
|
||||
res = get_programs(item)
|
||||
video_id= ''
|
||||
|
||||
for it in res['items']:
|
||||
if not 'MediasetPlay_ANY' in it.get('mediasetprogram$channelsRights',['MediasetPlay_ANY']): continue
|
||||
thumb = ''
|
||||
fanart = ''
|
||||
contentSerieName = ''
|
||||
url = 'https:'+ it.get('mediasettvseason$pageUrl', it.get('mediasetprogram$videoPageUrl', it.get('mediasetprogram$pageUrl')))
|
||||
title = it.get('mediasetprogram$brandTitle', it.get('title'))
|
||||
title2 = it['title']
|
||||
if title != title2:
|
||||
title = '{} - {}'.format(title, title2)
|
||||
plot = it.get('longDescription', it.get('description', it.get('mediasettvseason$brandDescription', '')))
|
||||
|
||||
if it.get('seriesTitle') or it.get('seriesTvSeasons'):
|
||||
contentSerieName = it.get('seriesTitle', it.get('title'))
|
||||
contentType = 'tvshow'
|
||||
action = 'epmenu'
|
||||
else:
|
||||
contentType = 'movie'
|
||||
video_id = it['guid']
|
||||
action = 'play'
|
||||
for k, v in it['thumbnails'].items():
|
||||
if 'image_vertical' in k and not thumb:
|
||||
thumb = v['url'].replace('.jpg', '@3.jpg')
|
||||
if 'image_header_poster' in k and not fanart:
|
||||
fanart = v['url'].replace('.jpg', '@3.jpg')
|
||||
if thumb and fanart:
|
||||
break
|
||||
|
||||
itemlist.append(item.clone(title=support.typo(title, 'bold'),
|
||||
fulltitle=title,
|
||||
contentTitle=title,
|
||||
contentSerieName=contentSerieName,
|
||||
action=action,
|
||||
contentType=contentType,
|
||||
thumbnail=thumb,
|
||||
fanart=fanart,
|
||||
plot=plot,
|
||||
url=url,
|
||||
video_id=video_id,
|
||||
seriesid = it.get('seriesTvSeasons', it.get('id','')),
|
||||
disable_videolibrary = True,
|
||||
forcethumb=True))
|
||||
if res['next']:
|
||||
item.page = res['next']
|
||||
support.nextPage(itemlist, item)
|
||||
|
||||
else:
|
||||
action = 'epmenu'
|
||||
contentType = 'tvshow'
|
||||
urls = it['mediasetprogram$brandId']
|
||||
if urls:
|
||||
title = it['mediasetprogram$brandTitle'] + ' - ' if 'mediasetprogram$brandTitle' in it and it['mediasetprogram$brandTitle'] != it['title'] else ''
|
||||
itemlist.append(
|
||||
item.clone(channel=item.channel,
|
||||
action=action,
|
||||
title=support.typo(title + it['title'], 'bold'),
|
||||
fulltitle=it['title'],
|
||||
show=it['title'],
|
||||
contentType=contentType if contentType else item.contentType,
|
||||
contentTitle=it['title'] if 'movie' in [contentType, item.contentType] else '',
|
||||
contentSerieName=it['title'] if 'tvshow' in [contentType, item.contentType] else '',
|
||||
thumbnail=it['thumbnails']['image_vertical-264x396']['url'] if 'image_vertical-264x396' in it['thumbnails'] else '',
|
||||
fanart=it['thumbnails']['image_keyframe_poster-1280x720']['url'] if 'image_keyframe_poster-1280x720' in it['thumbnails'] else '',
|
||||
plot=it['longDescription'] if 'longDescription' in it else it['description'] if 'description' in it else '',
|
||||
urls=urls,
|
||||
seriesid = it.get('seriesId',''),
|
||||
url=it['mediasetprogram$pageUrl'],
|
||||
forcethumb=True,
|
||||
no_return=True))
|
||||
return itemlist
|
||||
|
||||
|
||||
def epmenu(item):
|
||||
logger.debug()
|
||||
itemlist = []
|
||||
|
||||
epUrl = 'https://feed.entertainment.tv.theplatform.eu/f/PR1GhC/mediaset-prod-all-subbrands-v2?byTvSeasonId={}&sort=mediasetprogram$order'
|
||||
|
||||
if item.seriesid:
|
||||
seasons = current_session.get('https://feed.entertainment.tv.theplatform.eu/f/PR1GhC/mediaset-prod-tv-seasons?bySeriesId=' + item.seriesid).json()['entries']
|
||||
for season in seasons:
|
||||
if 'mediasettvseason$brandId' in season and 'mediasettvseason$displaySeason' in season:
|
||||
if type(item.seriesid) == list:
|
||||
res = []
|
||||
for s in item.seriesid:
|
||||
itemlist.append(
|
||||
item.clone(seriesid = s['id'],
|
||||
title=support.typo(s['title'], 'bold')))
|
||||
if len(itemlist) == 1: return epmenu(itemlist[0])
|
||||
else:
|
||||
res = requests.get(epUrl.format(item.seriesid)).json()['entries']
|
||||
for it in res:
|
||||
itemlist.append(
|
||||
item.clone(seriesid = '',
|
||||
title=support.typo(season['mediasettvseason$displaySeason'], 'bold'),
|
||||
urls=season['mediasettvseason$brandId']))
|
||||
itemlist = sorted(itemlist, key=lambda it: it.title, reverse=True)
|
||||
if len(itemlist) == 1: return epmenu(itemlist[0])
|
||||
if not itemlist:
|
||||
entries = current_session.get('https://feed.entertainment.tv.theplatform.eu/f/PR1GhC/mediaset-prod-all-brands?byCustomValue={brandId}{' + item.urls + '}').json()['entries']
|
||||
for entry in entries:
|
||||
if 'mediasetprogram$subBrandId' in entry:
|
||||
itemlist.append(
|
||||
item.clone(action='episodios',
|
||||
title=support.typo(entry['description'], 'bold'),
|
||||
url=entry['mediasetprogram$subBrandId'],
|
||||
order=entry.get('mediasetprogram$order',0)))
|
||||
if len(itemlist) == 1: return episodios(itemlist[0])
|
||||
itemlist = sorted(itemlist, key=lambda it: it.order)
|
||||
return itemlist
|
||||
title=support.typo(it['description'], 'bold'),
|
||||
subbrand=it['mediasetprogram$subBrandId'],
|
||||
action='episodios'))
|
||||
itemlist = sorted(itemlist, key=lambda it: it.title, reverse=True)
|
||||
if len(itemlist) == 1: return episodios(itemlist[0])
|
||||
|
||||
return itemlist
|
||||
|
||||
def episodios(item):
|
||||
logger.debug()
|
||||
# create month list
|
||||
months = []
|
||||
try:
|
||||
for month in range(21, 33): months.append(xbmc.getLocalizedString(month))
|
||||
except: # per i test, xbmc.getLocalizedString non è supportato
|
||||
for month in range(21, 33): months.append('dummy')
|
||||
|
||||
itemlist = []
|
||||
if not item.nextIndex: item.nextIndex = 1
|
||||
res = requests.get('https://feed.entertainment.tv.theplatform.eu/f/PR1GhC/mediaset-prod-all-programs-v2?byCustomValue={subBrandId}{' + item.subbrand +'}&sort=:publishInfo_lastPublished|asc,tvSeasonEpisodeNumber').json()['entries']
|
||||
|
||||
url = 'https://feed.entertainment.tv.theplatform.eu/f/PR1GhC/mediaset-prod-all-programs?byCustomValue={subBrandId}{'+ item.url + '}&range=' + str(item.nextIndex) + '-' + str(item.nextIndex + PAGINATION)
|
||||
json = current_session.get(url).json()['entries']
|
||||
for it in res:
|
||||
thumb = ''
|
||||
titleDate = ''
|
||||
if 'mediasetprogram$publishInfo_lastPublished' in it:
|
||||
date = datetime.date.fromtimestamp(it['mediasetprogram$publishInfo_lastPublished'] / 1000)
|
||||
titleDate =' [{} {}]'.format(date.day, months[date.month])
|
||||
title = '[B]{}[/B]{}'.format(it['title'], titleDate)
|
||||
for k, v in it['thumbnails'].items():
|
||||
if 'image_keyframe' in k and not thumb:
|
||||
thumb = v['url'].replace('.jpg', '@3.jpg')
|
||||
break
|
||||
if not thumb: thumb = item.thumbnail
|
||||
|
||||
for it in json:
|
||||
urls = []
|
||||
if 'media' in it:
|
||||
for key in it['media']:
|
||||
urls.append(key['publicUrl'])
|
||||
if urls:
|
||||
title = it['title']
|
||||
itemlist.append(
|
||||
item.clone(action='findvideos',
|
||||
title=support.typo(title, 'bold'),
|
||||
contentType='episode',
|
||||
thumbnail=it['thumbnails']['image_vertical-264x396']['url'] if 'image_vertical-264x396' in it['thumbnails'] else '',
|
||||
fanart=it['thumbnails']['image_keyframe_poster-1280x720']['url'] if 'image_keyframe_poster-1280x720' in it['thumbnails'] else '',
|
||||
plot=it['longDescription'] if 'longDescription' in it else it['description'],
|
||||
urls=urls,
|
||||
url=it['mediasetprogram$pageUrl'],
|
||||
year=it.get('year',''),
|
||||
ep= it.get('tvSeasonEpisodeNumber', 0) if it.get('tvSeasonEpisodeNumber', 0) else 0,
|
||||
forcethumb=True,
|
||||
no_return=True))
|
||||
|
||||
if len(itemlist) == 1: return findvideos(itemlist[0])
|
||||
|
||||
if (len(json) >= PAGINATION):
|
||||
item.nextIndex += PAGINATION + 1
|
||||
support.nextPage(itemlist, item)
|
||||
itemlist.append(item.clone(title=title,
|
||||
thumbnail=thumb,
|
||||
forcethumb=True,
|
||||
contentType='episode',
|
||||
action='play',
|
||||
video_id=it['guid']))
|
||||
|
||||
return itemlist
|
||||
|
||||
|
||||
def findvideos(item):
|
||||
logger.debug()
|
||||
itemlist = [item.clone(server='directo', title='Mediaset Play', urls=item.urls, action='play')]
|
||||
return support.server(item, itemlist=itemlist, Download=False)
|
||||
|
||||
|
||||
def play(item):
|
||||
logger.debug()
|
||||
for url in item.urls:
|
||||
sec_data = support.match(url + post_url).data
|
||||
item.no_return=True
|
||||
mpd = config.get_setting('mpd', item.channel)
|
||||
|
||||
|
||||
lic_url = 'https://widevine.entitlement.theplatform.eu/wv/web/ModularDrm/getRawWidevineLicense?releasePid={pid}&account=http://access.auth.theplatform.com/data/Account/2702976343&schema=1.0&token={token}|Accept=*/*&Content-Type=&User-Agent={ua}|R{{SSM}}|'
|
||||
url = ''
|
||||
|
||||
if item.urls:
|
||||
url = ''
|
||||
pid = ''
|
||||
Format = 'dash+xml' if mpd else 'x-mpegURL'
|
||||
for it in item.urls:
|
||||
if Format in it['format']:
|
||||
item.url = requests.head(it['publicUrls'][0]).headers['Location']
|
||||
pid = it['releasePids'][0]
|
||||
|
||||
if mpd:
|
||||
item.manifest = 'mpd'
|
||||
item.drm = 'com.widevine.alpha'
|
||||
item.license = lic_url.format(pid=pid, token=Token, ua=support.httptools.get_user_agent())
|
||||
|
||||
else:
|
||||
item.manifest = 'hls'
|
||||
return[item]
|
||||
|
||||
elif item.video_id:
|
||||
payload = '{"contentId":"' + item.video_id + ' ","streamType":"VOD","delivery":"Streaming","createDevice":true}'
|
||||
res = session.post('https://api-ott-prod-fe.mediaset.net/PROD/play/playback/check/v2.0?sid=' + sid, data=payload).json()['response']['mediaSelector']
|
||||
|
||||
else:
|
||||
payload = '{"channelCode":"' + item.callSign + '","streamType":"LIVE","delivery":"Streaming","createDevice":true}'
|
||||
res = session.post('https://api-ott-prod-fe.mediaset.net/PROD/play/playback/check/v2.0?sid=' + sid, data=payload).json()['response']['mediaSelector']
|
||||
|
||||
url = res['url']
|
||||
mpd = True if 'dash' in res['formats'].lower() else False
|
||||
|
||||
if url:
|
||||
|
||||
sec_data = support.match(url + '?' + urlencode(res)).data
|
||||
item.url = support.match(sec_data, patron=r'<video src="([^"]+)').match
|
||||
pid = support.match(sec_data, patron=r'pid=([^|]+)').match
|
||||
item.manifest = 'mpd'
|
||||
|
||||
if pid:
|
||||
if mpd and pid:
|
||||
item.manifest = 'mpd'
|
||||
item.drm = 'com.widevine.alpha'
|
||||
item.license = lic_url % pid
|
||||
break
|
||||
item.license = lic_url.format(pid=pid, token=Token, ua=support.httptools.get_user_agent())
|
||||
else:
|
||||
item.manifest = 'hls'
|
||||
|
||||
return [item]
|
||||
|
||||
|
||||
def subBrand(json):
|
||||
logger.debug()
|
||||
subBrandId = current_session.get('https://feed.entertainment.tv.theplatform.eu/f/PR1GhC/mediaset-prod-all-brands?byCustomValue={brandId}{' + json + '}').json()['entries'][-1]['mediasetprogram$subBrandId']
|
||||
json = current_session.get('https://feed.entertainment.tv.theplatform.eu/f/PR1GhC/mediaset-prod-all-programs?byCustomValue={subBrandId}{' + subBrandId + '}').json()['entries']
|
||||
return json
|
||||
return [item]
|
||||
|
||||
|
||||
def get_from_id(item):
|
||||
logger.debug()
|
||||
json = current_session.get(entry.format(id=item.url)).json()
|
||||
if 'components' in json:
|
||||
id = quote(",".join(json["components"]))
|
||||
json = current_session.get(entries.format(id=id)).json()
|
||||
if 'entries' in json:
|
||||
return json['entries']
|
||||
sessionKey = session.get(sessionUrl.format(uuid=str(uuid.uuid4())), verify=False).json()['sessionKey']
|
||||
session.headers.update({'x-session': sessionKey})
|
||||
res = session.get(entry.format(id=item.args)).json()
|
||||
if 'components' in res:
|
||||
id = quote(",".join(res["components"]))
|
||||
res = session.get(entries.format(id=id)).json()
|
||||
if 'entries' in res:
|
||||
return res['entries']
|
||||
return {}
|
||||
|
||||
|
||||
def get_programs(item, ret=[], args={}):
|
||||
hasMore = False
|
||||
def get_programs(item):
|
||||
url = ''
|
||||
pag = item.page if item.page else 1
|
||||
ret = {}
|
||||
|
||||
if 'search' in item.args:
|
||||
args['uxReference'] = item.args[2]
|
||||
args["query"] = item.text
|
||||
args['traceCid'] = tracecid
|
||||
args['cwId'] = cwid
|
||||
args['page'] = 1
|
||||
args['platform'] = 'pc'
|
||||
args['hitsPerPage'] = 500
|
||||
url = 'https://api-ott-prod-fe.mediaset.net/PROD/play/rec2/search/v1.0?' + urlencode(args)
|
||||
elif not args:
|
||||
if item.ref in cdict:
|
||||
args['uxReference'] = cdict[item.ref]
|
||||
args['platform'] = 'pc'
|
||||
else:
|
||||
args = {"query": "*:*"}
|
||||
if item.args[2]:
|
||||
args['categories'] = item.args[2]
|
||||
if item.args.get('feed'):
|
||||
pag = item.page if item.page else 1
|
||||
url='{}&range={}-{}'.format(item.args.get('feed'), pag, pag + pagination - 1)
|
||||
ret['next'] = pag + pagination
|
||||
res = requests.get(url).json()
|
||||
|
||||
args['cwId'] = cwid
|
||||
args['traceCid'] = tracecid
|
||||
args['hitsPerPage'] = 500
|
||||
args['page'] = '0'
|
||||
args['deviceId'] = deviceid
|
||||
url="https://api-ott-prod-fe.mediaset.net/PROD/play/rec2/cataloguelisting/v1.0?" + urlencode(args)
|
||||
|
||||
# if 'all' in item.args: url = 'https://api-ott-prod-fe.mediaset.net/PROD/play/rec/azlisting/v1.0?' + urlencode(args)
|
||||
if url:
|
||||
json = current_session.get(url).json()
|
||||
if 'response' in json:
|
||||
json = json['response']
|
||||
if 'hasMore' in json:
|
||||
hasMore = json['hasMore']
|
||||
if 'components' in json:
|
||||
id = quote(",".join(json["components"]))
|
||||
json = current_session.get(entries.format(id=id)).json()
|
||||
if 'entries' in json:
|
||||
ret += json['entries']
|
||||
if hasMore:
|
||||
args['page'] = str(int(args['page']) + 1)
|
||||
return get_programs(item, ret, args)
|
||||
else:
|
||||
return ret
|
||||
else:
|
||||
return ret
|
||||
args = {key:value for key, value in item.args.items()}
|
||||
args['context'] = 'platform≈web'
|
||||
args['sid'] = sid
|
||||
args['sessionId'] = sid
|
||||
args['hitsPerPage'] = pagination
|
||||
args['property'] = 'search' if args.get('query') else 'play'
|
||||
args['tenant'] = 'play-prod-v2'
|
||||
args['page'] = pag
|
||||
args['deviceId'] = '017ac511182d008322c989f3aac803083002507b00bd0'
|
||||
url="https://api-ott-prod-fe.mediaset.net/PROD/play/reco/anonymous/v2.0?" + urlencode(args)
|
||||
|
||||
res = session.get(url).json()
|
||||
|
||||
if res:
|
||||
res = res.get('response', res)
|
||||
if 'entries' in res:
|
||||
ret['items'] = res['entries']
|
||||
elif 'blocks' in res:
|
||||
items = []
|
||||
for block in res['blocks']:
|
||||
items += block['items']
|
||||
ret['items'] = items
|
||||
if not 'next' in ret:
|
||||
next = res.get('pagination',{}).get('hasNextPage', False)
|
||||
ret['next'] = pag + 1 if next else 0
|
||||
return ret
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
369
channels/mediasetplay.py.old
Normal file
369
channels/mediasetplay.py.old
Normal file
@@ -0,0 +1,369 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# ------------------------------------------------------------
|
||||
# Canale per Mediaset Play
|
||||
# ------------------------------------------------------------
|
||||
from platformcode import logger, config
|
||||
import uuid
|
||||
|
||||
import requests, sys
|
||||
from core import support, jsontools
|
||||
if sys.version_info[0] >= 3: from urllib.parse import urlencode, quote
|
||||
else: from urllib import urlencode, quote
|
||||
if sys.version_info[0] >= 3: from concurrent import futures
|
||||
else: from concurrent_py2 import futures
|
||||
from collections import OrderedDict
|
||||
|
||||
PAGINATION = 4
|
||||
|
||||
host = config.get_channel_url()
|
||||
post_url = '?assetTypes=HD,browser,widevine,geoIT|geoNo:HD,browser,geoIT|geoNo:HD,geoIT|geoNo:SD,browser,widevine,geoIT|geoNo:SD,browser,geoIT|geoNo:SD,geoIT|geoNo&auto=true&balance=true&format=smil&formats=MPEG-DASH,MPEG4,M3U&tracking=true'
|
||||
deviceid = '61d27df7-5cbf-4419-ba06-cfd27ecd4588'
|
||||
loginUrl = 'https://api-ott-prod-fe.mediaset.net/PROD/play/idm/anonymous/login/v2.0'
|
||||
loginData = {"cid": deviceid, "platform": "pc", "appName": "web/mediasetplay-web/d667681"}
|
||||
lic_url = 'https://widevine.entitlement.theplatform.eu/wv/web/ModularDrm/getRawWidevineLicense?releasePid=%s&account=http://access.auth.theplatform.com/data/Account/2702976343&schema=1.0&token={token}|Accept=*/*&Content-Type=&User-Agent=' + support.httptools.get_user_agent() + '|R{{SSM}}|'
|
||||
entry = 'https://api.one.accedo.tv/content/entry/{id}?locale=it'
|
||||
entries = 'https://api.one.accedo.tv/content/entries?id={id}&locale=it'
|
||||
sessionUrl = "https://api.one.accedo.tv/session?appKey=59ad346f1de1c4000dfd09c5&uuid={uuid}&gid=default"
|
||||
|
||||
current_session = requests.Session()
|
||||
current_session.headers.update({'Content-Type': 'application/json', 'User-Agent': support.httptools.get_user_agent(), 'Referer': support.config.get_channel_url()})
|
||||
|
||||
# login anonimo
|
||||
res = current_session.post(loginUrl, json=loginData, verify=False)
|
||||
support.dbg()
|
||||
Token = res.json['response']['beToken']
|
||||
sid = res.json['response']['sid']
|
||||
current_session.headers.update({'authorization': 'Bearer' + Token})
|
||||
lic_url = lic_url.format(token=Token)
|
||||
tracecid = res.json()['response']['traceCid']
|
||||
cwid = res.json()['response']['cwId']
|
||||
|
||||
# sessione
|
||||
res = current_session.get(sessionUrl.format(uuid=str(uuid.uuid4())), verify=False)
|
||||
current_session.headers.update({'x-session': res.json()['sessionKey']})
|
||||
|
||||
cdict = {'CVFILM':'filmUltimiArrivi',
|
||||
'CWFILMTOPVIEWED':'filmPiuVisti24H',
|
||||
'CWFILMCOMEDY':'filmCommedia',
|
||||
'CWFILMACTION':'filmAzioneThrillerAvventura',
|
||||
'CWFILMDRAMATIC':'filmDrammatico',
|
||||
'CWFILMSENTIMENTAL':'filmSentimentale',
|
||||
'CWFILMCLASSIC':'filmClassici',
|
||||
'personToContentFilm':'personToContentFilm',
|
||||
'CWHOMEFICTIONNOWELITE':'stagioniFictionSerieTvSezione',
|
||||
'CWFICTIONSOAP':'mostRecentSoapOpera',
|
||||
'CWFICTIONDRAMATIC':'stagioniFictionDrammatico',
|
||||
'CWFICTIONPOLICE':'stagioniFictionPoliziesco',
|
||||
'CWFICTIONCOMEDY':'stagioniFictionCommedia',
|
||||
'CWFICTIONSITCOM':'stagioniFictionSitCom',
|
||||
'CWFICTIONSENTIMENTAL':'stagioniFictionSentimentale',
|
||||
'CWFICTIONBIOGRAPHICAL':'stagioniFictionBiografico',
|
||||
'CWPROGTVPRIME':'stagioniPrimaSerata',
|
||||
'CWPROGTVDAY':'stagioniDaytime',
|
||||
'CWPROGTVTOPVIEWED':'programmiTvClip24H',
|
||||
'CWPROGTVTALENT':'stagioniReality',
|
||||
'CWPROGTVVARIETY':'stagioniVarieta',
|
||||
'CWPROGTVTALK':'stagioniTalk',
|
||||
'CWPROGTVTG':'mostRecentTg',
|
||||
'CWPROGTVSPORT':'mostRecentSport',
|
||||
'CWPROGTVMAGAZINE':'stagioniCucinaLifestyle',
|
||||
'CWDOCUMOSTRECENT':'mostRecentDocumentariFep',
|
||||
'CWDOCUTOPVIEWED':'stagioniDocumentari',
|
||||
'CWDOCUSPAZIO':'documentariSpazio',
|
||||
'CWDOCUNATURANIMALI':'documentariNatura',
|
||||
'CWDOCUSCIENZATECH':'documentariScienza',
|
||||
'CWDOCUBIOSTORIE':'documentariBioStoria',
|
||||
'CWDOCUINCHIESTE':'documentariInchiesta',
|
||||
'CWFILMDOCU':'filmDocumentario',
|
||||
'CWKIDSBOINGFORYOU':'kidsBoing',
|
||||
'CWKIDSCARTOONITO':'kidsCartoonito',
|
||||
'CWKIDSMEDIASETBRAND':'kidsMediaset',
|
||||
'CWENABLERKIDS':'stagioniKids'}
|
||||
|
||||
|
||||
@support.menu
|
||||
def mainlist(item):
|
||||
top = [('Dirette {bold}', ['https://feed.entertainment.tv.theplatform.eu/f/PR1GhC/mediaset-prod-all-stations?sort=ShortTitle', 'live'])]
|
||||
|
||||
menu = [('Fiction / Serie TV {bullet bold}', ['/fiction', 'menu', ['Tutte','all','searchStagioni', '5acfcb3c23eec6000d64a6a4'], 'tvshow']),
|
||||
('Programmi TV{ bullet bold}', ['/programmitv', 'menu', ['Tutti','all','searchStagioni', '5acfc8011de1c4000b6ec953'], 'tvshow']),
|
||||
('Documentari {bullet bold}', ['/documentari', 'menu', ['Tutti','all','', '5bfd17c423eec6001aec49f9'], 'undefined']),
|
||||
('Kids {bullet bold}', ['/kids', 'menu',['Tutti','all','', '5acfcb8323eec6000d64a6b3'], 'undefined'])]
|
||||
|
||||
search = ''
|
||||
return locals()
|
||||
|
||||
|
||||
def search(item, text):
|
||||
itemlist = []
|
||||
logger.debug(text)
|
||||
item.search = text
|
||||
|
||||
try:
|
||||
itemlist = peliculas(item)
|
||||
except:
|
||||
import sys
|
||||
for line in sys.exc_info():
|
||||
support.logger.error("%s" % line)
|
||||
|
||||
return itemlist
|
||||
|
||||
|
||||
def menu(item):
|
||||
logger.debug()
|
||||
itemlist = []
|
||||
if item.url:
|
||||
json = get_from_id(item)
|
||||
for it in json:
|
||||
logger.debug(jsontools.dump(it))
|
||||
if 'uxReference' in it: itemlist.append(
|
||||
item.clone(title=support.typo(it['title'], 'bullet bold'), url= it['landingUrl'], feed = it.get('feedurlV2',''), ref=it['uxReference'], args='', action='peliculas'))
|
||||
return itemlist
|
||||
|
||||
|
||||
def liveDict():
|
||||
livedict = OrderedDict({})
|
||||
json = current_session.get('https://feed.entertainment.tv.theplatform.eu/f/PR1GhC/mediaset-prod-all-stations?sort=ShortTitle').json()['entries']
|
||||
for it in json:
|
||||
urls = []
|
||||
if it.get('tuningInstruction') and not it.get('mediasetstation$digitalOnly'):
|
||||
guide=current_session.get('https://static3.mediasetplay.mediaset.it/apigw/nownext/' + it['callSign'] + '.json').json()['response']
|
||||
for key in it['tuningInstruction']['urn:theplatform:tv:location:any']:
|
||||
urls += key['publicUrls']
|
||||
title = it['title']
|
||||
livedict[title] = {}
|
||||
livedict[title]['urls'] = urls
|
||||
livedict[title]['plot'] = support.typo(guide['currentListing']['mediasetlisting$epgTitle'],'bold') + '\n' + guide['currentListing']['mediasetlisting$shortDescription'] + '\n' + guide['currentListing']['description'] + '\n\n' + support.typo('A Seguire:' + guide['nextListing']['mediasetlisting$epgTitle'], 'bold')
|
||||
return livedict
|
||||
|
||||
|
||||
def live(item):
|
||||
logger.debug()
|
||||
itemlist = []
|
||||
for key, value in liveDict().items():
|
||||
itemlist.append(item.clone(title=support.typo(key, 'bold'),
|
||||
fulltitle=key,
|
||||
show=key,
|
||||
contentTitle=key,
|
||||
forcethumb=True,
|
||||
urls=value['urls'],
|
||||
plot=value['plot'],
|
||||
action='play',
|
||||
no_return=True))
|
||||
return support.thumb(itemlist, live=True)
|
||||
|
||||
|
||||
def peliculas(item):
|
||||
logger.debug()
|
||||
itemlist = []
|
||||
titlelist = []
|
||||
contentType = ''
|
||||
if item.text:
|
||||
json = []
|
||||
itlist = []
|
||||
with futures.ThreadPoolExecutor() as executor:
|
||||
for arg in ['searchMovie', 'searchStagioni', 'searchClip']:
|
||||
item.args = ['', 'search', arg]
|
||||
itlist += [executor.submit(get_programs, item)]
|
||||
for res in futures.as_completed(itlist):
|
||||
json += res.result()
|
||||
else:
|
||||
json = get_programs(item)
|
||||
|
||||
for it in json:
|
||||
if item.search.lower() in it['title'].lower() and it['title'] not in titlelist:
|
||||
titlelist.append(it['title'])
|
||||
if 'media' in it:
|
||||
action = 'findvideos'
|
||||
contentType = 'movie'
|
||||
urls = []
|
||||
for key in it['media']:
|
||||
urls.append(key['publicUrl'])
|
||||
|
||||
else:
|
||||
action = 'epmenu'
|
||||
contentType = 'tvshow'
|
||||
urls = it['mediasetprogram$brandId']
|
||||
if urls:
|
||||
title = it['mediasetprogram$brandTitle'] + ' - ' if 'mediasetprogram$brandTitle' in it and it['mediasetprogram$brandTitle'] != it['title'] else ''
|
||||
itemlist.append(
|
||||
item.clone(channel=item.channel,
|
||||
action=action,
|
||||
title=support.typo(title + it['title'], 'bold'),
|
||||
fulltitle=it['title'],
|
||||
show=it['title'],
|
||||
contentType=contentType if contentType else item.contentType,
|
||||
contentTitle=it['title'] if 'movie' in [contentType, item.contentType] else '',
|
||||
contentSerieName=it['title'] if 'tvshow' in [contentType, item.contentType] else '',
|
||||
thumbnail=it['thumbnails']['image_vertical-264x396']['url'] if 'image_vertical-264x396' in it['thumbnails'] else '',
|
||||
fanart=it['thumbnails']['image_keyframe_poster-1280x720']['url'] if 'image_keyframe_poster-1280x720' in it['thumbnails'] else '',
|
||||
plot=it['longDescription'] if 'longDescription' in it else it['description'] if 'description' in it else '',
|
||||
urls=urls,
|
||||
seriesid = it.get('seriesId',''),
|
||||
url=it['mediasetprogram$pageUrl'],
|
||||
forcethumb=True,
|
||||
no_return=True))
|
||||
if item.feed:
|
||||
item.page = item.page + 100 if item.page else 101
|
||||
support.nextPage(itemlist, item)
|
||||
return itemlist
|
||||
|
||||
|
||||
def epmenu(item):
|
||||
logger.debug()
|
||||
itemlist = []
|
||||
|
||||
if item.seriesid:
|
||||
seasons = current_session.get('https://feed.entertainment.tv.theplatform.eu/f/PR1GhC/mediaset-prod-tv-seasons?bySeriesId=' + item.seriesid).json()['entries']
|
||||
for season in seasons:
|
||||
if 'mediasettvseason$brandId' in season and 'mediasettvseason$displaySeason' in season:
|
||||
itemlist.append(
|
||||
item.clone(seriesid = '',
|
||||
title=support.typo(season['mediasettvseason$displaySeason'], 'bold'),
|
||||
urls=season['mediasettvseason$brandId']))
|
||||
itemlist = sorted(itemlist, key=lambda it: it.title, reverse=True)
|
||||
if len(itemlist) == 1: return epmenu(itemlist[0])
|
||||
if not itemlist:
|
||||
entries = current_session.get('https://feed.entertainment.tv.theplatform.eu/f/PR1GhC/mediaset-prod-all-brands?byCustomValue={brandId}{' + item.urls + '}').json()['entries']
|
||||
for entry in entries:
|
||||
if 'mediasetprogram$subBrandId' in entry:
|
||||
itemlist.append(
|
||||
item.clone(action='episodios',
|
||||
title=support.typo(entry['description'], 'bold'),
|
||||
url=entry['mediasetprogram$subBrandId'],
|
||||
order=entry.get('mediasetprogram$order',0)))
|
||||
if len(itemlist) == 1: return episodios(itemlist[0])
|
||||
itemlist = sorted(itemlist, key=lambda it: it.order)
|
||||
return itemlist
|
||||
|
||||
|
||||
def episodios(item):
|
||||
logger.debug()
|
||||
itemlist = []
|
||||
if not item.nextIndex: item.nextIndex = 1
|
||||
|
||||
url = 'https://feed.entertainment.tv.theplatform.eu/f/PR1GhC/mediaset-prod-all-programs?byCustomValue={subBrandId}{'+ item.url + '}&range=' + str(item.nextIndex) + '-' + str(item.nextIndex + PAGINATION)
|
||||
json = current_session.get(url).json()['entries']
|
||||
|
||||
for it in json:
|
||||
urls = []
|
||||
if 'media' in it:
|
||||
for key in it['media']:
|
||||
urls.append(key['publicUrl'])
|
||||
if urls:
|
||||
title = it['title']
|
||||
itemlist.append(
|
||||
item.clone(action='findvideos',
|
||||
title=support.typo(title, 'bold'),
|
||||
contentType='episode',
|
||||
thumbnail=it['thumbnails']['image_vertical-264x396']['url'] if 'image_vertical-264x396' in it['thumbnails'] else '',
|
||||
fanart=it['thumbnails']['image_keyframe_poster-1280x720']['url'] if 'image_keyframe_poster-1280x720' in it['thumbnails'] else '',
|
||||
plot=it['longDescription'] if 'longDescription' in it else it['description'],
|
||||
urls=urls,
|
||||
url=it['mediasetprogram$pageUrl'],
|
||||
year=it.get('year',''),
|
||||
ep= it.get('tvSeasonEpisodeNumber', 0) if it.get('tvSeasonEpisodeNumber', 0) else 0,
|
||||
forcethumb=True,
|
||||
no_return=True))
|
||||
|
||||
if len(itemlist) == 1: return findvideos(itemlist[0])
|
||||
|
||||
if (len(json) >= PAGINATION):
|
||||
item.nextIndex += PAGINATION + 1
|
||||
support.nextPage(itemlist, item)
|
||||
|
||||
return itemlist
|
||||
|
||||
|
||||
def findvideos(item):
|
||||
logger.debug()
|
||||
itemlist = [item.clone(server='directo', title='Mediaset Play', urls=item.urls, action='play')]
|
||||
return support.server(item, itemlist=itemlist, Download=False)
|
||||
|
||||
|
||||
def play(item):
|
||||
logger.debug()
|
||||
for url in item.urls:
|
||||
sec_data = support.match(url + post_url).data
|
||||
item.url = support.match(sec_data, patron=r'<video src="([^"]+)').match
|
||||
pid = support.match(sec_data, patron=r'pid=([^|]+)').match
|
||||
item.manifest = 'mpd'
|
||||
|
||||
if pid:
|
||||
item.drm = 'com.widevine.alpha'
|
||||
item.license = lic_url % pid
|
||||
break
|
||||
|
||||
return [item]
|
||||
|
||||
|
||||
def subBrand(json):
|
||||
logger.debug()
|
||||
subBrandId = current_session.get('https://feed.entertainment.tv.theplatform.eu/f/PR1GhC/mediaset-prod-all-brands?byCustomValue={brandId}{' + json + '}').json()['entries'][-1]['mediasetprogram$subBrandId']
|
||||
json = current_session.get('https://feed.entertainment.tv.theplatform.eu/f/PR1GhC/mediaset-prod-all-programs?byCustomValue={subBrandId}{' + subBrandId + '}').json()['entries']
|
||||
return json
|
||||
|
||||
|
||||
def get_from_id(item):
|
||||
logger.debug()
|
||||
json = current_session.get(entry.format(id=item.args[3])).json()
|
||||
if 'components' in json:
|
||||
id = quote(",".join(json["components"]))
|
||||
json = current_session.get(entries.format(id=id)).json()
|
||||
if 'entries' in json:
|
||||
return json['entries']
|
||||
return {}
|
||||
|
||||
|
||||
def get_programs(item, ret=[], args={}):
|
||||
hasMore = False
|
||||
url = ''
|
||||
# support.dbg()
|
||||
|
||||
if 'search' in item.args:
|
||||
args['uxReference'] = item.args[2]
|
||||
args["query"] = item.text
|
||||
args['traceCid'] = tracecid
|
||||
args['cwId'] = cwid
|
||||
args['page'] = 1
|
||||
args['platform'] = 'pc'
|
||||
args['hitsPerPage'] = 500
|
||||
url = 'https://api-ott-prod-fe.mediaset.net/PROD/play/rec2/search/v1.0?' + urlencode(args)
|
||||
elif item.feed:
|
||||
pag = item.page if item.page else 1
|
||||
url='{}&range={}-{}'.format(item.feed, pag, pag + 99)
|
||||
elif not args:
|
||||
if item.ref in cdict:
|
||||
args['uxReference'] = cdict[item.ref]
|
||||
args['platform'] = 'pc'
|
||||
else:
|
||||
args = {"query": "*:*"}
|
||||
if item.args[2]:
|
||||
args['categories'] = item.args[2]
|
||||
|
||||
args['cwId'] = cwid
|
||||
args['traceCid'] = tracecid
|
||||
args['hitsPerPage'] = 500
|
||||
args['page'] = '0'
|
||||
args['deviceId'] = deviceid
|
||||
url="https://api-ott-prod-fe.mediaset.net/PROD/play/rec2/cataloguelisting/v1.0?" + urlencode(args)
|
||||
|
||||
|
||||
if url:
|
||||
json = current_session.get(url).json()
|
||||
if 'response' in json:
|
||||
json = json['response']
|
||||
if 'hasMore' in json:
|
||||
hasMore = json['hasMore']
|
||||
if 'components' in json:
|
||||
id = quote(",".join(json["components"]))
|
||||
json = current_session.get(entries.format(id=id)).json()
|
||||
if 'entries' in json:
|
||||
ret += json['entries']
|
||||
if hasMore:
|
||||
args['page'] = str(int(args['page']) + 1)
|
||||
return get_programs(item, ret, args)
|
||||
else:
|
||||
return ret
|
||||
else:
|
||||
return ret
|
||||
@@ -3,35 +3,35 @@
|
||||
# Canale per Rai Play
|
||||
# ------------------------------------------------------------
|
||||
|
||||
import requests, sys, inspect
|
||||
from core import support, channeltools
|
||||
from platformcode import autorenumber, logger, platformtools
|
||||
from collections import OrderedDict
|
||||
from core.item import Item
|
||||
import datetime, xbmc
|
||||
import requests, sys
|
||||
|
||||
from core import jsontools, support
|
||||
from platformcode import logger
|
||||
|
||||
if sys.version_info[0] >= 3:
|
||||
from concurrent import futures
|
||||
else:
|
||||
from concurrent_py2 import futures
|
||||
|
||||
current_session = requests.Session()
|
||||
host = support.config.get_channel_url()
|
||||
onair = host + '/palinsesto/onAir.json'
|
||||
|
||||
|
||||
@support.menu
|
||||
def mainlist(item):
|
||||
top = [('Dirette {bold}', ['', 'live']),
|
||||
('Replay {bold}', ['/dl/RaiPlay/2016/PublishingBlock-9a2ff311-fcf0-4539-8f8f-c4fee2a71d58.html?json', 'replay_menu'])]
|
||||
top = [('Dirette {bold}', ['/dirette', 'live', '/palinsesto/onAir.json']),
|
||||
('Replay {bold}', ['/guidatv', 'replayMenu', '/guidatv.json'])]
|
||||
|
||||
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'])
|
||||
menu = [('Film {bullet bold}', ['/film', 'menu', '/tipologia/film/index.json']),
|
||||
('Serie TV {bullet bold}', ['/serietv', 'menu', '/tipologia/serietv/index.json']),
|
||||
('Fiction {bullet bold}', ['/fiction', 'menu', '/tipologia/fiction/index.json']),
|
||||
('Documentari {bullet bold}', ['/documentari', 'menu', '/tipologia/documentari/index.json']),
|
||||
('Programmi TV{bullet bold}', ['/programmi', 'menu', '/tipologia/programmi/index.json']),
|
||||
('Programmi per Bambini {bullet bold}', ['/bambini', 'menu', '/tipologia/bambini/index.json']),
|
||||
('Teen {bullet bold}', ['/teen', 'menu', '/tipologia/teen/index.json']),
|
||||
('Learning {bullet bold}', ['/learning', 'menu', '/tipologia/learning/index.json']),
|
||||
('Teche Rai {bullet bold storia}', ['/techerai', 'menu', '/tipologia/techerai/index.json']),
|
||||
('Musica e Teatro {bullet bold}', ['/musica-e-teatro', 'menu', '/tipologia/musica-e-teatro/index.json'])
|
||||
]
|
||||
|
||||
search = ''
|
||||
@@ -40,46 +40,115 @@ def mainlist(item):
|
||||
|
||||
|
||||
def menu(item):
|
||||
support.info()
|
||||
itemlist = [item.clone(title = support.typo('Tutti','bullet bold'), action = 'peliculas'),
|
||||
item.clone(title = support.typo('Generi','submenu'), args = 'genre', action = 'submenu'),
|
||||
item.clone(title = support.typo('A-Z','submenu'), args = 'az', action = 'submenu'),
|
||||
item.clone(title = support.typo('Cerca','submenu'), action = 'search')]
|
||||
logger.debug()
|
||||
itemlist = []
|
||||
item.disable_videolibrary = True
|
||||
action = 'peliculas'
|
||||
|
||||
return support.thumb(itemlist)
|
||||
if item.data:
|
||||
for it in item.data:
|
||||
url = getUrl(it['path_id'])
|
||||
action = 'genres'
|
||||
itemlist.append(item.clone(title=support.typo(it['name'], 'bold'), url=url.replace('.json','.html'), genre_url=url, data='', action=action))
|
||||
support.thumb(itemlist, genre=True)
|
||||
else:
|
||||
items = item.data if item.data else requests.get(host + item.args).json()['contents']
|
||||
for it in items:
|
||||
if 'RaiPlay Slider Block' in it['type'] or 'RaiPlay Slider Generi Block' in it['type']:
|
||||
thumb = item.thumbnail
|
||||
if 'RaiPlay Slider Generi Block' in it['type']:
|
||||
action = 'menu'
|
||||
thumb = support.thumb('genres')
|
||||
itemlist.append(item.clone(title=support.typo(it['name'], 'bold'), data=it.get('contents', item.data), thumbnail=thumb, action=action))
|
||||
|
||||
|
||||
def learning(item):
|
||||
support.info()
|
||||
itemlist =[]
|
||||
json = current_session.get(item.url).json()['contents']
|
||||
for key in json:
|
||||
itemlist.append(item.clone(title = support.typo(key['name'],'bold'), fulltitle = key['name'],
|
||||
show = key['name'], data = key['contents'], action = 'peliculas'))
|
||||
return itemlist
|
||||
|
||||
|
||||
def submenu(item):
|
||||
support.info()
|
||||
def genres(item):
|
||||
itemlist = []
|
||||
json = current_session.get(item.url).json()['contents'][-1]['contents']
|
||||
if item.args == 'az':
|
||||
json_url = getUrl(json[-1]['path_id'])
|
||||
json = current_session.get(json_url).json()['contents']
|
||||
for key in json:
|
||||
itemlist.append(item.clone(title = support.typo(key,'bold'), fulltitle = key,
|
||||
show = key, data = json[key], action = 'peliculas'))
|
||||
else:
|
||||
for key in json:
|
||||
itemlist.append(item.clone(title = support.typo(key['name'],'bold'), fulltitle = key['name'], show = key['name'],
|
||||
thumbnail = getUrl(key['image']), url = getUrl(key['path_id']), action = 'peliculas'))
|
||||
itemlist.pop(-1)
|
||||
return support.thumb(itemlist)
|
||||
items = requests.get(getUrl(item.genre_url)).json()['contents']
|
||||
for title, it in items.items():
|
||||
if it: itemlist.append(item.clone(title=support.typo(title, 'bold'), data=it, action='peliculas', thumbnail=support.thumb('az')))
|
||||
return itemlist
|
||||
|
||||
|
||||
def replay_menu(item):
|
||||
support.info()
|
||||
import datetime, xbmc
|
||||
def search(item, text):
|
||||
logger.debug(text)
|
||||
post = {'page':0, 'pagesize': 1000, 'param':text}
|
||||
|
||||
try:
|
||||
item.data = requests.post(host + '/atomatic/raiplay-search-service/api/v3/search', json=post).json()['agg']['titoli']['cards']
|
||||
return peliculas(item)
|
||||
# Continua la ricerca in caso di errore
|
||||
except:
|
||||
import sys
|
||||
for line in sys.exc_info():
|
||||
support.logger.error("%s" % line)
|
||||
return []
|
||||
|
||||
|
||||
def peliculas(item):
|
||||
logger.debug()
|
||||
return addinfo(item.data, item)
|
||||
|
||||
|
||||
def episodios(item):
|
||||
logger.debug()
|
||||
itemlist = []
|
||||
|
||||
if item.data:
|
||||
items = item.data
|
||||
elif item.season_url:
|
||||
items = requests.get(item.season_url).json()['items']
|
||||
elif item.video_url:
|
||||
items = requests.get(item.video_url).json()['blocks']
|
||||
|
||||
if 'sets' in items[0]:
|
||||
if len(items) > 1:
|
||||
itemlist = epMenu(item.clone(data=items))
|
||||
else:
|
||||
if len(items[0]['sets']) > 1:
|
||||
itemlist = epMenu(item.clone(data=items[0]['sets']))
|
||||
else:
|
||||
items = requests.get(getUrl(items[0]['sets'][0]['path_id'])).json()['items']
|
||||
|
||||
if not itemlist:
|
||||
itemlist = addinfo(items, item)
|
||||
|
||||
return itemlist
|
||||
|
||||
|
||||
def epMenu(item):
|
||||
video_url = ''
|
||||
itemlist = []
|
||||
for it in item.data:
|
||||
if 'sets' in it:
|
||||
itemlist.append(item.clone(title=support.typo(it['name'], 'bold'), data=[it]))
|
||||
else:
|
||||
itemlist.append(item.clone(title=support.typo(it['name'], 'bold'), season_url=getUrl(it['path_id']), data=''))
|
||||
return itemlist
|
||||
|
||||
|
||||
def live(item):
|
||||
logger.debug()
|
||||
itemlist = []
|
||||
item.forcethumb = True
|
||||
items = requests.get(getUrl(item.args)).json()['on_air']
|
||||
for it in items:
|
||||
title = it['channel']
|
||||
url = '{}/dirette/{}'.format(host, title.lower().replace(' ',''))
|
||||
fanart = getUrl(it['currentItem']['image'])
|
||||
current = it['currentItem']
|
||||
next = it['nextItem']
|
||||
plot = '[B]{}[/B]\n{}\n\nA Seguire: [B]{}[/B]\n{}'.format(current['name'], current['description'], next['name'], next['description'])
|
||||
itemlist.append(item.clone(title=title, fulltitle=title, fanart=fanart, plot=plot, url=url, video_url=url + '.json', action='play'))
|
||||
itemlist.sort(key=lambda it: support.channels_order.get(it.fulltitle, 999))
|
||||
support.thumb(itemlist, live=True)
|
||||
return itemlist
|
||||
|
||||
|
||||
def replayMenu(item):
|
||||
logger.debug()
|
||||
|
||||
# create day and month list
|
||||
days = []
|
||||
@@ -98,336 +167,133 @@ def replay_menu(item):
|
||||
today = datetime.date.today()
|
||||
for d in range(7):
|
||||
day = today - datetime.timedelta(days=d)
|
||||
support.info(day)
|
||||
itemlist.append(item.clone(action = 'replay_channels', date = day.strftime("%d-%m-%Y"),
|
||||
title = support.typo(days[int(day.strftime("%w"))] + " " + day.strftime("%d") + " " + months[int(day.strftime("%m"))-1], 'bold')))
|
||||
dayName = days[int(day.strftime("%w"))]
|
||||
dayNumber = day.strftime("%d")
|
||||
monthName = months[int(day.strftime("%m"))-1]
|
||||
title = '{} {} {}'.format(dayName, dayNumber, monthName)
|
||||
itemlist.append(item.clone(title = support.typo(title, 'bold'),
|
||||
action='replayChannels',
|
||||
date=day.strftime("%d-%m-%Y")))
|
||||
return itemlist
|
||||
|
||||
|
||||
def replay_channels(item):
|
||||
support.info()
|
||||
def replayChannels(item):
|
||||
logger.debug()
|
||||
itemlist = []
|
||||
json = current_session.get(item.url).json()['dirette']
|
||||
for key in json:
|
||||
itemlist.append(item.clone(title = support.typo(key['channel'], 'bold'), fulltitle = key['channel'], show = key['channel'], plot = item.title, action = 'replay',
|
||||
thumbnail = key['transparent-icon'].replace("[RESOLUTION]", "256x-"), url = '%s/palinsesto/app/old/%s/%s.json' % (host, key['channel'].lower().replace(' ','-'), item.date)))
|
||||
return itemlist
|
||||
items = requests.get(getUrl(item.args)).json()['channels']
|
||||
|
||||
for it in items:
|
||||
if 'RaiPlay' in it['name']: continue
|
||||
url = '{}?channel={}&date={}'.format(item.url, it['absolute_path'], item.date)
|
||||
channel_url = '{}/palinsesto/app/{}/{}.json'.format(host, it['absolute_path'], item.date)
|
||||
itemlist.append(item.clone(title=support.typo(it['label'], 'bold'),
|
||||
fulltitle=it['label'],
|
||||
url=url,
|
||||
channel_url=channel_url,
|
||||
action='replay'))
|
||||
itemlist.sort(key=lambda it: support.channels_order.get(it.fulltitle, 999))
|
||||
support.thumb(itemlist, live=True)
|
||||
return itemlist
|
||||
|
||||
def replay(item):
|
||||
support.info()
|
||||
logger.debug()
|
||||
|
||||
def itInfo(it):
|
||||
info = requests.get(getUrl(it['program']['info_url'])).json()
|
||||
image = getUrl(info['images']['landscape'])
|
||||
return item.clone(title = '{} - {}'.format(it['hour'], it['name']),
|
||||
thumbnail = image,
|
||||
fanart = image,
|
||||
plot = info['description'],
|
||||
url = getUrl(it['weblink']),
|
||||
video_url = getUrl(it['path_id']),
|
||||
action = 'play',
|
||||
forcethumb = True)
|
||||
|
||||
|
||||
itemlist = []
|
||||
json = current_session.get(item.url).json()[item.fulltitle][0]['palinsesto'][0]['programmi']
|
||||
for key in json:
|
||||
support.info('KEY=',key)
|
||||
if key and key['pathID']: itemlist.append(item.clone(thumbnail = getUrl(key['images']['landscape']), fanart = getUrl(key['images']['landscape']), url = getUrl(key['pathID']), fulltitle = key['name'], show = key['name'],
|
||||
title = support.typo(key['timePublished'], 'color kod bold') + support.typo(' | ' + key['name'], ' bold'), plot = key['testoBreve'], action = 'findvideos'))
|
||||
return itemlist
|
||||
|
||||
def search(item, text):
|
||||
support.info()
|
||||
itemlist =[]
|
||||
try:
|
||||
if item.url != host:
|
||||
item.search = text
|
||||
itemlist = peliculas(item)
|
||||
else:
|
||||
json = current_session.get(host + '/dl/RaiTV/RaiPlayMobile/Prod/Config/programmiAZ-elenco.json').json()
|
||||
for key in json:
|
||||
for key in json[key]:
|
||||
if 'PathID' in key and (text.lower() in key['name'].lower()):
|
||||
itemlist.append(item.clone(title = support.typo(key['name'],'bold'), fulltitle = key['name'], show = key['name'], url = key['PathID'].replace('/?json', '.json'), action = 'Type',
|
||||
thumbnail = getUrl(key['images']['portrait'] if 'portrait' in key['images'] else key['images']['portrait43'] if 'portrait43' in key['images'] else key['images']['landscape']),
|
||||
fanart = getUrl(key['images']['landscape'] if 'landscape' in key['images'] else key['images']['landscape43'])))
|
||||
except:
|
||||
import sys
|
||||
for line in sys.exc_info():
|
||||
support.logger.error("%s" % line)
|
||||
return []
|
||||
return itemlist
|
||||
|
||||
|
||||
def Type(item):
|
||||
logger.debug(item.url)
|
||||
json = current_session.get(item.url).json()
|
||||
if json['program_info']['layout'] == 'single':
|
||||
item.contentTitle = item.fulltitle
|
||||
item.contentType = 'movie'
|
||||
return findvideos(item)
|
||||
else:
|
||||
item.contentType = 'tvshow'
|
||||
return select(item)
|
||||
|
||||
|
||||
def liveDict():
|
||||
livedict = OrderedDict({})
|
||||
info = {}
|
||||
url = host + '/dirette.json'
|
||||
json = current_session.get(url).json()['contents']
|
||||
onAir = current_session.get(onair).json()['on_air']
|
||||
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 key in json:
|
||||
channel = key['channel']
|
||||
livedict[channel] = {}
|
||||
livedict[channel]['url'] = key['video']['content_url']
|
||||
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'], manifest='hls', no_return=True))
|
||||
return support.thumb(itemlist, live=True)
|
||||
|
||||
|
||||
def peliculas(item):
|
||||
support.info()
|
||||
itemlist = []
|
||||
keys = []
|
||||
key_list = []
|
||||
|
||||
# pagination options
|
||||
pag = item.page if item.page else 1
|
||||
pagination = 40 if not item.search else ''
|
||||
|
||||
# load json
|
||||
if item.data:
|
||||
json = item.data
|
||||
for key in json:
|
||||
if item.search.lower() in key['name'].lower():
|
||||
keys.append(key)
|
||||
else:
|
||||
json = current_session.get(item.url).json()
|
||||
|
||||
# load json for main menu item
|
||||
if not item.args:
|
||||
json_url = getUrl(json['contents'][-1]['contents'][-1]['path_id'])
|
||||
json = current_session.get(json_url).json()['contents']
|
||||
else:
|
||||
json = json['contents']
|
||||
for key in json:
|
||||
if len(json[key]) > 0:
|
||||
for key in json[key]:
|
||||
if item.search.lower() in key['name'].lower():
|
||||
keys.append(key)
|
||||
|
||||
# load titles
|
||||
for i, key in enumerate(keys):
|
||||
if pagination and (pag - 1) * pagination > i: continue # pagination
|
||||
if pagination and i >= pag * pagination: break
|
||||
key_list.append(key)
|
||||
items = requests.get(item.channel_url).json().get('events', {})
|
||||
now = datetime.datetime.now()
|
||||
h = int('{}{:02d}'.format(now.hour, now.minute))
|
||||
|
||||
with futures.ThreadPoolExecutor() as executor:
|
||||
itlist = [executor.submit(addinfo, key, item) for key in key_list]
|
||||
itlist = [executor.submit(itInfo, it) for it in items if it['has_video'] and int(it['hour'].replace(':','')) <= h]
|
||||
for res in futures.as_completed(itlist):
|
||||
if res.result():
|
||||
itemlist.append(res.result())
|
||||
itemlist = sorted(itemlist, key=lambda it: it.title)
|
||||
|
||||
if not item.search and len(keys) > pag * pagination:
|
||||
itemlist.append(item.clone(title=support.typo(support.config.get_localized_string(30992), 'color kod bold'), page=pag + 1, thumbnail=support.thumb()))
|
||||
if not itemlist:
|
||||
return [Item(title='Non ci sono Replay per questo Canale')]
|
||||
return itemlist
|
||||
|
||||
def play(item):
|
||||
logger.debug()
|
||||
|
||||
def select(item):
|
||||
support.info()
|
||||
itemlist = []
|
||||
if type(item.data) in [list, dict]:
|
||||
json = item.data
|
||||
else:
|
||||
json = current_session.get(item.url).json()
|
||||
if 'blocks' in json:
|
||||
json = json['blocks']
|
||||
season = ''
|
||||
for key in json:
|
||||
if item.fulltitle in key['name']: season = key['name'].replace(item.fulltitle, '').strip()
|
||||
if not season.isdigit(): season = ''
|
||||
itemlist.append(item.clone(title = support.typo(key['name'],'bold'), season = season, data = key['sets'], action = 'select'))
|
||||
if len(itemlist) == 1:
|
||||
return select(itemlist[0])
|
||||
else:
|
||||
if item.data:
|
||||
for key in item.data:
|
||||
itemlist.append(item.clone(title = support.typo(key['name'], 'bold'), data = getUrl(key['path_id']), url = getUrl(key['path_id']), contentType = 'tvshow', action = 'episodios'))
|
||||
if len(itemlist) == 1:
|
||||
return episodios(itemlist[0])
|
||||
elif 'contents' in json:
|
||||
for letter in json['contents'].keys():
|
||||
if json['contents'][letter]:
|
||||
itemlist.extend(peliculas(item.clone(data=json['contents'][letter])))
|
||||
return itemlist
|
||||
res = requests.get(item.video_url).json()
|
||||
|
||||
if 'first_item_path' in res:
|
||||
res = requests.get(getUrl(res['first_item_path'])).json()
|
||||
|
||||
url, lic = support.match(res['video']['content_url'] + '&output=56', patron=r'content"><!\[CDATA\[([^\]]+)(?:.*?"WIDEVINE","licenceUrl":"([^"]+))?').match
|
||||
|
||||
if lic:
|
||||
item.drm = 'com.widevine.alpha'
|
||||
item.license = lic + '|' + host + '|R{SSM}|'
|
||||
|
||||
item = item.clone(server='directo', url=url, no_return=True, manifest='hls')
|
||||
|
||||
return [item]
|
||||
|
||||
|
||||
def episodios(item):
|
||||
support.info()
|
||||
itemlist = []
|
||||
if type(item.data) in [list, dict] and len(item.data) > 1 and ('name' in item.data[0] and 'stagione' not in item.data[0]['name'].lower()):
|
||||
for key in item.data:
|
||||
itemlist.append(item.clone(title = support.typo(key['name'], 'bold'), url = getUrl(key['path_id']), contentType = 'tvshow', action = 'episodios'))
|
||||
def getUrl(url):
|
||||
logger.debug()
|
||||
|
||||
elif type(item.data) in [list, dict]:
|
||||
for key in item.data:
|
||||
load_episodes(key, item)
|
||||
with futures.ThreadPoolExecutor() as executor:
|
||||
itlist = [executor.submit(load_episodes, key, item) for key in item.data]
|
||||
for res in futures.as_completed(itlist):
|
||||
if res.result():
|
||||
itemlist += res.result()
|
||||
if itemlist and itemlist[0].VL:
|
||||
# itemlist.reverse()
|
||||
itemlist = sorted(itemlist, key=lambda it: it.order)
|
||||
item.action = 'episodios'
|
||||
support.videolibrary(itemlist, item)
|
||||
else:
|
||||
itemlist = sorted(itemlist, key=lambda it: it.title)
|
||||
if url.startswith("/raiplay/"): url = url.replace("/raiplay/", host +'/')
|
||||
elif url.startswith("//"): url = "https:" + url
|
||||
elif url.startswith("/"): url = host + url
|
||||
|
||||
else:
|
||||
date = ''
|
||||
if type(item.data) in [list, dict]: item.data = getUrl(item.url[0]['path_id'])
|
||||
json = current_session.get(item.url).json()['items']
|
||||
for key in json:
|
||||
ep = support.match(key['subtitle'], patron=r'(?:St\s*(\d+))?\s*Ep\s*(\d+)').match
|
||||
if ep:
|
||||
season = '1' if not ep[0] else ep[0]
|
||||
episode = ep[1].zfill(2)
|
||||
title = support.re.sub(r'(?:St\s*\d+)?\s*Ep\s*\d+','',key['subtitle'])
|
||||
title = season + 'x' + episode + (' - ' + title if not title.startswith(' ') else title if title else '')
|
||||
elif item.season and support.match(item.title.lower(), patron =r'(puntate)').match:
|
||||
title = key['subtitle'].strip()
|
||||
if not title: title = key['name']
|
||||
date = support.match(title, patron=r'(\d+/\d+/\d+)').match
|
||||
if date:
|
||||
date = title.split('/')
|
||||
date = date[2][-2] + '/' + date[1] + '/' + date[0]
|
||||
|
||||
else:
|
||||
title = key['subtitle'].strip()
|
||||
if not title:
|
||||
title = key['name']
|
||||
itemlist.append(item.clone(title = support.typo(title, 'bold'), action = 'findvideos', VL=True if ep else False, plot = key['description'],
|
||||
fanart = getUrl(key['images']['landscape']), url = key['video_url'], contentType = 'episode', date=date))
|
||||
|
||||
if item.season and support.match(item.title.lower(), patron =r'(puntate)').match:
|
||||
itemlist = sorted(itemlist, key=lambda it: it.date)
|
||||
for i, it in enumerate(itemlist):
|
||||
episode = str(i + 1)
|
||||
it.title = support.typo(item.season + 'x' + episode, 'bold') + (' - ' + it.title)
|
||||
|
||||
if itemlist and itemlist[0].VL: support.videolibrary(itemlist, item)
|
||||
|
||||
if itemlist and not support.match(itemlist[0].title, patron=r'[Ss]?(\d+)(?:x|_|\.|\s+)[Ee]?[Pp]?(\d+)').match and inspect.stack()[1][3] not in ['find_episodes']:
|
||||
autorenumber.start(itemlist, item)
|
||||
return itemlist
|
||||
|
||||
|
||||
def findvideos(item):
|
||||
support.info()
|
||||
itemlist = []
|
||||
if item.url.endswith('json'):
|
||||
json = current_session.get(item.url).json()
|
||||
|
||||
if 'first_item_path' in json:
|
||||
url = current_session.get(getUrl(json['first_item_path'])).json()['video']['content_url']
|
||||
else:
|
||||
url = json['video']['content_url']
|
||||
else:
|
||||
url = item.url
|
||||
|
||||
itemlist.append(item.clone(server = 'directo', title = 'Rai Play', url = getUrl(url) + '&output=56', action = 'play'))
|
||||
return support.server(item, itemlist=itemlist, Download=False)
|
||||
|
||||
|
||||
def getUrl(pathId):
|
||||
support.info()
|
||||
url = pathId.replace(" ", "%20")
|
||||
if url.startswith("/raiplay/"):
|
||||
url = url.replace("/raiplay/",host +'/')
|
||||
|
||||
if url.startswith("//"):
|
||||
url = "https:" + url
|
||||
elif url.startswith("/"):
|
||||
url = host + url
|
||||
|
||||
# fix format of url for json
|
||||
if url.endswith(".html?json"):
|
||||
url = url.replace(".html?json", ".json")
|
||||
elif url.endswith("/?json"):
|
||||
url = url.replace("/?json",".json")
|
||||
elif url.endswith("?json"):
|
||||
url = url.replace("?json",".json")
|
||||
url = url.replace(".html?json", ".json").replace("/?json",".json").replace("?json",".json").replace(" ", "%20")
|
||||
|
||||
return url
|
||||
|
||||
|
||||
def addinfo(key, item):
|
||||
support.info()
|
||||
info = current_session.get(getUrl(key['info_url'])).json() if 'info_url' in key else {}
|
||||
if 'images' in key:
|
||||
fanart = key['images']['landscape']
|
||||
if key['images']['portrait_logo']:
|
||||
thumb = key['images']['portrait_logo']
|
||||
def addinfo(items, item):
|
||||
def itInfo(key, item):
|
||||
logger.debug(jsontools.dump(key))
|
||||
item.forcethumb = True
|
||||
if key.get('titolo', ''):
|
||||
key = requests.get(getUrl(key['path_id'])).json()['program_info']
|
||||
|
||||
|
||||
info = requests.get(getUrl(key['info_url'])).json() if 'info_url' in key else {}
|
||||
|
||||
images = info.get('images', {})
|
||||
fanart = images.get('landscape', '')
|
||||
thumb = images.get('portrait_logo', '')
|
||||
if not thumb: thumb = fanart
|
||||
title = key.get('name', '')
|
||||
|
||||
it = item.clone(title=support.typo(title, 'bold'),
|
||||
data='',
|
||||
fulltitle=title,
|
||||
show=title,
|
||||
thumbnail= getUrl(thumb),
|
||||
fanart=getUrl(fanart),
|
||||
url=getUrl(key.get('weblink', '')),
|
||||
video_url=getUrl(key['path_id']),
|
||||
plot=info.get('description', ''))
|
||||
|
||||
if 'Genere' not in key.get('sub_type', '') and ('layout' not in key or key['layout'] == 'single'):
|
||||
it.action = 'play'
|
||||
it.contentTitle = it.fulltitle
|
||||
else:
|
||||
thumb = key['images']['landscape']
|
||||
else:
|
||||
thumb = ''
|
||||
fanart = ''
|
||||
it = item.clone(title=support.typo(key.get('name', ''), 'bold'), fulltitle=key.get('name', ''),
|
||||
show=key.get('name', ''), data='', thumbnail=getUrl(thumb),
|
||||
fanart=getUrl(fanart), url=getUrl(key['path_id']), plot=info.get('description', ''))
|
||||
it.action = 'episodios'
|
||||
it.contentSerieName = it.fulltitle
|
||||
return it
|
||||
|
||||
if 'Genere' not in key.get('sub_type', '') and ('layout' not in key or key['layout'] == 'single'):
|
||||
it.action = 'findvideos'
|
||||
it.contentType = 'movie'
|
||||
it.contentTitle = it.fulltitle
|
||||
else:
|
||||
it.action = 'select'
|
||||
it.contentType = 'tvshow'
|
||||
it.contentSerieName = it.fulltitle
|
||||
return it
|
||||
|
||||
|
||||
def load_episodes(key, item):
|
||||
support.info()
|
||||
itemlist = []
|
||||
json = current_session.get(getUrl(key['path_id'])).json()['items']
|
||||
order = 0
|
||||
for key in json:
|
||||
ep = support.match(key['subtitle'], patron=r'(?:St\s*(\d+))?\s*Ep\s*(\d+)').match
|
||||
if ep:
|
||||
season = '1' if not ep[0] else ep[0]
|
||||
episode = ep[1].zfill(2)
|
||||
title = season + 'x' + episode + support.re.sub(r'(?:St\s*\d+)?\s*Ep\s*\d+','',key['subtitle'])
|
||||
order = int(season + episode)
|
||||
else:
|
||||
title = key['subtitle'].strip()
|
||||
if not title:
|
||||
title = key['name']
|
||||
|
||||
itemlist.append(item.clone(title = support.typo(title, 'bold'), url = key['video_url'], contentType = 'episode',
|
||||
fanart = getUrl(key['images']['landscape']), plot = key['description'],
|
||||
action = 'findvideos', VL=True if ep else False, order=order))
|
||||
return itemlist
|
||||
|
||||
|
||||
def play(item):
|
||||
if item.livefilter:
|
||||
d = liveDict()
|
||||
item = item.clone(server='directo', fulltitle=item.livefilter, url=d[item.livefilter]['url'], plot=d[item.livefilter]['plot'], forcethumb=True, no_return=True)
|
||||
support.thumb(item, live=True)
|
||||
if '&output=56' in item.url:
|
||||
match = support.match(item, patron=r'content"><!\[CDATA\[([^\]]+)(?:.*?"WIDEVINE","licenceUrl":"([^"]+))?').match
|
||||
item.url = match[0]
|
||||
if len(match) == 2:
|
||||
item.drm = 'com.widevine.alpha'
|
||||
item.license = match[1] + '|' + host + '|R{SSM}|'
|
||||
logger.debug('PLAY URL', item.url)
|
||||
return [item]
|
||||
with futures.ThreadPoolExecutor() as executor:
|
||||
itlist = [executor.submit(itInfo, it, item) for it in items]
|
||||
for res in futures.as_completed(itlist):
|
||||
if res.result():
|
||||
itemlist.append(res.result())
|
||||
return itemlist
|
||||
192
core/autoplay.py
192
core/autoplay.py
@@ -39,32 +39,7 @@ def start(itemlist, item):
|
||||
if not config.is_xbmc():
|
||||
return itemlist
|
||||
|
||||
if config.get_setting('autoplay'):
|
||||
url_list_valid = []
|
||||
autoplay_list = []
|
||||
autoplay_b = []
|
||||
favorite_quality = []
|
||||
favorite_servers = []
|
||||
blacklisted_servers = config.get_setting("black_list", server='servers', default = [])
|
||||
favorite_servers = config.get_setting('favorites_servers_list', server='servers', default = [])
|
||||
|
||||
from core import servertools
|
||||
|
||||
servers_list = list(servertools.get_servers_list().items())
|
||||
for server, server_parameters in servers_list:
|
||||
if config.get_setting('favorites_servers_list', server=server) and server.lower() not in favorite_servers:
|
||||
favorite_servers.append(server.lower())
|
||||
|
||||
if not favorite_servers:
|
||||
config.set_setting('favorites_servers_list', [], server='servers')
|
||||
favorite_servers = []
|
||||
else:
|
||||
s_list = []
|
||||
for s in favorite_servers:
|
||||
if s not in blacklisted_servers:
|
||||
s_list.append(s)
|
||||
favorite_servers = s_list
|
||||
|
||||
if config.get_setting('autoplay') or (item.channel == 'community' and item.autoplay):
|
||||
# Save the current value of "Action and Player Mode" in preferences
|
||||
user_config_setting_action = config.get_setting("default_action")
|
||||
# user_config_setting_player = config.get_setting("player_mode")
|
||||
@@ -72,133 +47,12 @@ def start(itemlist, item):
|
||||
# Enable the "View in high quality" action (if the server returns more than one quality, eg gdrive)
|
||||
if not user_config_setting_action: config.set_setting("default_action", 2)
|
||||
|
||||
# if user_config_setting_player != 0: config.set_setting("player_mode", 0)
|
||||
from core.servertools import sort_servers
|
||||
autoplay_list = sort_servers(itemlist)
|
||||
|
||||
# Priorities when ordering itemlist:
|
||||
# 0: Servers and qualities
|
||||
# 1: Qualities and servers
|
||||
# 2: Servers only
|
||||
# 3: Only qualities
|
||||
# 4: Do not order
|
||||
|
||||
if config.get_setting('favorites_servers') and favorite_servers and config.get_setting('default_action'):
|
||||
priority = 0 # 0: Servers and qualities or 1: Qualities and servers
|
||||
elif config.get_setting('favorites_servers') and favorite_servers:
|
||||
priority = 2 # Servers only
|
||||
elif config.get_setting('default_action'):
|
||||
priority = 3 # Only qualities
|
||||
else:
|
||||
priority = 4 # Do not order
|
||||
|
||||
if config.get_setting('default_action') == 1:
|
||||
quality_list.reverse()
|
||||
favorite_quality = quality_list
|
||||
for item in itemlist:
|
||||
autoplay_elem = dict()
|
||||
b_dict = dict()
|
||||
|
||||
# We check that it is a video item
|
||||
if 'server' not in item:
|
||||
continue
|
||||
|
||||
if item.server.lower() in blacklisted_servers:
|
||||
continue
|
||||
|
||||
# If it does not have a defined quality, it assigns a 'default' quality.
|
||||
if item.quality.lower() not in quality_list:
|
||||
item.quality = 'default'
|
||||
# The list for custom settings is created
|
||||
|
||||
if priority < 2: # 0: Servers and qualities or 1: Qualities and servers
|
||||
|
||||
# if the server and the quality are not in the favorites lists or the url is repeated, we discard the item
|
||||
if item.server.lower() not in favorite_servers or item.quality.lower() not in favorite_quality or item.url in url_list_valid:
|
||||
item.type_b = True
|
||||
item.window = base_item.window
|
||||
b_dict['videoitem']= item
|
||||
autoplay_b.append(b_dict)
|
||||
continue
|
||||
autoplay_elem["indice_server"] = favorite_servers.index(item.server.lower())
|
||||
autoplay_elem["indice_quality"] = favorite_quality.index(item.quality.lower())
|
||||
|
||||
elif priority == 2: # Servers only
|
||||
|
||||
# if the server is not in the favorites list or the url is repeated, we discard the item
|
||||
if item.server.lower() not in favorite_servers or item.url in url_list_valid:
|
||||
item.type_b = True
|
||||
item.window = base_item.window
|
||||
b_dict['videoitem'] = item
|
||||
autoplay_b.append(b_dict)
|
||||
continue
|
||||
autoplay_elem["indice_server"] = favorite_servers.index(item.server.lower())
|
||||
|
||||
elif priority == 3: # Only qualities
|
||||
|
||||
# if the quality is not in the favorites list or the url is repeated, we discard the item
|
||||
if item.quality.lower() not in favorite_quality or item.url in url_list_valid:
|
||||
item.type_b = True
|
||||
item.window = base_item.window
|
||||
b_dict['videoitem'] = item
|
||||
autoplay_b.append(b_dict)
|
||||
continue
|
||||
autoplay_elem["indice_quality"] = favorite_quality.index(item.quality.lower())
|
||||
|
||||
else: # Do not order
|
||||
|
||||
# if the url is repeated, we discard the item
|
||||
item.window = base_item.window
|
||||
if item.url in url_list_valid:
|
||||
continue
|
||||
|
||||
# If the item reaches here we add it to the list of valid urls and to autoplay_list
|
||||
url_list_valid.append(item.url)
|
||||
item.plan_b=True
|
||||
item.window = base_item.window
|
||||
autoplay_elem['videoitem'] = item
|
||||
autoplay_list.append(autoplay_elem)
|
||||
|
||||
# We order according to priority
|
||||
if priority == 0: autoplay_list.sort(key=lambda orden: ((orden['indice_server'], orden['indice_quality']))) # Servers and qualities
|
||||
elif priority == 1: autoplay_list.sort(key=lambda orden: (orden['indice_quality'], orden['indice_server'])) # Qualities and servers
|
||||
elif priority == 2: autoplay_list.sort(key=lambda orden: (orden['indice_server'])) # Servers only
|
||||
elif priority == 3: autoplay_list.sort(key=lambda orden: (orden['indice_quality'])) # Only qualities
|
||||
|
||||
logger.debug('PRIORITY',priority, autoplay_list)
|
||||
|
||||
# if quality priority is active
|
||||
if priority == 0 and config.get_setting('quality_priority'):
|
||||
max_quality = autoplay_list[0]["indice_quality"] if autoplay_list and "indice_quality" in autoplay_list[0] else 0
|
||||
for n, item in enumerate(itemlist):
|
||||
if 'server' not in item:
|
||||
continue
|
||||
|
||||
if item.server.lower() in blacklisted_servers:
|
||||
continue
|
||||
|
||||
# If it does not have a defined quality, it assigns a 'default' quality.
|
||||
if item.quality == '':
|
||||
item.quality = 'default'
|
||||
|
||||
if favorite_quality.index(item.quality.lower()) < max_quality:
|
||||
item.type_b = False
|
||||
autoplay_elem["indice_server"] = n
|
||||
autoplay_elem["indice_quality"] = favorite_quality.index(item.quality.lower())
|
||||
autoplay_elem['videoitem'] = item
|
||||
autoplay_list.append(autoplay_elem)
|
||||
autoplay_list.sort(key=lambda orden: (orden['indice_quality'], orden['indice_server']))
|
||||
|
||||
# Plan b is prepared, in case it is active the non-favorite elements are added at the end
|
||||
# try: plan_b = settings_node['plan_b']
|
||||
# except:
|
||||
plan_b = True
|
||||
text_b = ''
|
||||
if plan_b: autoplay_list.extend(autoplay_b)
|
||||
# If there are elements in the autoplay list, an attempt is made to reproduce each element, until one is found or all fail.
|
||||
|
||||
if autoplay_list or (plan_b and autoplay_b):
|
||||
|
||||
max_intentos = 5
|
||||
max_intentos_servers = {}
|
||||
if autoplay_list:
|
||||
max_intents = 5
|
||||
max_intents_servers = {}
|
||||
|
||||
# If something is playing it stops playing
|
||||
if platformtools.is_playing():
|
||||
@@ -206,27 +60,23 @@ def start(itemlist, item):
|
||||
|
||||
for autoplay_elem in autoplay_list:
|
||||
play_item = Item
|
||||
channel_id = autoplay_elem['videoitem'].channel
|
||||
if autoplay_elem['videoitem'].channel == 'videolibrary':
|
||||
channel_id = autoplay_elem['videoitem'].contentChannel
|
||||
channel_id = autoplay_elem.channel
|
||||
if autoplay_elem.channel == 'videolibrary':
|
||||
channel_id = autoplay_elem.contentChannel
|
||||
|
||||
# If it is not a favorite element if you add the text plan b
|
||||
if autoplay_elem['videoitem'].type_b:
|
||||
text_b = '(Plan B)'
|
||||
if not platformtools.is_playing() and not PLAYED:
|
||||
videoitem = autoplay_elem['videoitem']
|
||||
if videoitem.server.lower() not in max_intentos_servers:
|
||||
max_intentos_servers[videoitem.server.lower()] = max_intentos
|
||||
videoitem = autoplay_elem
|
||||
if videoitem.server.lower() not in max_intents_servers:
|
||||
max_intents_servers[videoitem.server.lower()] = max_intents
|
||||
|
||||
# If the maximum number of attempts of this server have been reached, we jump to the next
|
||||
if max_intentos_servers[videoitem.server.lower()] == 0:
|
||||
if max_intents_servers[videoitem.server.lower()] == 0:
|
||||
continue
|
||||
|
||||
lang = " "
|
||||
if hasattr(videoitem, 'language') and videoitem.language != "":
|
||||
lang = " '%s' " % videoitem.language
|
||||
lang = " [{}]".format(videoitem.language) if videoitem.language else ''
|
||||
quality = ' [{}]'.format(videoitem.quality) if videoitem.quality and videoitem.quality != 'default' else ''
|
||||
name = servername(videoitem.server)
|
||||
platformtools.dialog_notification("AutoPlay %s" %text_b, "%s%s%s" % (name, lang, videoitem.quality.upper()), sound=False)
|
||||
platformtools.dialog_notification('AutoPlay', '{}{}{}'.format(name, lang, quality), sound=False)
|
||||
|
||||
# Try to play the links If the channel has its own play method, use it
|
||||
try: channel = __import__('channels.%s' % channel_id, None, None, ["channels.%s" % channel_id])
|
||||
@@ -251,7 +101,7 @@ def start(itemlist, item):
|
||||
platformtools.play_video(videoitem, autoplay=True)
|
||||
except:
|
||||
pass
|
||||
sleep(3)
|
||||
# sleep(3)
|
||||
try:
|
||||
if platformtools.is_playing():
|
||||
PLAYED = True
|
||||
@@ -260,13 +110,13 @@ def start(itemlist, item):
|
||||
logger.debug(str(len(autoplay_list)))
|
||||
|
||||
# If we have come this far, it is because it could not be reproduced
|
||||
max_intentos_servers[videoitem.server.lower()] -= 1
|
||||
max_intents_servers[videoitem.server.lower()] -= 1
|
||||
|
||||
# If the maximum number of attempts of this server has been reached, ask if we want to continue testing or ignore it.
|
||||
if max_intentos_servers[videoitem.server.lower()] == 0:
|
||||
if max_intents_servers[videoitem.server.lower()] == 0:
|
||||
text = config.get_localized_string(60072) % name
|
||||
if not platformtools.dialog_yesno("AutoPlay", text, config.get_localized_string(60073)):
|
||||
max_intentos_servers[videoitem.server.lower()] = max_intentos
|
||||
max_intents_servers[videoitem.server.lower()] = max_intents
|
||||
|
||||
# If there are no items in the list, it is reported
|
||||
if autoplay_elem == autoplay_list[-1]:
|
||||
@@ -292,4 +142,4 @@ def servername(server):
|
||||
path = filetools.join(config.get_runtime_path(), 'servers', server.lower() + '.json')
|
||||
name = jsontools.load(open(path, "rb").read())['name']
|
||||
if name.startswith('@'): name = config.get_localized_string(int(name.replace('@','')))
|
||||
return translate_server_name(name)
|
||||
return translate_server_name(name)
|
||||
|
||||
@@ -9,24 +9,17 @@ import sys
|
||||
PY3 = False
|
||||
if sys.version_info[0] >= 3: PY3 = True; unicode = str; unichr = chr; long = int
|
||||
|
||||
if PY3:
|
||||
#from future import standard_library
|
||||
#standard_library.install_aliases()
|
||||
import urllib.parse as urlparse #It is very slow in PY2. In PY3 it is native
|
||||
else:
|
||||
import urlparse # We use the native of PY2 which is faster
|
||||
if PY3: import urllib.parse as urlparse
|
||||
else: import urlparse
|
||||
|
||||
from future.builtins import range
|
||||
from past.utils import old_div
|
||||
|
||||
import re
|
||||
|
||||
from core import filetools
|
||||
from core import httptools
|
||||
from core import jsontools
|
||||
from core import filetools, httptools, jsontools
|
||||
from core.item import Item
|
||||
from platformcode import config, logger
|
||||
from platformcode import platformtools
|
||||
from platformcode import config, logger, platformtools
|
||||
from lib import unshortenit
|
||||
|
||||
dict_servers_parameters = {}
|
||||
@@ -522,26 +515,6 @@ def get_server_parameters(server):
|
||||
return dict_servers_parameters[server]
|
||||
|
||||
|
||||
# def get_server_json(server_name):
|
||||
# # logger.info("server_name=" + server_name)
|
||||
# try:
|
||||
# server_path = filetools.join(config.get_runtime_path(), "servers", server_name + ".json")
|
||||
# if not filetools.exists(server_path):
|
||||
# server_path = filetools.join(config.get_runtime_path(), "servers", "debriders", server_name + ".json")
|
||||
#
|
||||
# # logger.info("server_path=" + server_path)
|
||||
# server_json = jsontools.load(filetools.read(server_path))
|
||||
# # logger.info("server_json= %s" % server_json)
|
||||
#
|
||||
# except Exception as ex:
|
||||
# template = "An exception of type %s occured. Arguments:\n%r"
|
||||
# message = template % (type(ex).__name__, ex.args)
|
||||
# logger.error(" %s" % message)
|
||||
# server_json = None
|
||||
#
|
||||
# return server_json
|
||||
|
||||
|
||||
def get_server_host(server_name):
|
||||
from core import scrapertools
|
||||
return [scrapertools.get_domain_from_url(pattern['url']) for pattern in get_server_parameters(server_name)['find_videos']['patterns']]
|
||||
@@ -669,9 +642,10 @@ def get_servers_list():
|
||||
for server in filetools.listdir(filetools.join(config.get_runtime_path(), "servers")):
|
||||
if server.endswith(".json") and not server == "version.json":
|
||||
server_parameters = get_server_parameters(server)
|
||||
server_list[server.split(".")[0]] = server_parameters
|
||||
if server_parameters['active']:
|
||||
server_list[server.split(".")[0]] = server_parameters
|
||||
|
||||
# if type(server_list) != dict: server_list = sort_servers(server_list)
|
||||
if type(server_list) != dict: server_list = sort_servers(server_list)
|
||||
return server_list
|
||||
|
||||
|
||||
@@ -696,16 +670,67 @@ def sort_servers(servers_list):
|
||||
"""
|
||||
If the option "Order servers" is activated in the server configuration and there is a list of servers
|
||||
favorites in settings use it to sort the servers_list list
|
||||
:param servers_list: List of servers to order. The items in the servers_list can be strings or Item objects. In which case it is necessary that they have an item.server attribute of type str.
|
||||
:param servers_list: List of servers to order. The items in the servers_list can be strings or Item objects. In both cases it is necessary to have an item.server attribute of type str.
|
||||
:return: List of the same type of objects as servers_list ordered according to the favorite servers.
|
||||
"""
|
||||
if servers_list:
|
||||
if isinstance(servers_list[0], Item):
|
||||
servers_list = sorted(servers_list, key=lambda x: config.get_setting("favorites_servers_list", server=x.server))
|
||||
def index(lst, value):
|
||||
if value in lst:
|
||||
return lst.index(value)
|
||||
else:
|
||||
servers_list = sorted(servers_list, key=lambda x: config.get_setting("favorites_servers_list", server=x))
|
||||
logger.debug('Index not found: ' + value)
|
||||
return 999
|
||||
if not servers_list:
|
||||
return []
|
||||
|
||||
return servers_list
|
||||
blacklisted_servers = config.get_setting("black_list", server='servers', default=[])
|
||||
favorite_servers = config.get_setting('favorites_servers_list', server='servers', default=[])
|
||||
favorite_servers = [s for s in favorite_servers if s not in blacklisted_servers]
|
||||
if isinstance(servers_list[0], str):
|
||||
servers_list = sorted(servers_list, key=lambda x: favorite_servers.index(x) if x in favorite_servers else 999)
|
||||
return servers_list
|
||||
|
||||
favorite_quality = ['4k', '2160p', '2160', '4k2160p', '4k2160', '4k 2160p', '4k 2160', '2k',
|
||||
'fullhd', 'fullhd 1080', 'fullhd 1080p', 'full hd', 'full hd 1080', 'full hd 1080p', 'hd1080', 'hd1080p', 'hd 1080', 'hd 1080p', '1080', '1080p',
|
||||
'hd', 'hd720', 'hd720p', 'hd 720', 'hd 720p', '720', '720p', 'hdtv',
|
||||
'sd', '480p', '480', '360p', '360', '240p', '240']
|
||||
|
||||
sorted_list = []
|
||||
inverted = False
|
||||
|
||||
if config.get_setting('default_action') == 2:
|
||||
inverted = True
|
||||
|
||||
# Priorities when ordering itemlist:
|
||||
# 0: Only Qualities
|
||||
# 1: Servers and Qualities
|
||||
# 2: Qualities and Servers
|
||||
|
||||
priority = 0
|
||||
if config.get_setting('favorites_servers') and favorite_servers: priority = 1
|
||||
if config.get_setting('quality_priority'): priority = 2
|
||||
|
||||
for item in servers_list:
|
||||
element = dict()
|
||||
|
||||
# We check that it is a video item
|
||||
if 'server' not in item:
|
||||
continue
|
||||
|
||||
if item.server.lower() in blacklisted_servers:
|
||||
continue
|
||||
|
||||
element["index_server"] = index(favorite_servers, item.server.lower())
|
||||
element["index_quality"] = platformtools.calcResolution(item.quality)
|
||||
element['index_language'] = 0 if item.contentLanguage == 'ITA' else 1
|
||||
element['videoitem'] = item
|
||||
sorted_list.append(element)
|
||||
|
||||
# We order according to priority
|
||||
if priority == 0: sorted_list.sort(key=lambda element: (element['index_language'], -element['index_quality'] if inverted else element['index_quality'] , element['videoitem'].server))
|
||||
elif priority == 1: sorted_list.sort(key=lambda element: (element['index_language'], element['index_server'], -element['index_quality'] if inverted else element['index_quality'])) # Servers and Qualities
|
||||
elif priority == 2: sorted_list.sort(key=lambda element: (element['index_language'], -element['index_quality'] if inverted else element['index_quality'], element['index_server'])) # Qualities and Servers
|
||||
|
||||
return [v['videoitem'] for v in sorted_list if v]
|
||||
|
||||
|
||||
# Checking links
|
||||
@@ -733,10 +758,11 @@ def check_list_links(itemlist, numero='', timeout=3):
|
||||
it = res[0]
|
||||
verificacion = res[1]
|
||||
it.title = verificacion + ' ' + it.title.strip()
|
||||
logger.info('VERIFICATION= ' + verificacion)
|
||||
logger.debug('VERIFICATION= ' + verificacion)
|
||||
it.alive = verificacion
|
||||
return itemlist
|
||||
|
||||
|
||||
def check_video_link(item, timeout=3):
|
||||
"""
|
||||
Check if the link to a video is valid and return a 2-position string with verification.
|
||||
@@ -777,11 +803,30 @@ def check_video_link(item, timeout=3):
|
||||
httptools.HTTPTOOLS_DEFAULT_DOWNLOAD_TIMEOUT = ant_timeout # Restore download time
|
||||
return item, resultado
|
||||
|
||||
logger.debug("[check_video_link] There is no test_video_exists for server: %s" % server)
|
||||
logger.debug("[check_video_link] There is no test_video_exists for server:", server)
|
||||
return item, NK
|
||||
|
||||
|
||||
def translate_server_name(name):
|
||||
if '@' in name:
|
||||
return config.get_localized_string(int(name.replace('@','')))
|
||||
else:
|
||||
return name
|
||||
if '@' in name: return config.get_localized_string(int(name.replace('@','')))
|
||||
else: return name
|
||||
|
||||
|
||||
# def get_server_json(server_name):
|
||||
# # logger.info("server_name=" + server_name)
|
||||
# try:
|
||||
# server_path = filetools.join(config.get_runtime_path(), "servers", server_name + ".json")
|
||||
# if not filetools.exists(server_path):
|
||||
# server_path = filetools.join(config.get_runtime_path(), "servers", "debriders", server_name + ".json")
|
||||
#
|
||||
# # logger.info("server_path=" + server_path)
|
||||
# server_json = jsontools.load(filetools.read(server_path))
|
||||
# # logger.info("server_json= %s" % server_json)
|
||||
#
|
||||
# except Exception as ex:
|
||||
# template = "An exception of type %s occured. Arguments:\n%r"
|
||||
# message = template % (type(ex).__name__, ex.args)
|
||||
# logger.error(" %s" % message)
|
||||
# server_json = None
|
||||
#
|
||||
# return server_json
|
||||
|
||||
@@ -24,6 +24,56 @@ from platformcode import config
|
||||
from platformcode.logger import info
|
||||
from platformcode import logger
|
||||
|
||||
channels_order = {'Rai 1': 1,
|
||||
'Rai 2': 2,
|
||||
'Rai 3': 3,
|
||||
'Rete 4': 4,
|
||||
'Canale 5': 5,
|
||||
'Italia 1': 6,
|
||||
'La7': 7,
|
||||
'NOVE': 9,
|
||||
'20': 20,
|
||||
'Rai 4': 21,
|
||||
'Iris': 22,
|
||||
'Rai 5': 23,
|
||||
'Rai Movie': 24,
|
||||
'Rai Premium': 25,
|
||||
'Paramount': 27,
|
||||
'La7d': 29,
|
||||
'La 5': 30,
|
||||
'Real Time': 31,
|
||||
'Food Network': 33,
|
||||
'Cine34': 34,
|
||||
'Focus': 35,
|
||||
'Giallo': 38,
|
||||
'Top Crime': 39,
|
||||
'Boing': 40,
|
||||
'K2': 41,
|
||||
'Rai Gulp': 42,
|
||||
'Rai Yoyo': 43,
|
||||
'Frisbee': 44,
|
||||
'Cartoonito': 46,
|
||||
'Super': 46,
|
||||
'Rai News 24': 48,
|
||||
'Spike': 49,
|
||||
'TGCom': 51,
|
||||
'DMAX': 52,
|
||||
'Rai Storia': 54,
|
||||
'Mediaset Extra': 55,
|
||||
'Home and Garden TV': 56,
|
||||
'Rai Sport piu HD': 57,
|
||||
'Rai Sport': 58,
|
||||
'Motor Trend': 59,
|
||||
'Italia 2': 66,
|
||||
'VH1': 67,
|
||||
'Rai Scuola': 146,
|
||||
'Radio 105': 157,
|
||||
'R101tv': 167,
|
||||
'RMC': 256,
|
||||
'Virgin Radio': 257,
|
||||
'Rai Radio 2': 999,
|
||||
}
|
||||
|
||||
|
||||
def hdpass_get_servers(item):
|
||||
def get_hosts(url, quality):
|
||||
@@ -53,7 +103,7 @@ def hdpass_get_servers(item):
|
||||
|
||||
data = httptools.downloadpage(url, CF=False).data
|
||||
patron_res = '<div class="buttons-bar resolutions-bar">(.*?)<div class="buttons-bar'
|
||||
patron_mir = '<div class="buttons-bar hosts-bar">(.*?)<div id="main-player'
|
||||
patron_mir = '<div class="buttons-bar hosts-bar">(.*?)(?:<div id="main-player|<script)'
|
||||
patron_option = r'<a href="([^"]+?)"[^>]+>([^<]+?)</a'
|
||||
|
||||
res = scrapertools.find_single_match(data, patron_res)
|
||||
@@ -237,6 +287,7 @@ def scrapeBlock(item, args, block, patron, headers, action, pagination, debug, t
|
||||
contents.append(title)
|
||||
title2 = cleantitle(scraped.get('title2', '')) if not group or item.grouped else ''
|
||||
quality = scraped.get('quality', '')
|
||||
if not quality: quality = item.quality
|
||||
# Type = scraped['type'] if scraped['type'] else ''
|
||||
plot = cleantitle(scraped.get("plot", ''))
|
||||
|
||||
@@ -399,7 +450,8 @@ def scrapeBlock(item, args, block, patron, headers, action, pagination, debug, t
|
||||
contentEpisodeNumber=infolabels.get('episode', ''),
|
||||
news= item.news if item.news else '',
|
||||
other = scraped['other'] if scraped['other'] else '',
|
||||
grouped=group
|
||||
q=group,
|
||||
disable_videolibrary = not args.get('addVideolibrary', True)
|
||||
)
|
||||
if scraped['episode'] and group and not item.grouped: # some adjustment for grouping feature
|
||||
it.action = function
|
||||
@@ -1214,7 +1266,9 @@ def server(item, data='', itemlist=[], headers='', AutoPlay=True, CheckLinks=Tru
|
||||
videoitem.title = findS[0]
|
||||
videoitem.url = findS[1]
|
||||
srv_param = servertools.get_server_parameters(videoitem.server.lower())
|
||||
logger.debug(videoitem)
|
||||
else:
|
||||
videoitem.server = videoitem.server.lower()
|
||||
|
||||
if videoitem.video_urls or srv_param.get('active', False):
|
||||
item.title = typo(item.contentTitle.strip(), 'bold') if item.contentType == 'movie' or (config.get_localized_string(30161) in item.title) else item.title
|
||||
|
||||
@@ -1270,7 +1324,7 @@ def server(item, data='', itemlist=[], headers='', AutoPlay=True, CheckLinks=Tru
|
||||
logger.error(traceback.format_exc())
|
||||
pass
|
||||
|
||||
# verifiedItemlist = servertools.sort_servers(verifiedItemlist)
|
||||
verifiedItemlist = servertools.sort_servers(verifiedItemlist)
|
||||
|
||||
if Videolibrary and item.contentChannel != 'videolibrary':
|
||||
videolibrary(verifiedItemlist, item)
|
||||
@@ -1412,6 +1466,7 @@ def get_jwplayer_mediaurl(data, srvName, onlyHttp=False, dataIsBlock=False):
|
||||
|
||||
def thumb(item_itemlist_string=None, genre=False, live=False):
|
||||
from channelselector import get_thumb
|
||||
|
||||
if live:
|
||||
if type(item_itemlist_string) == list:
|
||||
for item in item_itemlist_string:
|
||||
@@ -1524,4 +1579,4 @@ def thumb(item_itemlist_string=None, genre=False, live=False):
|
||||
return autoselect_thumb(item_itemlist_string, genre)
|
||||
|
||||
else:
|
||||
return get_thumb('next.png')
|
||||
return get_thumb('next.png')
|
||||
|
||||
@@ -424,6 +424,8 @@ def set_infoLabels_item(item, seekTmdb=True, search_language=def_lang, lock=None
|
||||
if otmdb.get_id() and config.get_setting("tmdb_plus_info", default=False):
|
||||
# If the search has been successful and you are not looking for a list of items,
|
||||
# carry out another search to expand the information
|
||||
if search_type == 'multi':
|
||||
search_type = 'movie' if otmdb.result.get('media_type') else 'tv'
|
||||
otmdb = Tmdb(id_Tmdb=otmdb.result.get("id"), search_type=search_type,
|
||||
search_language=search_language)
|
||||
|
||||
@@ -619,6 +621,8 @@ def discovery(item, dict_=False, cast=False):
|
||||
from core.item import Item
|
||||
|
||||
if dict_:
|
||||
if item.page:
|
||||
item.discovery['page'] = item.page
|
||||
listado = Tmdb(discover = dict_, cast=cast)
|
||||
|
||||
elif item.search_type == 'discover':
|
||||
@@ -1562,10 +1566,12 @@ class Tmdb(object):
|
||||
:rtype: list of Dict
|
||||
"""
|
||||
ret = []
|
||||
|
||||
if self.result['id']:
|
||||
if self.result['videos']:
|
||||
self.result["videos"] = self.result["videos"]['results']
|
||||
else:
|
||||
self.result["videos"] = []
|
||||
# First video search in the search language
|
||||
url = "{}/{}/{}/videos?api_key={}&language={}".format(host, self.search_type, self.result['id'], api, self.search_language)
|
||||
|
||||
|
||||
@@ -45,7 +45,7 @@ class UnshortenIt(object):
|
||||
# for services that only include real link inside iframe
|
||||
_simple_iframe_regex = r'cryptmango|xshield\.net|vcrypt\.club'
|
||||
# for services that only do redirects
|
||||
_simple_redirect = r'streamcrypt\.net/[^/]+|uprot\.net'
|
||||
_simple_redirect = r'streamcrypt\.net/[^/]+|uprot\.net|is\.gd'
|
||||
|
||||
listRegex = [_adfly_regex, _linkbucks_regex, _adfocus_regex, _lnxlu_regex, _shst_regex, _hrefli_regex, _anonymz_regex,
|
||||
_shrink_service_regex, _rapidcrypt_regex, _simple_iframe_regex, _linkup_regex, _linkhub_regex,
|
||||
|
||||
@@ -132,11 +132,12 @@ class autorenumber():
|
||||
else:
|
||||
self.renumberdict = {}
|
||||
for item in self.itemlist:
|
||||
item.context = [{"title": typo(config.get_localized_string(70585), 'bold'),
|
||||
"action": "start",
|
||||
"channel": "autorenumber",
|
||||
"from_channel": item.channel,
|
||||
"from_action": item.action}]
|
||||
if item.contentType != 'movie':
|
||||
item.context = [{"title": typo(config.get_localized_string(70585), 'bold'),
|
||||
"action": "start",
|
||||
"channel": "autorenumber",
|
||||
"from_channel": item.channel,
|
||||
"from_action": item.action}]
|
||||
|
||||
def config(self):
|
||||
# Pulizia del Titolo
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
# Backup and restore video library
|
||||
# ------------------------------------------------------------
|
||||
|
||||
import datetime, xbmc, os, shutil
|
||||
import datetime, xbmc, os, shutil, sys
|
||||
|
||||
from zipfile import ZipFile
|
||||
from core import videolibrarytools, filetools
|
||||
@@ -11,12 +11,15 @@ from platformcode import logger, config, platformtools, xbmc_videolibrary
|
||||
from distutils.dir_util import copy_tree
|
||||
from specials import videolibrary
|
||||
|
||||
temp_path = u'' + xbmc.translatePath("special://userdata/addon_data/plugin.video.kod/temp/")
|
||||
videolibrary_temp_path = u'' + xbmc.translatePath("special://userdata/addon_data/plugin.video.kod/temp/videolibrary")
|
||||
movies_path = u'' + filetools.join(videolibrary_temp_path, "movies")
|
||||
tvshows_path = u'' + filetools.join(videolibrary_temp_path, "tvshows")
|
||||
videolibrary_movies_path = u'' + videolibrarytools.MOVIES_PATH
|
||||
videolibrary_tvshows_path = u'' + videolibrarytools.TVSHOWS_PATH
|
||||
PY3 = False
|
||||
if sys.version_info[0] >= 3: PY3 = True; unicode = str; unichr = chr; long = int
|
||||
|
||||
temp_path = unicode(xbmc.translatePath("special://userdata/addon_data/plugin.video.kod/temp/"))
|
||||
videolibrary_temp_path = unicode(xbmc.translatePath("special://userdata/addon_data/plugin.video.kod/temp/videolibrary"))
|
||||
movies_path = unicode(filetools.join(videolibrary_temp_path, "movies"))
|
||||
tvshows_path = unicode(filetools.join(videolibrary_temp_path, "tvshows"))
|
||||
videolibrary_movies_path = unicode(videolibrarytools.MOVIES_PATH)
|
||||
videolibrary_tvshows_path = unicode(videolibrarytools.TVSHOWS_PATH)
|
||||
|
||||
|
||||
def export_videolibrary(item):
|
||||
@@ -25,7 +28,7 @@ def export_videolibrary(item):
|
||||
zip_file_folder = platformtools.dialog_browse(3, config.get_localized_string(80002))
|
||||
if zip_file_folder == "":
|
||||
return
|
||||
zip_file = u'' + xbmc.translatePath(zip_file_folder + "KoD_video_library-" + str(datetime.date.today()) + ".zip")
|
||||
zip_file = unicode(xbmc.translatePath(zip_file_folder + "KoD_video_library-" + str(datetime.date.today()) + ".zip"))
|
||||
|
||||
p_dialog = platformtools.dialog_progress_bg(config.get_localized_string(20000), config.get_localized_string(80003))
|
||||
# p_dialog.update(0)
|
||||
@@ -53,7 +56,7 @@ def export_videolibrary(item):
|
||||
def import_videolibrary(item):
|
||||
logger.info()
|
||||
|
||||
zip_file = u'' + platformtools.dialog_browse(1, config.get_localized_string(80005), mask=".zip")
|
||||
zip_file = unicode(platformtools.dialog_browse(1, config.get_localized_string(80005), mask=".zip"))
|
||||
if zip_file == "":
|
||||
return
|
||||
if not platformtools.dialog_yesno(config.get_localized_string(20000), config.get_localized_string(80006)):
|
||||
@@ -112,6 +115,7 @@ def zip(dir, file):
|
||||
if smb:
|
||||
filetools.move(file, temp)
|
||||
|
||||
|
||||
def unzip(dir, file):
|
||||
if file.lower().startswith('smb://'):
|
||||
temp = filetools.join(temp_path, os.path.split(file)[-1])
|
||||
|
||||
@@ -10,12 +10,14 @@ import channelselector
|
||||
addon_icon = filetools.join( config.__settings__.getAddonInfo( "path" ),'resources', 'media', 'logo.png' )
|
||||
|
||||
background = 'FF232323'
|
||||
overlay = '77232323'
|
||||
text = 'FFFFFFFF'
|
||||
select = 'FF0082C2'
|
||||
if config.get_setting('icon_set') == 'dark':
|
||||
background = 'FFDCDCDC'
|
||||
overlay = '77DCDCDC'
|
||||
text = 'FF232323'
|
||||
select = '880082C2'
|
||||
select = 'FF78BDDF'
|
||||
|
||||
class KeyListener(xbmcgui.WindowXMLDialog):
|
||||
TIMEOUT = 10
|
||||
@@ -122,13 +124,15 @@ class Main(xbmcgui.WindowXMLDialog):
|
||||
|
||||
def menulist(self, menu):
|
||||
itemlist = []
|
||||
self.getControl(200).setLabel(background)
|
||||
self.getControl(201).setLabel(overlay)
|
||||
self.getControl(202).setLabel(select)
|
||||
self.getControl(203).setLabel(text)
|
||||
for menuentry in menu:
|
||||
# if not menuentry.channel: menuentry.channel = 'news'
|
||||
|
||||
title = re.sub(r'(\[[/]?COLOR[^\]]*\])','',menuentry.title)
|
||||
item = xbmcgui.ListItem(title)
|
||||
item.setProperty('background', background)
|
||||
item.setProperty('text', text)
|
||||
item.setProperty('select', select)
|
||||
item.setProperty('channel', menuentry.channel)
|
||||
item.setProperty('focus', '0')
|
||||
item.setProperty('thumbnail', menuentry.thumbnail)
|
||||
@@ -175,6 +179,7 @@ class Main(xbmcgui.WindowXMLDialog):
|
||||
|
||||
|
||||
def submenu(self):
|
||||
itmlist = []
|
||||
channel_name = self.MENU.getSelectedItem().getProperty('channel')
|
||||
focus = int(self.MENU.getSelectedItem().getProperty('focus'))
|
||||
if channel_name == 'channelselector':
|
||||
|
||||
@@ -2,7 +2,12 @@
|
||||
# ------------------------------------------------------------
|
||||
# XBMC Launcher (xbmc / kodi)
|
||||
# ------------------------------------------------------------
|
||||
import datetime
|
||||
import json
|
||||
import sys, os
|
||||
|
||||
import requests
|
||||
|
||||
PY3 = False
|
||||
if sys.version_info[0] >= 3:PY3 = True; unicode = str; unichr = chr; long = int
|
||||
|
||||
@@ -144,7 +149,18 @@ def run(item=None):
|
||||
if xbmc.getCondVisibility('system.platform.linux') and xbmc.getCondVisibility('system.platform.android'): # android
|
||||
xbmc.executebuiltin('StartAndroidActivity("", "android.intent.action.VIEW", "", "%s")' % item.url)
|
||||
else:
|
||||
platformtools.dialog_ok(config.get_localized_string(20000), config.get_localized_string(70740) % "\n".join((item.url[j:j+57] for j in range(0, len(item.url), 57))))
|
||||
platformtools.dialog_ok(config.get_localized_string(20000), config.get_localized_string(70740) % "\n".join([item.url[j:j+57] for j in range(0, len(item.url), 57)]))
|
||||
elif item.action == "gotopage":
|
||||
page = platformtools.dialog_numeric(0, config.get_localized_string(70513))
|
||||
if page:
|
||||
import xbmc
|
||||
item.action = item.real_action
|
||||
if item.page:
|
||||
item.page = page
|
||||
else:
|
||||
import re
|
||||
item.url = re.sub('([=/])[0-9]+(/?)$', '\g<1>' + page + '\g<2>', item.url)
|
||||
xbmc.executebuiltin("Container.Update(%s?%s)" % (sys.argv[0], item.tourl()))
|
||||
else:
|
||||
# Checks if channel exists
|
||||
if os.path.isfile(os.path.join(config.get_runtime_path(), 'channels', item.channel + ".py")):
|
||||
@@ -159,10 +175,10 @@ def run(item=None):
|
||||
channel = None
|
||||
|
||||
if os.path.exists(channel_file):
|
||||
# try:
|
||||
channel = __import__('%s.%s' % (CHANNELS, item.channel), None, None, ['%s.%s' % (CHANNELS, item.channel)])
|
||||
# except ImportError:
|
||||
# exec("import " + CHANNELS + "." + item.channel + " as channel")
|
||||
try:
|
||||
channel = __import__('%s.%s' % (CHANNELS, item.channel), None, None, ['%s.%s' % (CHANNELS, item.channel)])
|
||||
except ImportError:
|
||||
exec("import " + CHANNELS + "." + item.channel + " as channel")
|
||||
|
||||
logger.info("Running channel %s | %s" % (channel.__name__, channel.__file__))
|
||||
|
||||
|
||||
@@ -364,7 +364,7 @@ def render_items(itemlist, parent_item):
|
||||
xbmcplugin.addDirectoryItems(_handle, dirItems)
|
||||
|
||||
if parent_item.list_type == '':
|
||||
breadcrumb = parent_item.category.capitalize()
|
||||
breadcrumb = parent_item.category #.capitalize()
|
||||
else:
|
||||
if 'similar' in parent_item.list_type:
|
||||
if parent_item.contentTitle != '':
|
||||
@@ -614,7 +614,7 @@ def set_context_commands(item, item_url, parent_item, **kwargs):
|
||||
context_commands.append((config.get_localized_string(60350), "Container.Refresh (%s?%s&%s)" % (sys.argv[0], item_url, urllib.urlencode({'channel': 'search', 'action': "from_context", 'from_channel': item.channel, 'contextual': True, 'text': item.wanted}))))
|
||||
context_commands.append( (config.get_localized_string(70561), "Container.Update (%s?%s&%s)" % (sys.argv[0], item_url, 'channel=search&action=from_context&search_type=list&page=1&list_type=%s/%s/similar' % (mediatype, item.infoLabels['tmdb_id']))))
|
||||
|
||||
if item.channel != "videolibrary" and item.videolibrary != False:
|
||||
if item.channel != "videolibrary" and item.videolibrary != False and not item.disable_videolibrary:
|
||||
# Add Series to the video library
|
||||
if item.action in ["episodios", "get_episodios", "get_seasons"] and item.contentSerieName:
|
||||
context_commands.append((config.get_localized_string(60352), "RunPlugin(%s?%s&%s)" % (sys.argv[0], item_url, 'action=add_serie_to_library&from_action=' + item.action)))
|
||||
@@ -625,7 +625,7 @@ def set_context_commands(item, item_url, parent_item, **kwargs):
|
||||
elif item.action in ['check'] and item.contentTitle:
|
||||
context_commands.append((config.get_localized_string(30161), "RunPlugin(%s?%s&%s)" % (sys.argv[0], item_url, 'action=add_to_library&from_action=' + item.action)))
|
||||
|
||||
if not item.local and item.channel not in ["downloads", "filmontv", "search"] and item.server != 'torrent' and parent_item.action != 'mainlist' and config.get_setting('downloadenabled'):
|
||||
if not item.local and item.channel not in ["downloads", "filmontv", "search"] and item.server != 'torrent' and parent_item.action != 'mainlist' and config.get_setting('downloadenabled') and not item.disable_videolibrary:
|
||||
# Download movie
|
||||
if item.contentType == "movie":
|
||||
context_commands.append((config.get_localized_string(60354), "RunPlugin(%s?%s&%s)" % (sys.argv[0], item_url, 'channel=downloads&action=save_download&from_channel=' + item.channel + '&from_action=' + item.action)))
|
||||
@@ -648,6 +648,8 @@ def set_context_commands(item, item_url, parent_item, **kwargs):
|
||||
if (item.contentTitle and item.contentType in ['movie', 'tvshow']) or "buscar_trailer" in context:
|
||||
context_commands.append((config.get_localized_string(60359), "RunPlugin(%s?%s&%s)" % (sys.argv[0], item_url, urllib.urlencode({ 'channel': "trailertools", 'action': "buscartrailer", 'search_title': item.contentTitle if item.contentTitle else item.fulltitle, 'contextual': True}))))
|
||||
|
||||
if item.nextPage:
|
||||
context_commands.append((config.get_localized_string(70511), "RunPlugin(%s?%s&%s)" % (sys.argv[0], item_url, 'action=gotopage&real_action='+item.action)))
|
||||
if config.dev_mode():
|
||||
context_commands.insert(0, ("item info", "Container.Update (%s?%s)" % (sys.argv[0], Item(action="itemInfo", parent=item.tojson()).tourl())))
|
||||
return context_commands
|
||||
@@ -974,7 +976,7 @@ def play_video(item, strm=False, force_direct=False, autoplay=False):
|
||||
xlistitem.setProperty("inputstream.adaptive.license_type", item.drm)
|
||||
xlistitem.setProperty("inputstream.adaptive.license_key", item.license)
|
||||
xlistitem.setMimeType('application/dash+xml')
|
||||
elif item.manifest == 'hls' or mediaurl.split('|')[0].endswith('m3u8'):
|
||||
elif item.manifest == 'hls' or (mediaurl.split('|')[0].endswith('m3u8') and mediaurl.startswith('http')):
|
||||
if not install_inputstream():
|
||||
return
|
||||
xlistitem.setProperty('inputstream' if PY3 else 'inputstreamaddon', 'inputstream.adaptive')
|
||||
@@ -1055,23 +1057,23 @@ def get_seleccion(default_action, opciones, seleccion, video_urls):
|
||||
|
||||
|
||||
def calcResolution(option):
|
||||
match = scrapertools.find_single_match(option, '([0-9]{2,4})x([0-9]{2,4})')
|
||||
resolution = False
|
||||
match = scrapertools.find_single_match(option, '([0-9]{2,4})(?:p|i|x[0-9]{2,4}|)')
|
||||
resolution = 0
|
||||
|
||||
if match:
|
||||
resolution = int(match[0]) * int(match[1])
|
||||
else:
|
||||
if '240p' in option:
|
||||
resolution = 320 * 240
|
||||
elif '360p' in option:
|
||||
resolution = 480 * 360
|
||||
elif ('480p' in option) or ('480i' in option):
|
||||
resolution = 720 * 480
|
||||
elif ('576p' in option) or ('576p' in option):
|
||||
resolution = 720 * 576
|
||||
elif ('720p' in option) or ('HD' in option):
|
||||
resolution = 1280 * 720
|
||||
elif ('1080p' in option) or ('1080i' in option) or ('Full HD' in option):
|
||||
resolution = 1920 * 1080
|
||||
resolution = int(match)
|
||||
elif 'sd' in option.lower():
|
||||
resolution = 480
|
||||
elif 'hd' in option.lower():
|
||||
resolution = 720
|
||||
if 'full' in option.lower():
|
||||
resolution = 1080
|
||||
elif '2k' in option.lower():
|
||||
resolution = 1440
|
||||
elif '4k' in option.lower():
|
||||
resolution = 2160
|
||||
elif 'auto' in option.lower():
|
||||
resolution = 10000
|
||||
|
||||
return resolution
|
||||
|
||||
@@ -1725,18 +1727,16 @@ def get_played_time(item):
|
||||
if not ID:
|
||||
return 0
|
||||
|
||||
S = item.infoLabels.get('season', 0)
|
||||
E = item.infoLabels.get('episode')
|
||||
s = item.infoLabels.get('season', 0)
|
||||
e = item.infoLabels.get('episode')
|
||||
|
||||
result = None
|
||||
|
||||
try:
|
||||
if item.contentType == 'movie':
|
||||
result = db['viewed'].get(ID)
|
||||
elif S and E:
|
||||
result = db['viewed'].get(ID, {}).get(str(S)+'x'+str(E))
|
||||
|
||||
if result:
|
||||
played_time = result
|
||||
result = db['viewed'].get(ID)
|
||||
if type(result) == dict:
|
||||
result = db['viewed'].get(ID, {}).get('{}x{}'.format(s, e), 0)
|
||||
played_time = result
|
||||
except:
|
||||
import traceback
|
||||
logger.error(traceback.format_exc())
|
||||
@@ -1757,22 +1757,23 @@ def set_played_time(item):
|
||||
if not ID:
|
||||
return
|
||||
|
||||
S = item.infoLabels.get('season', 0)
|
||||
E = item.infoLabels.get('episode')
|
||||
s = item.infoLabels.get('season', 0)
|
||||
e = item.infoLabels.get('episode')
|
||||
|
||||
try:
|
||||
if item.contentType == 'movie':
|
||||
db['viewed'][ID] = played_time
|
||||
elif E:
|
||||
if e:
|
||||
newDict = db['viewed'].get(ID, {})
|
||||
newDict[str(S) + 'x' + str(E)] = played_time
|
||||
newDict['{}x{}'.format(s, e)] = played_time
|
||||
db['viewed'][ID] = newDict
|
||||
else:
|
||||
db['viewed'][ID] = played_time
|
||||
except:
|
||||
import traceback
|
||||
logger.error(traceback.format_exc())
|
||||
del db['viewed'][ID]
|
||||
|
||||
|
||||
|
||||
def prevent_busy(item):
|
||||
logger.debug()
|
||||
if not item.autoplay and not item.window:
|
||||
@@ -1780,3 +1781,7 @@ def prevent_busy(item):
|
||||
else: xbmcplugin.setResolvedUrl(int(sys.argv[1]), True, xbmcgui.ListItem(path=os.path.join(config.get_runtime_path(), "resources", "kod.mp4")))
|
||||
xbmc.sleep(200)
|
||||
xbmc.Player().stop()
|
||||
# xbmc.executebuiltin('Action(Stop)')
|
||||
# xbmc.sleep(500)
|
||||
# xbmc.Player().stop()
|
||||
# xbmc.sleep(500)
|
||||
@@ -114,7 +114,6 @@ def mark_auto_as_watched(item):
|
||||
threading.Thread(target=mark_as_watched_subThread, args=[item]).start()
|
||||
|
||||
|
||||
|
||||
def sync_trakt_addon(path_folder):
|
||||
"""
|
||||
Updates the values of episodes seen if
|
||||
|
||||
@@ -4845,7 +4845,7 @@ msgid "Manual Search"
|
||||
msgstr ""
|
||||
|
||||
msgctxt "#70511"
|
||||
msgid ""
|
||||
msgid "Goto page"
|
||||
msgstr ""
|
||||
|
||||
msgctxt "#70512"
|
||||
@@ -4853,7 +4853,7 @@ msgid "Searching in Mymovies"
|
||||
msgstr ""
|
||||
|
||||
msgctxt "#70513"
|
||||
msgid ""
|
||||
msgid "Insert page number"
|
||||
msgstr ""
|
||||
|
||||
msgctxt "#70514"
|
||||
|
||||
@@ -4844,16 +4844,16 @@ msgid "Manual Search"
|
||||
msgstr "Ricerca Manuale"
|
||||
|
||||
msgctxt "#70511"
|
||||
msgid ""
|
||||
msgstr ""
|
||||
msgid "Goto page"
|
||||
msgstr "Vai a pagina"
|
||||
|
||||
msgctxt "#70512"
|
||||
msgid "Searching in Mymovies"
|
||||
msgstr "Ricerca in Mymovies"
|
||||
|
||||
msgctxt "#70513"
|
||||
msgid ""
|
||||
msgstr ""
|
||||
msgid "Insert page number"
|
||||
msgstr "Inserisci numero di pagina"
|
||||
|
||||
msgctxt "#70514"
|
||||
msgid ""
|
||||
|
||||
@@ -21,8 +21,8 @@
|
||||
<setting id="player_mode" type="select" lvalues="30026|30027|30028|30029" label="30044" default="1"/>
|
||||
<setting id="default_action" type="select" lvalues="30006|30007|30008" label="30005" default="0"/>
|
||||
<setting id="autoplay" type="bool" label="70562" default="false" visible="true"/>
|
||||
<setting id="servers_favorites" visible="eq(-1,true)" subsetting="true" type="action" label="60551" action="RunPlugin(plugin://plugin.video.kod/?ew0KICAgICJhY3Rpb24iOiAic2VydmVyc19mYXZvcml0ZXMiLA0KICAgICJjaGFubmVsIjogInNldHRpbmciDQp9==)"/>
|
||||
<setting id="servers_blacklist" visible="eq(-2,true)" subsetting="true" type="action" label="60550" action="RunPlugin(plugin://plugin.video.kod/?ew0KICAgICJhY3Rpb24iOiAic2VydmVyc19ibGFja2xpc3QiLA0KICAgICJjaGFubmVsIjogInNldHRpbmciDQp9==)"/>
|
||||
<setting id="servers_favorites" visible="true" type="action" label="60551" action="RunPlugin(plugin://plugin.video.kod/?ew0KICAgICJhY3Rpb24iOiAic2VydmVyc19mYXZvcml0ZXMiLA0KICAgICJjaGFubmVsIjogInNldHRpbmciDQp9==)"/>
|
||||
<setting id="servers_blacklist" visible="true" type="action" label="60550" action="RunPlugin(plugin://plugin.video.kod/?ew0KICAgICJhY3Rpb24iOiAic2VydmVyc19ibGFja2xpc3QiLA0KICAgICJjaGFubmVsIjogInNldHRpbmciDQp9==)"/>
|
||||
|
||||
<!-- <setting id="hide_servers" type="bool" label="70747" default="false" visible="eq(-1,true)" subsetting="true"/> -->
|
||||
<setting id="checklinks" type="bool" label="30020" default="false"/>
|
||||
|
||||
@@ -6,14 +6,31 @@
|
||||
<top>0</top>
|
||||
</coordinates>
|
||||
<controls>
|
||||
<control type='label' id='200'>
|
||||
<description>Background Color</description>
|
||||
<visible>False</visible>
|
||||
</control>
|
||||
<control type='label' id='201'>
|
||||
<description>Overlay Color</description>
|
||||
<visible>False</visible>
|
||||
</control>
|
||||
<control type='label' id='202'>
|
||||
<description>Selection Color</description>
|
||||
<visible>False</visible>
|
||||
</control>
|
||||
<control type='label' id='203'>
|
||||
<description>Text Color</description>
|
||||
<visible>False</visible>
|
||||
</control>
|
||||
|
||||
<control type="button">
|
||||
<description>Close Button</description>
|
||||
<left>0</left>
|
||||
<top>0</top>
|
||||
<width>100%</width>
|
||||
<height>100%</height>
|
||||
<texturefocus colordiffuse="77232323">white.png</texturefocus>
|
||||
<texturenofocus colordiffuse="77232323">white.png</texturenofocus>
|
||||
<texturefocus colordiffuse="Control.GetLabel(201)">white.png</texturefocus>
|
||||
<texturenofocus colordiffuse="Control.GetLabel(201)">white.png</texturenofocus>
|
||||
<animation effect="fade" time="200">WindowOpen</animation>
|
||||
<animation effect="fade" time="200">WindowClose</animation>
|
||||
<onclick>Action(close)</onclick>
|
||||
@@ -44,7 +61,7 @@
|
||||
<left>0</left>
|
||||
<width>100%</width>
|
||||
<height>100%</height>
|
||||
<texture colordiffuse="Container(1).ListItem.Property(background)">white.png</texture>
|
||||
<texture colordiffuse="Control.GetLabel(200)">white.png</texture>
|
||||
</control>
|
||||
|
||||
<control type="grouplist">
|
||||
@@ -52,7 +69,7 @@
|
||||
<top>0</top>
|
||||
<left>0</left>
|
||||
<width>100%</width>
|
||||
<height>220</height>
|
||||
<height>100%</height>
|
||||
<orientation>vertical</orientation>
|
||||
|
||||
<control type="list" id="1">
|
||||
@@ -68,6 +85,7 @@
|
||||
<pagecontrol>61</pagecontrol>
|
||||
<itemlayout height="220" width="220">
|
||||
<control type="image">
|
||||
<description>Icon</description>
|
||||
<width>220</width>
|
||||
<height>220</height>
|
||||
<texture>$INFO[ListItem.Property(thumbnail)]</texture>
|
||||
@@ -77,12 +95,15 @@
|
||||
</itemlayout>
|
||||
<focusedlayout height="220" width="220">
|
||||
<control type="image">
|
||||
<top>1</top>
|
||||
<width>220</width>
|
||||
<height>218</height>
|
||||
<texture colordiffuse="Container(1).ListItem.Property(select)">white.png</texture>
|
||||
<description>Selection</description>
|
||||
<top>0</top>
|
||||
<left>0</left>
|
||||
<width>100%</width>
|
||||
<height>100%</height>
|
||||
<texture colordiffuse="Control.GetLabel(202)">white.png</texture>
|
||||
</control>
|
||||
<control type="image">
|
||||
<description>Icon</description>
|
||||
<width>220</width>
|
||||
<height>220</height>
|
||||
<texture>$INFO[ListItem.Property(thumbnail)]</texture>
|
||||
@@ -90,13 +111,13 @@
|
||||
<align>center</align>
|
||||
</control>
|
||||
<control type="textbox">
|
||||
<description>Selected Item</description>
|
||||
<description>Item Title</description>
|
||||
<left>0</left>
|
||||
<top>180</top>
|
||||
<width>100%</width>
|
||||
<height>40</height>
|
||||
<font>font13</font>
|
||||
<textcolor>FFFFFFFF</textcolor>
|
||||
<textcolor>Control.GetLabel(203)</textcolor>
|
||||
<label>$INFO[ListItem.Label]</label>
|
||||
<align>center</align>
|
||||
<aligny>center</aligny>
|
||||
@@ -117,6 +138,7 @@
|
||||
<pagecontrol>61</pagecontrol>
|
||||
<itemlayout height="220" width="220">
|
||||
<control type="image">
|
||||
<description>Icon</description>
|
||||
<width>220</width>
|
||||
<height>220</height>
|
||||
<texture>$INFO[ListItem.Property(thumbnail)]</texture>
|
||||
@@ -126,12 +148,15 @@
|
||||
</itemlayout>
|
||||
<focusedlayout height="220" width="220">
|
||||
<control type="image">
|
||||
<top>1</top>
|
||||
<width>220</width>
|
||||
<height>218</height>
|
||||
<texture colordiffuse="Container(1).ListItem.Property(select)">white.png</texture>
|
||||
<description>Selection</description>
|
||||
<top>0</top>
|
||||
<left>0</left>
|
||||
<width>100%</width>
|
||||
<height>100%</height>
|
||||
<texture colordiffuse="Control.GetLabel(202)">white.png</texture>
|
||||
</control>
|
||||
<control type="image">
|
||||
<description>Icon</description>
|
||||
<width>220</width>
|
||||
<height>220</height>
|
||||
<texture>$INFO[ListItem.Property(thumbnail)]</texture>
|
||||
@@ -139,13 +164,13 @@
|
||||
<align>center</align>
|
||||
</control>
|
||||
<control type="textbox">
|
||||
<description>Selected Item</description>
|
||||
<description>Item Title</description>
|
||||
<left>0</left>
|
||||
<top>180</top>
|
||||
<width>100%</width>
|
||||
<height>40</height>
|
||||
<font>font13</font>
|
||||
<textcolor>FFFFFFFF</textcolor>
|
||||
<textcolor>Control.GetLabel(203)</textcolor>
|
||||
<label>$INFO[ListItem.Label]</label>
|
||||
<align>center</align>
|
||||
<aligny>center</aligny>
|
||||
@@ -155,38 +180,28 @@
|
||||
</control>
|
||||
|
||||
<control type="button" id='101'>
|
||||
<description>Row Down</description>
|
||||
<visible>!String.IsEmpty(Container(1).ListItem.Property(sub)) + !Control.HasFocus(2) + !Control.HasFocus(102)</visible>
|
||||
<animation effect="fade" start="0" end="100" time="200" reversible="true" condition="Control.IsVisible(101)">Conditional</animation>
|
||||
<!-- <animation effect="slide" end="220,0" condition="Integer.IsGreater(Container(1).Position,0)">Conditional</animation>
|
||||
<animation effect="slide" end="220,0" condition="Integer.IsGreater(Container(1).Position,1)">Conditional</animation>
|
||||
<animation effect="slide" end="220,0" condition="Integer.IsGreater(Container(1).Position,2)">Conditional</animation>
|
||||
<animation effect="slide" end="220,0" condition="Integer.IsGreater(Container(1).Position,3)">Conditional</animation>
|
||||
<animation effect="slide" end="220,0" condition="Integer.IsGreater(Container(1).Position,4)">Conditional</animation>
|
||||
<animation effect="slide" end="220,0" condition="Integer.IsGreater(Container(1).Position,5)">Conditional</animation> -->
|
||||
<left>520</left>
|
||||
<top>240</top>
|
||||
<width>60</width>
|
||||
<height>60</height>
|
||||
<texturefocus colordiffuse="Container(1).ListItem.Property(text)">down.png</texturefocus>
|
||||
<texturenofocus colordiffuse="Container(1).ListItem.Property(text)">down.png</texturenofocus>
|
||||
<left>540</left>
|
||||
<top>260</top>
|
||||
<width>20</width>
|
||||
<height>20</height>
|
||||
<texturefocus colordiffuse="Control.GetLabel(203)">dd.png</texturefocus>
|
||||
<texturenofocus colordiffuse="Control.GetLabel(203)">dd.png</texturenofocus>
|
||||
<aspectratio>keep</aspectratio>
|
||||
</control>
|
||||
|
||||
<control type="button" id='102'>
|
||||
<description>Row Up</description>
|
||||
<visible>!Control.HasFocus(1) + !Control.HasFocus(101)</visible>
|
||||
<animation effect="fade" start="0" end="100" time="200" reversible="true" condition="Control.IsVisible(102)">Conditional</animation>
|
||||
<!-- <animation effect="slide" end="220,0" condition="Integer.IsGreater(Container(2).Position,0)">Conditional</animation>
|
||||
<animation effect="slide" end="220,0" condition="Integer.IsGreater(Container(2).Position,1)">Conditional</animation>
|
||||
<animation effect="slide" end="220,0" condition="Integer.IsGreater(Container(2).Position,2)">Conditional</animation>
|
||||
<animation effect="slide" end="220,0" condition="Integer.IsGreater(Container(2).Position,3)">Conditional</animation>
|
||||
<animation effect="slide" end="220,0" condition="Integer.IsGreater(Container(2).Position,4)">Conditional</animation>
|
||||
<animation effect="slide" end="220,0" condition="Integer.IsGreater(Container(2).Position,5)">Conditional</animation> -->
|
||||
<left>520</left>
|
||||
<left>540</left>
|
||||
<top>-80</top>
|
||||
<width>60</width>
|
||||
<height>60</height>
|
||||
<texturefocus colordiffuse="Container(1).ListItem.Property(text)">up.png</texturefocus>
|
||||
<texturenofocus colordiffuse="Container(1).ListItem.Property(text)">up.png</texturenofocus>
|
||||
<width>20</width>
|
||||
<height>20</height>
|
||||
<texturefocus colordiffuse="Control.GetLabel(203)">uu.png</texturefocus>
|
||||
<texturenofocus colordiffuse="Control.GetLabel(203)">uu.png</texturenofocus>
|
||||
<aspectratio>keep</aspectratio>
|
||||
</control>
|
||||
</control> <!-- GROUP CONTROLS END -->
|
||||
|
||||
BIN
resources/skins/Default/media/dd.png
Normal file
BIN
resources/skins/Default/media/dd.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 2.5 KiB |
BIN
resources/skins/Default/media/uu.png
Normal file
BIN
resources/skins/Default/media/uu.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 2.4 KiB |
25
servers/evoload.json
Normal file
25
servers/evoload.json
Normal file
@@ -0,0 +1,25 @@
|
||||
{
|
||||
"active": true,
|
||||
"find_videos": {
|
||||
"ignore_urls": [],
|
||||
"patterns": [
|
||||
{
|
||||
"pattern": "https?://evoload.io/v/([a-zA-Z0-9]+)",
|
||||
"url": "https://evoload.io/e/\\1?h=https://evoload.io/v/\\1"
|
||||
}
|
||||
]
|
||||
},
|
||||
"free": true,
|
||||
"id": "evoload",
|
||||
"name": "EvoLoad",
|
||||
"settings": [
|
||||
{
|
||||
"default": false,
|
||||
"enabled": true,
|
||||
"id": "black_list",
|
||||
"label": "@70708",
|
||||
"type": "bool",
|
||||
"visible": true
|
||||
}
|
||||
]
|
||||
}
|
||||
48
servers/evoload.py
Normal file
48
servers/evoload.py
Normal file
@@ -0,0 +1,48 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# --------------------------------------------------------
|
||||
|
||||
# Conector EvoLoad By 4l3x87
|
||||
# --------------------------------------------------------
|
||||
from core import httptools, jsontools
|
||||
from core import scrapertools
|
||||
from platformcode import config
|
||||
from platformcode import logger
|
||||
|
||||
|
||||
def test_video_exists(page_url):
|
||||
logger.debug("(page_url='%s')" % page_url)
|
||||
json = get_json(page_url)
|
||||
if not json or ('xstatus' in json and json['xstatus'] == 'del'):
|
||||
return False, config.get_localized_string(70449) % "EvoLoad"
|
||||
return True, ""
|
||||
|
||||
|
||||
def get_json(page_url):
|
||||
csrv_pass = '7dczpuzsmak'
|
||||
code = page_url[-14:]
|
||||
csrv_token = httptools.downloadpage('https://csrv.evosrv.com/captcha?m412548', headers={"Referer": page_url}).data
|
||||
post = 'code=' + code + '&token=&csrv_token=' + csrv_token + '&pass=' + csrv_pass + '&reff=' + page_url
|
||||
logger.debug("post=" + post)
|
||||
response = httptools.downloadpage("https://evoload.io/SecurePlayer", post=post, headers=[])
|
||||
data = jsontools.load(response.data)
|
||||
if data:
|
||||
return data
|
||||
return False
|
||||
|
||||
|
||||
def get_video_url(page_url, premium=False, user="", password="", video_password=""):
|
||||
logger.debug("url=" + page_url)
|
||||
video_urls = []
|
||||
|
||||
json = get_json(page_url)
|
||||
label = url = ''
|
||||
|
||||
if json:
|
||||
if 'name' in json:
|
||||
label = json['name']
|
||||
if 'stream' in json and 'src' in json['stream']:
|
||||
url = json['stream']['src']
|
||||
|
||||
if url:
|
||||
video_urls.append(['%s [evoload]' % label, url])
|
||||
return video_urls
|
||||
@@ -2,25 +2,30 @@
|
||||
# -*- Channel Community -*-
|
||||
|
||||
|
||||
import re, inspect, xbmcgui
|
||||
import re, inspect, mimetypes, xbmcgui
|
||||
|
||||
from core import httptools, jsontools, tmdb, support, filetools
|
||||
from core.item import Item
|
||||
from lib import unshortenit
|
||||
from platformcode import config, platformtools, logger
|
||||
from channelselector import get_thumb
|
||||
from collections import OrderedDict
|
||||
from core import servertools
|
||||
|
||||
info_language = ["de", "en", "es", "fr", "it", "pt"] # from videolibrary.json
|
||||
try: lang = info_language[config.get_setting("info_language", "videolibrary")]
|
||||
except: lang = 'it'
|
||||
info_language = ["de", "en", "es", "fr", "it", "pt"] # from videolibrary.json
|
||||
try:
|
||||
lang = info_language[config.get_setting("info_language", "videolibrary")]
|
||||
except:
|
||||
lang = 'it'
|
||||
|
||||
defpage = ["", "20", "40", "60", "80", "100"]
|
||||
defp = defpage[config.get_setting('pagination','community')]
|
||||
defp = defpage[config.get_setting('pagination', 'community')]
|
||||
disable_pagination = False
|
||||
show_seasons = config.get_setting('show_seasons','community')
|
||||
show_seasons = config.get_setting('show_seasons', 'community')
|
||||
|
||||
tmdb_api = 'a1ab8b8669da03637a4b98fa39c39228'
|
||||
|
||||
|
||||
def mainlist(item):
|
||||
logger.debug()
|
||||
|
||||
@@ -38,19 +43,19 @@ def show_channels(item):
|
||||
itemlist = []
|
||||
|
||||
# add context menu
|
||||
context = [{"title": config.get_localized_string(50005), "action": "remove_channel", "channel": "community"}]
|
||||
context = [{"title": config.get_localized_string(50005), "action": "remove_channel", "channel": "community"}]
|
||||
|
||||
# read json
|
||||
json = load_and_check(item)
|
||||
|
||||
itemlist.append(Item(channel=item.channel,
|
||||
title=support.typo(config.get_localized_string(70676),'bold color kod'),
|
||||
title=support.typo(config.get_localized_string(70676), 'bold color kod'),
|
||||
action='add_channel',
|
||||
thumbnail=get_thumb('add.png')))
|
||||
|
||||
for key, channel in json['channels'].items():
|
||||
path = filetools.dirname(channel['path']) # relative path
|
||||
channel_json = load_json(channel) # read channel json
|
||||
path = filetools.dirname(channel['path']) # relative path
|
||||
channel_json = load_json(channel) # read channel json
|
||||
|
||||
# retrieve information from json
|
||||
thumbnail = relative('thumbnail', channel_json, path)
|
||||
@@ -59,13 +64,13 @@ def show_channels(item):
|
||||
plot = channel_json['plot'] if 'plot' in channel_json else ''
|
||||
|
||||
itemlist.append(Item(channel=item.channel,
|
||||
title=support.typo(channel['channel_name'],'bold'),
|
||||
title=support.typo(channel['channel_name'], 'bold'),
|
||||
url=channel['url'] if 'url' in channel else path,
|
||||
thumbnail=thumbnail,
|
||||
fanart=fanart,
|
||||
plot=plot,
|
||||
action='show_menu',
|
||||
channel_id = key,
|
||||
channel_id=key,
|
||||
context=context,
|
||||
path=path))
|
||||
|
||||
@@ -77,8 +82,7 @@ def show_menu(item):
|
||||
logger.debug()
|
||||
itemlist = []
|
||||
|
||||
|
||||
if item.menu: # if second level menu
|
||||
if item.menu: # if second level menu
|
||||
get_sub_menu(item, item.menu, 'level2', itemlist)
|
||||
else:
|
||||
if type(item.url) == dict:
|
||||
@@ -103,14 +107,12 @@ def show_menu(item):
|
||||
itemlist += get_seasons(item)
|
||||
elif key in ['episodes_list']:
|
||||
itemlist += episodios(item, json, key)
|
||||
elif key in ['links']:
|
||||
elif key in ['links', 'find_links']:
|
||||
itemlist += findvideos(item)
|
||||
elif key in ['search'] and 'url' in json['search']:
|
||||
search_json = json['search']
|
||||
itemlist += get_search_menu(item, search_json)
|
||||
|
||||
|
||||
|
||||
if 'channel_name' in json and not 'disable_search' in json and 'search' not in json:
|
||||
itemlist += get_search_menu(item, json, channel_name=json['channel_name'])
|
||||
logger.debug('PAGINATION:', disable_pagination)
|
||||
@@ -118,7 +120,7 @@ def show_menu(item):
|
||||
|
||||
|
||||
def search(item, text):
|
||||
logger.info('search',text)
|
||||
logger.info('search', text)
|
||||
itemlist = []
|
||||
|
||||
if item.custom_search:
|
||||
@@ -142,6 +144,7 @@ def search(item, text):
|
||||
|
||||
return itemlist
|
||||
|
||||
|
||||
def global_search(item, text):
|
||||
itemlist = []
|
||||
json = load_json(item)
|
||||
@@ -149,7 +152,8 @@ def global_search(item, text):
|
||||
|
||||
if 'menu' in json:
|
||||
for option in json['menu']:
|
||||
if option in ['submenu', 'level2'] and 'seach' in json['menu'][option] and 'url' in json['menu'][option]['search']:
|
||||
if option in ['submenu', 'level2'] and 'seach' in json['menu'][option] and 'url' in json['menu'][option][
|
||||
'search']:
|
||||
item.custom_search = json['menu'][option]['search']['url']
|
||||
itemlist += search(item, text)
|
||||
else:
|
||||
@@ -158,15 +162,13 @@ def global_search(item, text):
|
||||
if item.url:
|
||||
itemlist += global_search(item, text)
|
||||
|
||||
if any(key in json for key in ['movies_list','tvshows_list', 'generic_list']):
|
||||
if any(key in json for key in ['movies_list', 'tvshows_list', 'generic_list']):
|
||||
itemlist += search(item, text)
|
||||
return itemlist
|
||||
|
||||
|
||||
|
||||
|
||||
def peliculas(item, json='', key='', itemlist=[]):
|
||||
item.plot = item.thumb = item.fanart =''
|
||||
item.plot = item.thumb = item.fanart = ''
|
||||
logger.debug('PAGINATION:', item.disable_pagination)
|
||||
if not json:
|
||||
key = item.key
|
||||
@@ -174,25 +176,28 @@ def peliculas(item, json='', key='', itemlist=[]):
|
||||
else:
|
||||
json = json[key]
|
||||
|
||||
# logger.debug('DEBUG:', json)
|
||||
|
||||
infoLabels = item.infoLabels if item.infoLabels else {}
|
||||
contentType = 'tvshow' if 'tvshow' in key else 'movie'
|
||||
itlist = filterkey = []
|
||||
action = 'findvideos'
|
||||
|
||||
if inspect.stack()[1][3] not in ['add_tvshow', 'get_episodes', 'update', 'find_episodes', 'search'] and not item.filterkey and not item.disable_pagination:
|
||||
if inspect.stack()[1][3] not in ['add_tvshow', 'get_episodes', 'update', 'find_episodes',
|
||||
'search'] and not item.filterkey and not item.disable_pagination:
|
||||
Pagination = int(defp) if defp.isdigit() else ''
|
||||
else: Pagination = ''
|
||||
else:
|
||||
Pagination = ''
|
||||
pag = item.page if item.page else 1
|
||||
|
||||
for i, option in enumerate(json):
|
||||
if Pagination and (pag - 1) * Pagination > i: continue # pagination
|
||||
if Pagination and i >= pag * Pagination: break
|
||||
if item.filterkey and item.filterkey in option:
|
||||
filterkey = [it.lower() for it in option[item.filterkey]] if type(option[item.filterkey]) == list else [option[item.filterkey].lower()]
|
||||
filterkey = [it.lower() for it in option[item.filterkey]] if type(option[item.filterkey]) == list else [
|
||||
option[item.filterkey].lower()]
|
||||
else:
|
||||
filterkey = []
|
||||
|
||||
|
||||
title = option['title'] if 'title' in option else ''
|
||||
|
||||
if 'tvshows_list' in key and 'links' not in option:
|
||||
@@ -200,26 +205,32 @@ def peliculas(item, json='', key='', itemlist=[]):
|
||||
|
||||
# filter elements
|
||||
if (not item.filter or item.filter.lower() in filterkey) and item.search.lower() in title.lower() and title:
|
||||
|
||||
if 'generic_list' in key and 'links' not in option and 'url' in option:
|
||||
option['links'] = []
|
||||
option['links'].append({'url': option['url']})
|
||||
option['url'] = ''
|
||||
|
||||
extra = set_extra_values(item, option, item.path)
|
||||
|
||||
infoLabels['year'] = option['year'] if 'year' in option else ''
|
||||
infoLabels['tmdb_id'] = option['tmdb_id'] if 'tmdb_id' in option else ''
|
||||
|
||||
it = Item(channel = item.channel,
|
||||
title = set_title(title, extra.language, extra.quality),
|
||||
fulltitle = title,
|
||||
show = title,
|
||||
contentTitle = title if contentType == 'movie' else '',
|
||||
contentSerieName = title if contentType != 'movie' else '',
|
||||
contentType = contentType,
|
||||
infoLabels = infoLabels,
|
||||
url = extra.url,
|
||||
path = item.path,
|
||||
thumbnail = extra.thumb,
|
||||
fanart = extra.fanart,
|
||||
plot = extra.plot,
|
||||
personal_plot = extra.plot,
|
||||
action = action)
|
||||
it = Item(channel=item.channel,
|
||||
title=set_title(title, extra.language, extra.quality),
|
||||
fulltitle=title,
|
||||
show=title,
|
||||
contentTitle=title if contentType == 'movie' else '',
|
||||
contentSerieName=title if contentType != 'movie' else '',
|
||||
contentType=contentType,
|
||||
infoLabels=infoLabels,
|
||||
url=extra.url,
|
||||
path=item.path,
|
||||
thumbnail=extra.thumb,
|
||||
fanart=extra.fanart,
|
||||
plot=extra.plot,
|
||||
personal_plot=extra.plot,
|
||||
action=action)
|
||||
itlist.append(it)
|
||||
|
||||
if not 'generic_list' in key:
|
||||
@@ -242,8 +253,10 @@ def get_seasons(item):
|
||||
itemlist = []
|
||||
infoLabels = item.infoLabels
|
||||
json = item.url if type(item.url) == dict else item.url
|
||||
if 'seasons_list' in json: json = json['seasons_list']
|
||||
elif 'tvshows_list' in json: return show_menu(item)
|
||||
if 'seasons_list' in json:
|
||||
json = json['seasons_list']
|
||||
elif 'tvshows_list' in json:
|
||||
return show_menu(item)
|
||||
for option in json:
|
||||
infoLabels['season'] = option['season']
|
||||
title = config.get_localized_string(60027) % option['season']
|
||||
@@ -263,12 +276,14 @@ def get_seasons(item):
|
||||
contentType='season' if show_seasons else 'tvshow',
|
||||
path=extra.path))
|
||||
|
||||
if inspect.stack()[2][3] in ['add_tvshow', 'get_episodes', 'update', 'find_episodes', 'get_newest'] or show_seasons == False:
|
||||
if inspect.stack()[2][3] in ['add_tvshow', 'get_episodes', 'update', 'find_episodes',
|
||||
'get_newest'] or show_seasons == False:
|
||||
itlist = []
|
||||
for item in itemlist:
|
||||
itlist = episodios(item)
|
||||
itemlist = itlist
|
||||
if inspect.stack()[2][3] not in ['add_tvshow', 'get_episodes', 'update', 'find_episodes', 'get_newest'] and defp and not item.disable_pagination:
|
||||
if inspect.stack()[2][3] not in ['add_tvshow', 'get_episodes', 'update', 'find_episodes',
|
||||
'get_newest'] and defp and not item.disable_pagination:
|
||||
itemlist = pagination(item, itemlist)
|
||||
|
||||
if show_seasons:
|
||||
@@ -277,10 +292,10 @@ def get_seasons(item):
|
||||
return itemlist
|
||||
|
||||
|
||||
def episodios(item, json ='', key='', itemlist =[]):
|
||||
def episodios(item, json='', key='', itemlist=[]):
|
||||
logger.debug()
|
||||
infoLabels = item.infoLabels
|
||||
itm=item
|
||||
itm = item
|
||||
|
||||
if type(item.url) == dict:
|
||||
if 'seasons_list' in item.url:
|
||||
@@ -304,9 +319,11 @@ def episodios(item, json ='', key='', itemlist =[]):
|
||||
ep = 1
|
||||
season = infoLabels['season'] if 'season' in infoLabels else item.contentSeason if item.contentSeason else 1
|
||||
|
||||
if inspect.stack()[1][3] not in ['add_tvshow', 'get_episodes', 'update', 'find_episodes', 'search'] and not show_seasons:
|
||||
if inspect.stack()[1][3] not in ['add_tvshow', 'get_episodes', 'update', 'find_episodes',
|
||||
'search'] and not show_seasons:
|
||||
Pagination = int(defp) if defp.isdigit() else ''
|
||||
else: Pagination = ''
|
||||
else:
|
||||
Pagination = ''
|
||||
pag = item.page if item.page else 1
|
||||
|
||||
# make items
|
||||
@@ -315,7 +332,7 @@ def episodios(item, json ='', key='', itemlist =[]):
|
||||
if Pagination and i >= pag * Pagination: break
|
||||
# build numeration of episodes
|
||||
numeration = option['number'] if 'number' in option else option['title']
|
||||
match = support.match(numeration , patron=r'(?P<season>\d+)x(?P<episode>\d+)').match
|
||||
match = support.match(numeration, patron=r'(?P<season>\d+)x(?P<episode>\d+)').match
|
||||
if match:
|
||||
episode_number = match[1]
|
||||
ep = int(match[1]) + 1
|
||||
@@ -338,25 +355,25 @@ def episodios(item, json ='', key='', itemlist =[]):
|
||||
title = '%sx%s%s' % (season_number, episode_number, title)
|
||||
extra = set_extra_values(item, option, item.path)
|
||||
if not item.filterseason or season_number == int(item.filterseason):
|
||||
itemlist.append(Item(channel = item.channel,
|
||||
title = set_title(title, extra.language, extra.quality),
|
||||
fulltitle = item.fulltitle,
|
||||
show = item.show,
|
||||
url = option,
|
||||
action = 'findvideos',
|
||||
plot = extra.plot,
|
||||
thumbnail= extra.thumb if extra.thumb else item.thumbnail,
|
||||
fanart = extra.fanart,
|
||||
contentSeason = season_number,
|
||||
contentEpisode = episode_number,
|
||||
infoLabels = infoLabels,
|
||||
contentType = 'episode',
|
||||
path = item.path))
|
||||
itemlist.append(Item(channel=item.channel,
|
||||
title=set_title(title, extra.language, extra.quality),
|
||||
fulltitle=item.fulltitle,
|
||||
show=item.show,
|
||||
url=option,
|
||||
action='findvideos',
|
||||
plot=extra.plot,
|
||||
thumbnail=extra.thumb if extra.thumb else item.thumbnail,
|
||||
fanart=extra.fanart,
|
||||
contentSeason=season_number,
|
||||
contentEpisode=episode_number,
|
||||
infoLabels=infoLabels,
|
||||
contentType='episode',
|
||||
path=item.path))
|
||||
|
||||
# if showseason
|
||||
if inspect.stack()[1][3] not in ['add_tvshow', 'get_episodes', 'update', 'find_episodes', 'get_newest', 'search']:
|
||||
if show_seasons and not item.filterseason:
|
||||
itm.contentType='season'
|
||||
itm.contentType = 'season'
|
||||
season_list = []
|
||||
for item in itemlist:
|
||||
if item.contentSeason not in season_list:
|
||||
@@ -371,7 +388,7 @@ def episodios(item, json ='', key='', itemlist =[]):
|
||||
url=itm.url,
|
||||
action='episodios',
|
||||
contentSeason=season,
|
||||
contentType = 'episode',
|
||||
contentType='episode',
|
||||
infoLabels=infoLabels,
|
||||
filterseason=str(season),
|
||||
path=item.path))
|
||||
@@ -391,17 +408,46 @@ def episodios(item, json ='', key='', itemlist =[]):
|
||||
|
||||
# Find Servers
|
||||
def findvideos(item):
|
||||
logger.debug()
|
||||
# logger.debug('DEBUG', item)
|
||||
item.contentTitle = item.fulltitle
|
||||
itemlist = []
|
||||
json = []
|
||||
if 'links' in item.url:
|
||||
json = item.url['links']
|
||||
elif 'find_links' in item.url:
|
||||
for link in item.url['find_links']:
|
||||
link['url'] = unshortenit.findlinks(link['url'])
|
||||
mimetype = findS = None
|
||||
mimetype = mimetypes.MimeTypes().guess_type(link['url'])[0]
|
||||
if mimetype is None:
|
||||
findS = servertools.get_server_from_url(link['url'])
|
||||
if mimetype is None and findS is None:
|
||||
data = support.match(link['url']).data
|
||||
itemlist_url = servertools.find_video_items(data=data)
|
||||
if len(itemlist_url):
|
||||
for item_url in itemlist_url:
|
||||
valid = True
|
||||
patterns = link.get('patterns', False)
|
||||
if patterns:
|
||||
valid = False
|
||||
for pattern in patterns:
|
||||
match = re.search(pattern, item_url.url)
|
||||
if match:
|
||||
valid = True
|
||||
break
|
||||
if valid:
|
||||
json.append({"url": item_url.url})
|
||||
else:
|
||||
json.append(link)
|
||||
|
||||
else:
|
||||
json = item.url
|
||||
url = item.url
|
||||
item.url = {}
|
||||
json.append({"url": url})
|
||||
|
||||
# support.dbg()
|
||||
for option in json:
|
||||
extra = set_extra_values(item, option, item.path)
|
||||
|
||||
itemlist.append(
|
||||
item.clone(url=option['url'],
|
||||
action='play',
|
||||
@@ -409,32 +455,34 @@ def findvideos(item):
|
||||
contentLanguage=extra.language,
|
||||
extraInfo=extra.info))
|
||||
|
||||
videolibrary = item.url.get('videolibrary', True)
|
||||
item.autoplay = item.url.get('autoplay', False)
|
||||
|
||||
item.url = '' # do not pass referer
|
||||
return support.server(item, itemlist=itemlist)
|
||||
return support.server(item, itemlist=itemlist, Videolibrary=videolibrary)
|
||||
|
||||
|
||||
################################ Menu ################################
|
||||
|
||||
def get_menu(item, json, key, itemlist=[]):
|
||||
logger.debug()
|
||||
json = json[key]
|
||||
for option in json:
|
||||
title = option['title'] if 'title' in option else json[option] if 'search' not in option else ''
|
||||
extra = set_extra_values(item, option, item.path)
|
||||
level2 = option if 'level2' in option else []
|
||||
it = Item(channel = item.channel,
|
||||
title = support.typo(title, 'bullet bold'),
|
||||
fulltitle = title,
|
||||
show = title,
|
||||
url = extra.url,
|
||||
path = item.path,
|
||||
thumbnail = extra.thumb,
|
||||
fanart = extra.fanart,
|
||||
plot = extra.plot,
|
||||
action = 'show_menu',
|
||||
menu = level2 if not item.menu else None,
|
||||
filterkey = extra.filterkey,
|
||||
filter = extra.filter)
|
||||
level2 = option if 'level2' in option else []
|
||||
it = Item(channel=item.channel,
|
||||
title=support.typo(title, 'bullet bold'),
|
||||
fulltitle=title,
|
||||
show=title,
|
||||
url=extra.url,
|
||||
path=item.path,
|
||||
thumbnail=extra.thumb,
|
||||
fanart=extra.fanart,
|
||||
plot=extra.plot,
|
||||
action='show_menu',
|
||||
menu=level2 if not item.menu else None,
|
||||
filterkey=extra.filterkey,
|
||||
filter=extra.filter)
|
||||
if title:
|
||||
itemlist.append(it)
|
||||
|
||||
@@ -442,7 +490,7 @@ def get_menu(item, json, key, itemlist=[]):
|
||||
get_search_menu(it, json, itemlist)
|
||||
|
||||
elif 'submenu' in option:
|
||||
get_sub_menu(it, option, 'submenu' ,itemlist)
|
||||
get_sub_menu(it, option, 'submenu', itemlist)
|
||||
|
||||
for item in itemlist:
|
||||
if not item.thumbnail: support.thumb(item)
|
||||
@@ -463,20 +511,20 @@ def get_sub_menu(item, json, key, itemlist=[]):
|
||||
extra = set_extra_values(item, json[option], item.path)
|
||||
if not extra.url: extra.url = item.url
|
||||
filterkey = option
|
||||
level2 = option if 'level2' in option else []
|
||||
it = Item(channel = item.channel,
|
||||
title = support.typo(title,'submenu'),
|
||||
fulltitle = title,
|
||||
show = title,
|
||||
url = extra.url,
|
||||
path = item.path,
|
||||
thumbnail = extra.thumb,
|
||||
fanart = extra.fanart,
|
||||
plot = extra.plot,
|
||||
action = 'show_menu',
|
||||
menu = level2 if not item.menu else None,
|
||||
filterkey = filterkey,
|
||||
description = extra.description)
|
||||
level2 = option if 'level2' in option else []
|
||||
it = Item(channel=item.channel,
|
||||
title=support.typo(title, 'submenu'),
|
||||
fulltitle=title,
|
||||
show=title,
|
||||
url=extra.url,
|
||||
path=item.path,
|
||||
thumbnail=extra.thumb,
|
||||
fanart=extra.fanart,
|
||||
plot=extra.plot,
|
||||
action='show_menu',
|
||||
menu=level2 if not item.menu else None,
|
||||
filterkey=filterkey,
|
||||
description=extra.description)
|
||||
itemlist.append(it)
|
||||
|
||||
if 'search' in option:
|
||||
@@ -500,7 +548,7 @@ def get_search_menu(item, json='', itemlist=[], channel_name=''):
|
||||
extra = set_extra_values(item, json, item.path)
|
||||
|
||||
itemlist.append(Item(channel=item.channel,
|
||||
title=support.typo(title,'submenu bold'),
|
||||
title=support.typo(title, 'submenu bold'),
|
||||
fulltitle=title,
|
||||
show=title,
|
||||
thumbnail=extra.thumb,
|
||||
@@ -515,7 +563,7 @@ def get_search_menu(item, json='', itemlist=[], channel_name=''):
|
||||
return itemlist
|
||||
|
||||
|
||||
def submenu(item, json, key, itemlist = [], filter_list = []):
|
||||
def submenu(item, json, key, itemlist=[], filter_list=[]):
|
||||
logger.debug(item)
|
||||
import sys
|
||||
if sys.version_info[0] >= 3:
|
||||
@@ -527,8 +575,10 @@ def submenu(item, json, key, itemlist = [], filter_list = []):
|
||||
if type(item.description) == dict:
|
||||
description = item.description
|
||||
else:
|
||||
if ':/' in item.description: url = item.description
|
||||
else: url = filetools.join(item.path, item.description)
|
||||
if ':/' in item.description:
|
||||
url = item.description
|
||||
else:
|
||||
url = filetools.join(item.path, item.description)
|
||||
description = load_json(url, no_order=True)
|
||||
else:
|
||||
description = None
|
||||
@@ -585,8 +635,11 @@ def filter_thread(filter, key, item, description):
|
||||
results = tmdb_inf.results[0]
|
||||
id = results['id']
|
||||
if id:
|
||||
thumbnail = 'https://image.tmdb.org/t/p/original' + results['profile_path'] if results['profile_path'] else item.thumbnail
|
||||
json_file = httptools.downloadpage('http://api.themoviedb.org/3/person/'+ str(id) + '?api_key=' + tmdb_api + '&language=en', use_requests=True).data
|
||||
thumbnail = 'https://image.tmdb.org/t/p/original' + results['profile_path'] if results[
|
||||
'profile_path'] else item.thumbnail
|
||||
json_file = httptools.downloadpage(
|
||||
'http://api.themoviedb.org/3/person/' + str(id) + '?api_key=' + tmdb_api + '&language=en',
|
||||
use_requests=True).data
|
||||
plot += jsontools.load(json_file)['biography']
|
||||
|
||||
if description:
|
||||
@@ -596,7 +649,6 @@ def filter_thread(filter, key, item, description):
|
||||
fanart = extra.fanart if extra.fanart else item.fanart
|
||||
plot = extra.plot if extra.plot else item.plot
|
||||
|
||||
|
||||
item = Item(channel=item.channel,
|
||||
title=support.typo(filter, 'bold'),
|
||||
url=item.url,
|
||||
@@ -674,25 +726,28 @@ def set_extra_values(item, json, path):
|
||||
if key == 'quality':
|
||||
ret.quality = json[key]
|
||||
if ret.quality and not ret.quality[0].isdigit(): ret.quality = ret.quality.upper()
|
||||
elif key == 'language':
|
||||
elif key == 'language':
|
||||
ret.language = json[key].upper()
|
||||
elif key == 'plot':
|
||||
elif key == 'plot':
|
||||
ret.plot = json[key]
|
||||
elif key in ['poster', 'thumbnail']:
|
||||
ret.thumb = json[key] if ':/' in json[key] else filetools.join(path,json[key]) if '/' in json[key] else get_thumb(json[key])
|
||||
elif key == 'fanart':
|
||||
ret.fanart = json[key] if ':/' in json[key] else filetools.join(path,json[key])
|
||||
ret.thumb = json[key] if ':/' in json[key] else filetools.join(path, json[key]) if '/' in json[
|
||||
key] else get_thumb(json[key])
|
||||
elif key == 'fanart':
|
||||
ret.fanart = json[key] if ':/' in json[key] else filetools.join(path, json[key])
|
||||
elif key in ['url', 'link']:
|
||||
ret.url = json[key] if ':/' in json[key] or type(json[key]) == dict else filetools.join(path,json[key])
|
||||
elif key == 'seasons_list':
|
||||
ret.url = json[key] if ':/' in json[key] or type(json[key]) == dict else filetools.join(path, json[key])
|
||||
elif key == 'seasons_list':
|
||||
ret.url = {}
|
||||
ret.url['seasons_list'] = json['seasons_list']
|
||||
elif key == 'episodes_list':
|
||||
elif key == 'episodes_list':
|
||||
ret.url = {}
|
||||
ret.url['episodes_list'] = json['episodes_list']
|
||||
elif key == 'links':
|
||||
ret.url={}
|
||||
ret.url['links'] = json[key]
|
||||
elif key in ['links', 'find_links']:
|
||||
ret.url = {}
|
||||
ret.url[key] = json[key]
|
||||
ret.url['videolibrary'] = json.get('videolibrary', True)
|
||||
ret.url['autoplay'] = json.get('autoplay', False)
|
||||
elif key == 'filter':
|
||||
filterkey = json[key].keys()[0]
|
||||
ret.filter = json[key][filterkey]
|
||||
@@ -712,6 +767,7 @@ def set_extra_values(item, json, path):
|
||||
if not ret.plot:
|
||||
ret.plot = item.plot
|
||||
|
||||
logger.debug(ret.url)
|
||||
return ret
|
||||
|
||||
|
||||
@@ -721,8 +777,8 @@ def set_title(title, language='', quality='', info=''):
|
||||
|
||||
t = support.match(title, patron=r'\{([^\}]+)\}').match
|
||||
if 'bold' not in t: t += ' bold'
|
||||
title = re.sub(r'(\{[^\}]+\})','',title)
|
||||
title = support.typo(title,t)
|
||||
title = re.sub(r'(\{[^\}]+\})', '', title)
|
||||
title = support.typo(title, t)
|
||||
|
||||
if quality:
|
||||
title += support.typo(quality, '_ [] color kod bold')
|
||||
@@ -744,14 +800,15 @@ def relative(key, json, path):
|
||||
ret = ''
|
||||
if key in json:
|
||||
if key in ['thumbnail', 'poster']:
|
||||
ret = json[key] if ':/' in json[key] else filetools.join(path,json[key]) if '/' in json[key] else get_thumb(json[key]) if json[key] else ''
|
||||
ret = json[key] if ':/' in json[key] else filetools.join(path, json[key]) if '/' in json[
|
||||
key] else get_thumb(json[key]) if json[key] else ''
|
||||
else:
|
||||
ret = json[key] if ':/' in json[key] else filetools.join(path,json[key]) if '/' in json[key] else ''
|
||||
ret = json[key] if ':/' in json[key] else filetools.join(path, json[key]) if '/' in json[key] else ''
|
||||
|
||||
return ret
|
||||
|
||||
|
||||
def pagination(item, itemlist = []):
|
||||
def pagination(item, itemlist=[]):
|
||||
logger.debug()
|
||||
itlist = []
|
||||
|
||||
@@ -764,12 +821,13 @@ def pagination(item, itemlist = []):
|
||||
encoded_itemlist.append(it.tourl())
|
||||
if inspect.stack()[1][3] not in ['add_tvshow', 'get_episodes', 'update', 'find_episodes', 'search']:
|
||||
Pagination = int(defp) if defp.isdigit() else ''
|
||||
else: Pagination = ''
|
||||
else:
|
||||
Pagination = ''
|
||||
pag = item.page if item.page else 1
|
||||
|
||||
for i, item in enumerate(itemlist):
|
||||
if Pagination and (pag - 1) * Pagination > i: continue # pagination
|
||||
if Pagination and i >= pag * Pagination: break # pagination
|
||||
if Pagination and i >= pag * Pagination: break # pagination
|
||||
|
||||
itlist.append(item)
|
||||
|
||||
@@ -777,28 +835,30 @@ def pagination(item, itemlist = []):
|
||||
if inspect.stack()[1][3] != 'get_newest':
|
||||
itlist.append(
|
||||
Item(channel=item.channel,
|
||||
action = 'pagination',
|
||||
contentType=item.contentType,
|
||||
title=support.typo(config.get_localized_string(30992), 'color kod bold'),
|
||||
fulltitle= item.fulltitle,
|
||||
show= item.show,
|
||||
url=item.url,
|
||||
args=item.args,
|
||||
page=pag + 1,
|
||||
path=item.path,
|
||||
media_type=item.media_type,
|
||||
thumbnail=support.thumb(),
|
||||
itemlist= encoded_itemlist))
|
||||
action='pagination',
|
||||
contentType=item.contentType,
|
||||
title=support.typo(config.get_localized_string(30992), 'color kod bold'),
|
||||
fulltitle=item.fulltitle,
|
||||
show=item.show,
|
||||
url=item.url,
|
||||
args=item.args,
|
||||
page=pag + 1,
|
||||
path=item.path,
|
||||
media_type=item.media_type,
|
||||
thumbnail=support.thumb(),
|
||||
itemlist=encoded_itemlist))
|
||||
return itlist
|
||||
|
||||
|
||||
def add_channel(item):
|
||||
logger.debug()
|
||||
channel_to_add = {}
|
||||
json_file = ''
|
||||
result = platformtools.dialog_select(config.get_localized_string(70676), [config.get_localized_string(70678), config.get_localized_string(70679)])
|
||||
result = platformtools.dialog_select(config.get_localized_string(70676),
|
||||
[config.get_localized_string(70678), config.get_localized_string(70679)])
|
||||
if result == -1:
|
||||
return
|
||||
if result==0:
|
||||
if result == 0:
|
||||
file_path = xbmcgui.Dialog().browseSingle(1, config.get_localized_string(70680), 'files')
|
||||
try:
|
||||
channel_to_add['path'] = file_path
|
||||
@@ -808,7 +868,7 @@ def add_channel(item):
|
||||
except:
|
||||
pass
|
||||
|
||||
elif result==1:
|
||||
elif result == 1:
|
||||
url = platformtools.dialog_input("", config.get_localized_string(70681), False)
|
||||
try:
|
||||
if url[:4] != 'http':
|
||||
@@ -832,19 +892,21 @@ def add_channel(item):
|
||||
community_json = jsontools.load(community_json.read())
|
||||
id = 1
|
||||
while str(id) in community_json['channels']:
|
||||
id +=1
|
||||
community_json['channels'][str(id)]=(channel_to_add)
|
||||
id += 1
|
||||
community_json['channels'][str(id)] = (channel_to_add)
|
||||
|
||||
with open(path, "w") as file:
|
||||
file.write(jsontools.dump(community_json))
|
||||
file.write(jsontools.dump(community_json))
|
||||
file.close()
|
||||
|
||||
platformtools.dialog_notification(config.get_localized_string(20000), config.get_localized_string(70683) % json_file['channel_name'])
|
||||
platformtools.dialog_notification(config.get_localized_string(20000),
|
||||
config.get_localized_string(70683) % json_file['channel_name'])
|
||||
import xbmc
|
||||
xbmc.sleep(1000)
|
||||
platformtools.itemlist_refresh()
|
||||
return
|
||||
|
||||
|
||||
def remove_channel(item):
|
||||
logger.debug()
|
||||
|
||||
@@ -857,9 +919,10 @@ def remove_channel(item):
|
||||
to_delete = community_json['channels'][id]['channel_name']
|
||||
del community_json['channels'][id]
|
||||
with open(path, "w") as file:
|
||||
file.write(jsontools.dump(community_json))
|
||||
file.write(jsontools.dump(community_json))
|
||||
file.close()
|
||||
|
||||
platformtools.dialog_notification(config.get_localized_string(20000), config.get_localized_string(70684) % to_delete)
|
||||
platformtools.dialog_notification(config.get_localized_string(20000),
|
||||
config.get_localized_string(70684) % to_delete)
|
||||
platformtools.itemlist_refresh()
|
||||
return
|
||||
|
||||
@@ -262,6 +262,7 @@ def live(item):
|
||||
# make itemlist
|
||||
for ch in channel_list:
|
||||
itemlist += channels_dict[ch]
|
||||
itemlist.sort(key=lambda it: support.channels_order[it.fulltitle])
|
||||
return itemlist
|
||||
|
||||
|
||||
|
||||
@@ -400,13 +400,14 @@ def get_title(item):
|
||||
# title = re.compile("\[.*?\]", re.DOTALL).sub("", item.contentSerieName)
|
||||
if not scrapertools.get_season_and_episode(title) and item.contentEpisodeNumber:
|
||||
# contentSeason non c'è in support
|
||||
if not item.contentSeason:
|
||||
item.contentSeason = '1'
|
||||
title = "%sx%s - %s" % (item.contentSeason, str(item.contentEpisodeNumber).zfill(2), title)
|
||||
if item.contentSeason:
|
||||
title = '{}x{:02d}. {}'.format(item.contentSeason, item.contentEpisodeNumber, title)
|
||||
else:
|
||||
title = '{:02d}. {}'.format(item.contentEpisodeNumber, title)
|
||||
else:
|
||||
seas = scrapertools.get_season_and_episode(item.title)
|
||||
if seas:
|
||||
title = "%s - %s" % (seas, title)
|
||||
title = "{}. {}".format(seas, title)
|
||||
|
||||
elif item.contentTitle: # If it is a movie with the adapted channel
|
||||
title = item.contentTitle
|
||||
|
||||
@@ -722,12 +722,14 @@ def discover_list(item):
|
||||
|
||||
elif len(result) > 19 and item.discovery:
|
||||
item.discovery['page'] = str(int(item.discovery['page']) + 1)
|
||||
itemlist.append(Item(channel=item.channel, action='discover_list', title=typo(config.get_localized_string(30992), 'color kod bold'),
|
||||
list_type=item.list_type, discovery=item.discovery, thumbnail=thumb()))
|
||||
itemlist.append(Item(channel=item.channel, action='discover_list', nextPage=True,
|
||||
title=typo(config.get_localized_string(30992), 'color kod bold'),
|
||||
list_type=item.list_type, discovery=item.discovery, thumbnail=thumb(), page=item.discovery['page']))
|
||||
elif len(result) > 19:
|
||||
next_page = str(int(item.page) + 1)
|
||||
|
||||
itemlist.append(Item(channel=item.channel, action='discover_list', title=typo(config.get_localized_string(30992), 'color kod bold'),
|
||||
itemlist.append(Item(channel=item.channel, action='discover_list', nextPage=True,
|
||||
title=typo(config.get_localized_string(30992), 'color kod bold'),
|
||||
list_type=item.list_type, search_type=item.search_type, mode=item.mode, page=next_page, thumbnail=thumb()))
|
||||
|
||||
return itemlist
|
||||
@@ -789,8 +791,8 @@ def get_from_temp(item):
|
||||
results = [Item().fromurl(elem) for elem in item.itemlist[prevp:nextp]]
|
||||
|
||||
if nextp < nTotal:
|
||||
results.append(Item(channel='search', title=typo(config.get_localized_string(30992),'bold color kod'),
|
||||
action='get_from_temp', itemlist=item.itemlist, page=item.page + 1))
|
||||
results.append(Item(channel='search', title=typo(config.get_localized_string(30992), 'bold color kod'),
|
||||
action='get_from_temp', itemlist=item.itemlist, page=item.page + 1, nextPage=True))
|
||||
|
||||
tmdb.set_infoLabels_itemlist(results, True)
|
||||
for elem in results:
|
||||
|
||||
@@ -265,19 +265,19 @@ def servers_blacklist(item):
|
||||
|
||||
|
||||
def cb_servers_blacklist(dict_values):
|
||||
blaklisted = []
|
||||
progreso = platformtools.dialog_progress(config.get_localized_string(60557), config.get_localized_string(60558))
|
||||
n = len(dict_values)
|
||||
i = 1
|
||||
for k, v in list(dict_values.items()):
|
||||
if v: # If the server is blacklisted it cannot be in the favorites list
|
||||
config.set_setting("favorites_servers_list", 0, server=k)
|
||||
blaklisted.append(k)
|
||||
progreso.update(old_div((i * 100), n), config.get_localized_string(60559) % k)
|
||||
i += 1
|
||||
config.set_setting("black_list", blaklisted, server='servers')
|
||||
blaklisted = [k for k in dict_values.keys()]
|
||||
# progreso = platformtools.dialog_progress(config.get_localized_string(60557), config.get_localized_string(60558))
|
||||
# n = len(dict_values)
|
||||
# i = 1
|
||||
# for k, v in list(dict_values.items()):
|
||||
# if v: # If the server is blacklisted it cannot be in the favorites list
|
||||
# config.set_setting("favorites_servers_list", 0, server=k)
|
||||
# blaklisted.append(k)
|
||||
# progreso.update(old_div((i * 100), n), config.get_localized_string(60559) % k)
|
||||
# i += 1
|
||||
# config.set_setting("black_list", blaklisted, server='servers')
|
||||
|
||||
progreso.close()
|
||||
# progreso.close()
|
||||
|
||||
|
||||
def servers_favorites(item):
|
||||
@@ -302,16 +302,16 @@ def servers_favorites(item):
|
||||
dict_values['favorites_servers'] = False
|
||||
|
||||
server_names = [config.get_localized_string(59992)]
|
||||
favorites = config.get_setting("favorites_servers_list", server='servers', default=[])
|
||||
blacklisted = config.get_setting("black_list", server='servers', default=[])
|
||||
|
||||
for server in sorted(server_list.keys()):
|
||||
if config.get_setting("black_list", server=server):
|
||||
if server in blacklisted or config.get_setting("black_list", server=server):
|
||||
continue
|
||||
|
||||
server_names.append(server_list[server]['name'])
|
||||
|
||||
orden = config.get_setting("favorites_servers_list", server=server, default=999)
|
||||
if type(orden) != int: orden = 999
|
||||
if orden > 0:
|
||||
if server in favorites:
|
||||
orden = favorites.index(server) + 1
|
||||
dict_values[orden] = len(server_names) - 1
|
||||
|
||||
for x in range(1, 12):
|
||||
@@ -331,7 +331,6 @@ def servers_favorites(item):
|
||||
def cb_servers_favorites(server_names, dict_values):
|
||||
dict_name = {}
|
||||
dict_favorites = {}
|
||||
progreso = platformtools.dialog_progress(config.get_localized_string(60557), config.get_localized_string(60558))
|
||||
|
||||
for i, v in list(dict_values.items()):
|
||||
if i == "favorites_servers":
|
||||
@@ -342,30 +341,17 @@ def cb_servers_favorites(server_names, dict_values):
|
||||
dict_name[server_names[v]] = int(i)
|
||||
|
||||
servers_list = list(servertools.get_servers_list().items())
|
||||
n = len(servers_list)
|
||||
i = 1
|
||||
for server, server_parameters in servers_list:
|
||||
if server_parameters['name'] in list(dict_name.keys()):
|
||||
dict_favorites[dict_name[server_parameters['name']]] = server
|
||||
config.set_setting("favorites_servers_list", dict_name[server_parameters['name']], server=server)
|
||||
else:
|
||||
config.set_setting("favorites_servers_list", 999, server=server)
|
||||
progreso.update(old_div((i * 100), n), config.get_localized_string(60559) % server_parameters['name'])
|
||||
i += 1
|
||||
|
||||
c = 1
|
||||
logger.debug(dict_favorites)
|
||||
favorites_servers_list = []
|
||||
while c in dict_favorites:
|
||||
favorites_servers_list.append(dict_favorites[c])
|
||||
c += 1
|
||||
favorites_servers_list = [dict_favorites[k] for k in sorted(dict_favorites.keys())]
|
||||
|
||||
config.set_setting("favorites_servers_list", favorites_servers_list, server='servers')
|
||||
|
||||
if not dict_name: # If there is no server in the list, deactivate it
|
||||
if not favorites_servers_list: # If there is no server in the list, deactivate it
|
||||
config.set_setting("favorites_servers", False)
|
||||
|
||||
progreso.close()
|
||||
|
||||
|
||||
def settings(item):
|
||||
config.open_settings()
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
import re
|
||||
from core import filetools, jsontools, trakt_tools
|
||||
from core import support
|
||||
from core.tmdb import Tmdb
|
||||
from core.scrapertools import htmlclean, decodeHtmlentities
|
||||
from core.support import thumb, typo, match, Item
|
||||
|
||||
Reference in New Issue
Block a user